Epicor BPM中调用BO
C# 全选
// 没有要更新的行项目
if(String.IsNullOrEmpty(callContextBpmData.Character01)) return;
List<int> updatePackLines = new List<int>();
try
{
updatePackLines = callContextBpmData.Character01.Split(",").Select(x=>int.Parse(x)).ToList();
if(updatePackLines.Count==0) return;
}
catch(Exception ex) {
throw new Ice.Common.BusinessObjectException(new Ice.Common.BusinessObjectMessage("更新供应商价格出错,无法解析出需要更新价格的行项目:"+ callContextBpmData.Character01){
Type=Ice.Common.BusinessObjectMessageType.Error
});
}
var tmpDs = ds;
using(var bo = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReceiptSvcContract>(this.Db)) {
foreach(var packLine in updatePackLines) {
var o = tmpDs.RcvDtl.Where(w=>w.PackLine == packLine).First();
var s_headrow = tmpDs.RcvHead[0];
tmpDs = new ReceiptTableset();
var headRow = tmpDs.RcvHead.NewRow();
BufferCopy.Copy(s_headrow,headRow);
tmpDs.RcvHead.Add(headRow);
var sourceRow = tmpDs.RcvDtl.NewRow();
var updateRow = tmpDs.RcvDtl.NewRow();
BufferCopy.Copy(o,sourceRow);
BufferCopy.Copy(o,updateRow);
tmpDs.RcvDtl.Add(sourceRow);
tmpDs.RcvDtl.Add(updateRow);
updateRow.RowMod = "U";
try
{
// ref ReceiptTableset ds, int vendorNum, string purPoint, string packSlip, int packLine, decimal suppPrice, out string warningMsg
string warningMsg;
bo.CheckSupplierPrice(ref tmpDs,o.VendorNum,o.PurPoint,o.PackSlip,o.PackLine,0,out warningMsg);
updateRow["DocScrVendorUnitCost"] = 0m;
// int vendorNum, string purPoint, string packSlip, int packLine
bo.OnChangeDtlSupplierPrice(ref tmpDs,o.VendorNum,o.PurPoint,o.PackSlip,o.PackLine);
bool RunChkLCAmtBeforeUpdate = true;
bool RunChkHdrBeforeUpdate = true;
int ipVendorNum = o.VendorNum;
string ipPurPoint= o.PurPoint;
string ipPackSlip = o.PackSlip;
int ipPackLine = 0;
bool lRunPreUpdate = true;
bool lRunCreatePartLot=false;
string partNum="";
string lotNum="";
bool lOkToUpdate= true;
bool lRunChkDtl= true;
bool lRunCheckCompliance = false;
bool lRunChkDtlCompliance= true;
/*
bool RunChkLCAmtBeforeUpdate, bool RunChkHdrBeforeUpdate, int ipVendorNum, string ipPurPoint, string ipPackSlip,
int ipPackLine, out string cLCAmtMessage, out string opUpliftWarnMsg, out string opReceiptWarnMsg, out string opArriveWarnMsg,
bool lRunChkDtl, out string qMessageStr, out string sMessageStr, out string lcMessageStr, out string pcMessageStr,
bool lRunChkDtlCompliance, out string qDtlComplianceMsgStr, bool lRunCheckCompliance, out bool lCompliant, bool lRunPreUpdate,
out bool lRequiresUserInput, bool lRunCreatePartLot, string partNum, string lotNum, bool lOkToUpdate,
out bool lUpdateWasRun, out string wrnLines, ref ReceiptTableset ds
*/
// out参数
string cLCAmtMessage, opUpliftWarnMsg, opReceiptWarnMsg, opArriveWarnMsg;
string qMessageStr,sMessageStr, lcMessageStr, pcMessageStr;
string qDtlComplianceMsgStr;
bool lCompliant,lRequiresUserInput;
bool lUpdateWasRun;
string wrnLines;
// 保存
bo.UpdateMaster(RunChkLCAmtBeforeUpdate,RunChkHdrBeforeUpdate,ipVendorNum,ipPurPoint,ipPackSlip
,ipPackLine,out cLCAmtMessage, out opUpliftWarnMsg, out opReceiptWarnMsg, out opArriveWarnMsg
,lRunChkDtl, out qMessageStr, out sMessageStr, out lcMessageStr, out pcMessageStr
,lRunChkDtlCompliance, out qDtlComplianceMsgStr,lRunCheckCompliance, out lCompliant, lRunPreUpdate
, out lRequiresUserInput, lRunCreatePartLot, partNum, lotNum, lOkToUpdate
, out lUpdateWasRun, out wrnLines,ref tmpDs);
// 刷新返回的数据,避免界面显示不一致
var _dsRow = ds.RcvDtl.Where(w=>w.PackLine == packLine).First();
var _newRow = tmpDs.RcvDtl.Where(w=>w.PackLine == packLine).First();
BufferCopy.Copy(_newRow,_dsRow);
}
catch(Exception ex) {
throw new Ice.Common.BusinessObjectException(new Ice.Common.BusinessObjectMessage("异常:"+ex.Message){
Type=Ice.Common.BusinessObjectMessageType.Error
});
}
}
}版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
epicor 张国生


