public override object Do(object obj) { DispatchOutWhCarSV bpObj = (DispatchOutWhCarSV)obj; //get business operation context is as follows //IContext context = ContextManager.Context //auto generating code end,underside is user custom code //and if you Implement replace this Exception Code... //long svID = HBHCommon.HBHCommonSVBefore(bpObj); List <ShipBackDTO> result2 = CreateDispatch(bpObj); //if (result2 != null // && result2.Count > 0 // ) //{ // ShipBackDTO first = PubClass.GetFirst<ShipBackDTO>(result2); // if (first != null) // { // HBHCommon.HBHCommonSVAfter(svID, result2, first.IsSuccess, first.ErrorInfo, first.ERPDocNo); // } //} return(result2); }
private System.Collections.Generic.List <ShipBackDTO> CreateDispatch(DispatchOutWhCarSV bpObj) { System.Collections.Generic.List <ShipBackDTO> result = new System.Collections.Generic.List <ShipBackDTO>(); //object result2; try { if (bpObj.CarShipLineDTOs == null || bpObj.CarShipLineDTOs.Count == 0) { string msg = "传入参数不可为空"; result.Add(new ShipBackDTO { IsSuccess = false, ErrorInfo = msg, Timestamp = System.DateTime.Now }); //result2 = result; HBHCommon.LoggerError(msg); } else { System.Collections.Generic.List <CarShipLineDTO> shiplist = new System.Collections.Generic.List <CarShipLineDTO>(); System.Collections.Generic.List <CarShipLineDTO> transferinlist = new System.Collections.Generic.List <CarShipLineDTO>(); string errormessage = this.ValidateParamNullOrEmpty(bpObj, ref shiplist, ref transferinlist); if (!string.IsNullOrEmpty(errormessage)) { string msg = "请检查传入参数"; result.Add(new ShipBackDTO { IsSuccess = false, ErrorInfo = errormessage + "请检查传入参数", Timestamp = System.DateTime.Now }); //result2 = result; HBHCommon.LoggerError(msg); } else { System.Collections.Generic.List <DocKeyDTOData> shipidlist = new System.Collections.Generic.List <DocKeyDTOData>(); System.Collections.Generic.List <CommonArchiveDataDTOData> transinidlist = new System.Collections.Generic.List <CommonArchiveDataDTOData>(); if (shiplist != null && shiplist.Count > 0) { try { CreateShipSVProxy proxy = new CreateShipSVProxy(); proxy.ShipDTOs = (this.GetShipDTOList(shiplist)); shipidlist = proxy.Do(); // 整车生成开立的出货单; } catch (System.Exception e) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生成出货单失败:" + e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生成出货单失败:" + e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); return(result); } if (shipidlist == null || shipidlist.Count <= 0) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生单失败:没有生成出货单", // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生单失败:没有生成出货单"; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo); result.Add(backDTO); return(result); } } if (transferinlist != null && transferinlist.Count > 0) { //using (UBFTransactionScope trans = new UBFTransactionScope(TransactionOption.Required)) { try { UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy proxy2 = new UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy(); proxy2.TransferInDTOList = (this.GetTransferInDTOList(transferinlist)); transinidlist = proxy2.Do(); if (transinidlist == null || transinidlist.Count <= 0) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生单失败:没有生成调入单", // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生单失败:没有生成调入单"; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo); result.Add(backDTO); return(result); } TransferInBatchApproveSRVProxy approveproxy = new TransferInBatchApproveSRVProxy(); approveproxy.DocList = (transinidlist); approveproxy.ApprovedBy = (Context.LoginUser); approveproxy.ApprovedOn = (System.DateTime.Now); approveproxy.Do(); //trans.Commit(); } catch (System.Exception e) { //trans.Rollback(); //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生成调入单失败:" + e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生成调入单失败:" + e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); return(result); } } } foreach (DocKeyDTOData shipid in shipidlist) { Ship ship = Ship.Finder.FindByID(shipid.DocID); if (ship != null) { result.Add(new ShipBackDTO { IsSuccess = true, ErrorInfo = "生单出货单成功", Timestamp = System.DateTime.Now, ERPDocNo = shipid.DocNO, DMSDocNo = ship.DescFlexField.PubDescSeg7 }); } } foreach (CommonArchiveDataDTOData transin in transinidlist) { TransferIn t = TransferIn.Finder.FindByID(transin.ID); if (t != null) { result.Add(new ShipBackDTO { IsSuccess = true, ErrorInfo = "生单调入单成功", Timestamp = System.DateTime.Now, ERPDocNo = transin.Code, DMSDocNo = t.TransInLines[0].DescFlexSegments.PubDescSeg5 }); } } //result2 = result; } } } catch (System.Exception e) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); } //return result2; return(result); }
/// <summary> /// 传入参数非空校验 /// </summary> /// <param name="bpObj"></param> private string ValidateParamNullOrEmpty(DispatchOutWhCarSV bpObj, ref System.Collections.Generic.List<CarShipLineDTO> shiplist, ref System.Collections.Generic.List<CarShipLineDTO> transferinlist) { string errormessage = string.Empty; foreach (CarShipLineDTO linedto in bpObj.CarShipLineDTOs) { if (linedto.OrderType == 401103 && !linedto.IsSale) { if (string.IsNullOrEmpty(linedto.WhOut)) { errormessage += string.Format("[{0}]DMS销售出库单的[调出存储地点({1})]不可为空,", linedto.DMSShipNo, linedto.WhOut); } else { Warehouse whout = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.WhOut), new OqlParam[0]); if (whout == null) { errormessage += string.Format("[{0}]DMS销售出库单的[调出存储地点({1})]在U9系统中找不到对应的存储地点档案,请同步,", linedto.DMSShipNo, linedto.WhOut); } } if (string.IsNullOrEmpty(linedto.WhIn)) { errormessage += string.Format("[{0}]DMS销售出库单的[调入存储地点({1})]不可为空,", linedto.DMSShipNo, linedto.WhIn); } else { Warehouse whin = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.WhIn), new OqlParam[0]); if (whin == null) { errormessage += string.Format("[{0}]DMS销售出库单的[调入存储地点({1})]在U9系统中找不到对应的存储地点档案,请同步,", linedto.DMSShipNo, linedto.WhIn); } } transferinlist.Add(linedto); } else { if (linedto.OrderType != 401103 || !linedto.IsSale) { if (linedto.VehicleOrChassis <= 0) { errormessage += string.Format("[{0}]DMS销售出库单的[整车或底盘]不可为空,", linedto.DMSShipNo); } } if (string.IsNullOrEmpty(linedto.DealerCode)) { errormessage += string.Format("[{0}]DMS销售出库单的[经销商代码({1})]不可为空,", linedto.DMSShipNo, linedto.DealerCode); } else { Customer customer = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.DealerCode), new OqlParam[0]); if (customer == null) { errormessage += string.Format("[{0}]DMS销售出库单的[经销商代码({1})]在U9系统中找不到对应的客户档案,请同步,", linedto.DMSShipNo, linedto.DealerCode); } } shiplist.Add(linedto); } if (string.IsNullOrEmpty(linedto.ErpMaterialCode)) { errormessage += string.Format("[{0}]DMS销售出库单的[ERP料号]不可为空,", linedto.DMSShipNo); } else { ItemMaster item = ItemMaster.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.ErpMaterialCode), new OqlParam[0]); if (item == null) { errormessage += string.Format("[{0}]DMS销售出库单的[ERP料号][{1}]在U9系统中找不到对应的料品档案,请同步,", linedto.DMSShipNo, linedto.ErpMaterialCode); } } if (linedto.Number <= 0m) { errormessage += string.Format("[{0}]DMS销售出库单的[数量]必须大于0,", linedto.DMSShipNo); } if (linedto.SpitOrderFlag.IsNull()) { linedto.SpitOrderFlag = HBHCommon.DefaultSplitFlag; } } return errormessage; }
/// <summary> /// 传入参数非空校验 /// </summary> /// <param name="bpObj"></param> private string ValidateParamNullOrEmpty(DispatchOutWhCarSV bpObj, ref System.Collections.Generic.List <CarShipLineDTO> shiplist, ref System.Collections.Generic.List <CarShipLineDTO> transferinlist) { string errormessage = string.Empty; foreach (CarShipLineDTO linedto in bpObj.CarShipLineDTOs) { if (linedto.OrderType == 401103 && !linedto.IsSale) { if (string.IsNullOrEmpty(linedto.WhOut)) { errormessage += string.Format("[{0}]DMS销售出库单的[调出存储地点({1})]不可为空,", linedto.DMSShipNo, linedto.WhOut); } else { Warehouse whout = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.WhOut), new OqlParam[0]); if (whout == null) { errormessage += string.Format("[{0}]DMS销售出库单的[调出存储地点({1})]在U9系统中找不到对应的存储地点档案,请同步,", linedto.DMSShipNo, linedto.WhOut); } } if (string.IsNullOrEmpty(linedto.WhIn)) { errormessage += string.Format("[{0}]DMS销售出库单的[调入存储地点({1})]不可为空,", linedto.DMSShipNo, linedto.WhIn); } else { Warehouse whin = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.WhIn), new OqlParam[0]); if (whin == null) { errormessage += string.Format("[{0}]DMS销售出库单的[调入存储地点({1})]在U9系统中找不到对应的存储地点档案,请同步,", linedto.DMSShipNo, linedto.WhIn); } } transferinlist.Add(linedto); } else { if (linedto.OrderType != 401103 || !linedto.IsSale) { if (linedto.VehicleOrChassis <= 0) { errormessage += string.Format("[{0}]DMS销售出库单的[整车或底盘]不可为空,", linedto.DMSShipNo); } } if (string.IsNullOrEmpty(linedto.DealerCode)) { errormessage += string.Format("[{0}]DMS销售出库单的[经销商代码({1})]不可为空,", linedto.DMSShipNo, linedto.DealerCode); } else { Customer customer = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.DealerCode), new OqlParam[0]); if (customer == null) { errormessage += string.Format("[{0}]DMS销售出库单的[经销商代码({1})]在U9系统中找不到对应的客户档案,请同步,", linedto.DMSShipNo, linedto.DealerCode); } } shiplist.Add(linedto); } if (string.IsNullOrEmpty(linedto.ErpMaterialCode)) { errormessage += string.Format("[{0}]DMS销售出库单的[ERP料号]不可为空,", linedto.DMSShipNo); } else { ItemMaster item = ItemMaster.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), linedto.ErpMaterialCode), new OqlParam[0]); if (item == null) { errormessage += string.Format("[{0}]DMS销售出库单的[ERP料号][{1}]在U9系统中找不到对应的料品档案,请同步,", linedto.DMSShipNo, linedto.ErpMaterialCode); } } if (linedto.Number <= 0m) { errormessage += string.Format("[{0}]DMS销售出库单的[数量]必须大于0,", linedto.DMSShipNo); } if (linedto.SpitOrderFlag.IsNull()) { linedto.SpitOrderFlag = HBHCommon.DefaultSplitFlag; } } return(errormessage); }
private System.Collections.Generic.List<ShipBackDTO> CreateDispatch(DispatchOutWhCarSV bpObj) { System.Collections.Generic.List<ShipBackDTO> result = new System.Collections.Generic.List<ShipBackDTO>(); //object result2; try { if (bpObj.CarShipLineDTOs == null || bpObj.CarShipLineDTOs.Count == 0) { string msg = "传入参数不可为空"; result.Add(new ShipBackDTO { IsSuccess = false, ErrorInfo = msg, Timestamp = System.DateTime.Now }); //result2 = result; HBHCommon.LoggerError(msg); } else { System.Collections.Generic.List<CarShipLineDTO> shiplist = new System.Collections.Generic.List<CarShipLineDTO>(); System.Collections.Generic.List<CarShipLineDTO> transferinlist = new System.Collections.Generic.List<CarShipLineDTO>(); string errormessage = this.ValidateParamNullOrEmpty(bpObj, ref shiplist, ref transferinlist); if (!string.IsNullOrEmpty(errormessage)) { string msg = "请检查传入参数"; result.Add(new ShipBackDTO { IsSuccess = false, ErrorInfo = errormessage + "请检查传入参数", Timestamp = System.DateTime.Now }); //result2 = result; HBHCommon.LoggerError(msg); } else { System.Collections.Generic.List<DocKeyDTOData> shipidlist = new System.Collections.Generic.List<DocKeyDTOData>(); System.Collections.Generic.List<CommonArchiveDataDTOData> transinidlist = new System.Collections.Generic.List<CommonArchiveDataDTOData>(); if (shiplist != null && shiplist.Count > 0) { try { CreateShipSVProxy proxy = new CreateShipSVProxy(); proxy.ShipDTOs = (this.GetShipDTOList(shiplist)); shipidlist = proxy.Do(); // 整车生成开立的出货单; } catch (System.Exception e) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生成出货单失败:" + e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生成出货单失败:" + e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); return result; } if (shipidlist == null || shipidlist.Count <= 0) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生单失败:没有生成出货单", // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生单失败:没有生成出货单"; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo ); result.Add(backDTO); return result; } } if (transferinlist != null && transferinlist.Count > 0) { //using (UBFTransactionScope trans = new UBFTransactionScope(TransactionOption.Required)) { try { UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy proxy2 = new UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy(); proxy2.TransferInDTOList = (this.GetTransferInDTOList(transferinlist)); transinidlist = proxy2.Do(); if (transinidlist == null || transinidlist.Count <= 0) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生单失败:没有生成调入单", // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生单失败:没有生成调入单"; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo); result.Add(backDTO); return result; } TransferInBatchApproveSRVProxy approveproxy = new TransferInBatchApproveSRVProxy(); approveproxy.DocList = (transinidlist); approveproxy.ApprovedBy = (Context.LoginUser); approveproxy.ApprovedOn = (System.DateTime.Now); approveproxy.Do(); //trans.Commit(); } catch (System.Exception e) { //trans.Rollback(); //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = "生成调入单失败:" + e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; //return result2; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = "生成调入单失败:" + e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); return result; } } } foreach (DocKeyDTOData shipid in shipidlist) { Ship ship = Ship.Finder.FindByID(shipid.DocID); if (ship != null) { result.Add(new ShipBackDTO { IsSuccess = true, ErrorInfo = "生单出货单成功", Timestamp = System.DateTime.Now, ERPDocNo = shipid.DocNO, DMSDocNo = ship.DescFlexField.PubDescSeg7 }); } } foreach (CommonArchiveDataDTOData transin in transinidlist) { TransferIn t = TransferIn.Finder.FindByID(transin.ID); if (t != null) { result.Add(new ShipBackDTO { IsSuccess = true, ErrorInfo = "生单调入单成功", Timestamp = System.DateTime.Now, ERPDocNo = transin.Code, DMSDocNo = t.TransInLines[0].DescFlexSegments.PubDescSeg5 }); } } //result2 = result; } } } catch (System.Exception e) { //result.Add(new ShipBackDTO //{ // IsSuccess = false, // ErrorInfo = e.Message, // Timestamp = System.DateTime.Now //}); //result2 = result; ShipBackDTO backDTO = new ShipBackDTO(); backDTO.IsSuccess = false; backDTO.ErrorInfo = e.Message; backDTO.Timestamp = System.DateTime.Now; HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace); result.Add(backDTO); } //return result2; return result; }