/// <summary> /// 更新采购订单中的已制预付通知单金额 /// </summary> private void UpdatePOPrePaymentMoney() { if (this.SrcPO != null && this.PrePayment.DocumentType.BusType == EnumBE.FIBusTypeEnum.Blue) { using (ISession session = Session.Open()) { UFIDA.U9.PM.PO.PurchaseOrder poDoc = UFIDA.U9.PM.PO.PurchaseOrder.Finder.FindByID(this.SrcPO.ID); if (poDoc != null) { #region 反写采购订单已制预付款通知单金额 decimal sumPOMoney = 0; foreach (UFIDA.U9.PM.PO.POLine line in poDoc.POLines) { sumPOMoney = sumPOMoney + line.TotalMnyTC; } decimal sumPayMoney = 0; //已制预付款通知单数量 decimal sumMoveMoney = 0; //挪出数量 if (!string.IsNullOrEmpty(poDoc.DescFlexField.PrivateDescSeg3)) { sumPayMoney = decimal.Parse(poDoc.DescFlexField.PrivateDescSeg3); } if (!string.IsNullOrEmpty(poDoc.DescFlexField.PrivateDescSeg6)) { sumMoveMoney = decimal.Parse(poDoc.DescFlexField.PrivateDescSeg6); } if (this.SysState == UFSoft.UBF.PL.Engine.ObjectState.Inserted)//新增 { sumPayMoney = sumPayMoney + this.PrePayMoney; } else if (this.SysState == UFSoft.UBF.PL.Engine.ObjectState.Deleted)//删除 { sumPayMoney = sumPayMoney - this.PrePayMoney; sumMoveMoney = sumMoveMoney - this.SumMoveMoney; } else//修改 { sumPayMoney = sumPayMoney - this.OriginalData.PrePayMoney + this.PrePayMoney; } if (sumPayMoney > sumPOMoney) { throw new Exception("第" + this.LineNum.ToString() + "的预付款金额大于采购订单总金额!"); } poDoc.DescFlexField.PrivateDescSeg3 = sumPayMoney.ToString(); #endregion } session.Commit(); } } }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; //key的有效性判断 if (key == null) { return; } //转成所需实体,同时判断有效性 UFIDA.U9.PM.PO.PurchaseOrder po = (UFIDA.U9.PM.PO.PurchaseOrder)key.GetEntity(); if (po == null) { return; } else { if (po.SubType.Value.ToString() == "-1")//标准采购 { string productLine = ""; productLine = po.POLines[0].ItemInfo.ItemID.DescFlexField.PrivateDescSeg28; for (int i = 0; i < po.POLines.Count; i++) { if (productLine == "02") //当存在功放料品 { if (po.POLines[i].ItemInfo.ItemID.DescFlexField.PrivateDescSeg28 != "02") //存在非功放 { throw new Exception("订单中同时存在功放和非功放料品,创建失败!"); } productLine = "02"; } else//存在非功放料品 { if (po.POLines[i].ItemInfo.ItemID.DescFlexField.PrivateDescSeg28 == "02") { throw new Exception("订单中同时存在功放和非功放料品,创建失败!"); } productLine = "99"; } } po.DescFlexField.PrivateDescSeg1 = productLine; } } }
/// <summary> /// 更新采购订单上的预付红冲金额 /// </summary> /// <param name="po"></param> /// <param name="money"></param> private void UpdatePORedMoney(long po, decimal money) { UFIDA.U9.PM.PO.PurchaseOrder poDoc = UFIDA.U9.PM.PO.PurchaseOrder.Finder.FindByID(po); if (poDoc != null) { decimal sumPOMoney = 0; if (!string.IsNullOrEmpty(poDoc.DescFlexField.PrivateDescSeg5)) { sumPOMoney = decimal.Parse(poDoc.DescFlexField.PrivateDescSeg5); } sumPOMoney = sumPOMoney + money; poDoc.DescFlexField.PrivateDescSeg5 = sumPOMoney.ToString(); } }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; //key的有效性判断 if (key == null) { return; } //转成所需实体,同时判断有效性 //UFIDA.U9.InvDoc.TransferIn.TransferIn transferIn = (UFIDA.U9.InvDoc.TransferIn.TransferIn)key.GetEntity(); UFIDA.U9.PM.PO.PurchaseOrder entity = (UFIDA.U9.PM.PO.PurchaseOrder)key.GetEntity(); if (entity == null) { return; } else { try { if (entity.SysState == UFSoft.UBF.PL.Engine.ObjectState.Inserted)//插入操作 { //清空复制的OA流程扩展字段字段内容 entity.DescFlexField.PrivateDescSeg4 = ""; entity.DescFlexField.PrivateDescSeg5 = ""; entity.DescFlexField.PrivateDescSeg6 = ""; } } catch (Exception ex) { throw new Exception(ex.Message); } } }
/// <summary> /// 修改预付款通知单行中的挪出数量 /// </summary> /// <param name="doc"></param> /// <param name="lineDto"></param> private void UpdatePrePaymentLine(UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePayment doc, PrePaymentLineDTO lineDto) { UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePaymentLine line = UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePaymentLine.Finder.FindByID(lineDto.ID); if (line != null) { line.SumMoveMoney = line.SumMoveMoney + lineDto.ThisMoveMoney; if (line.SrcPO != null) { UFIDA.U9.PM.PO.PurchaseOrder poDoc = UFIDA.U9.PM.PO.PurchaseOrder.Finder.FindByID(line.SrcPO.ID); if (poDoc != null) { decimal sumMoveMoney = 0; if (!string.IsNullOrEmpty(poDoc.DescFlexField.PrivateDescSeg6)) { sumMoveMoney = decimal.Parse(poDoc.DescFlexField.PrivateDescSeg6); } sumMoveMoney = sumMoveMoney + lineDto.ThisMoveMoney; poDoc.DescFlexField.PrivateDescSeg6 = sumMoveMoney.ToString(); } } } }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; //key的有效性判断 if (key == null) { return; } //转成所需实体,同时判断有效性 UFIDA.U9.PM.PO.PurchaseOrder po = (UFIDA.U9.PM.PO.PurchaseOrder)key.GetEntity(); if (po == null) { return; } else { //锁WMO转WPO功能 if (po.Org.Code == "300")//po.SubType委外订单 { try { DataParamList dp = new DataParamList(); dp.Add(DataParamFactory.Create("DocNo", po.DocNo, ParameterDirection.Input, DbType.String, 50)); dp.Add(DataParamFactory.CreateOutput("Result", DbType.String)); DataAccessor.RunSP("sp_Auctus_BE_PurchaseOrderAI", dp); string result = dp["Result"].Value.ToString(); if (result != "0") { throw new Exception(result); } } catch (Exception ex) { throw new Exception(ex.Message); } } ////锁WMO转WPO功能 //if (po.Org.Code == "300" && po.SubType.Value.ToString() != "-1")//po.SubType委外订单 //{ // try // { // DataParamList dp = new DataParamList(); // dp.Add(DataParamFactory.Create("DocNo", po.DocNo, ParameterDirection.Input, DbType.String, 50)); // dp.Add(DataParamFactory.CreateOutput("Result", DbType.String)); // DataAccessor.RunSP("sp_Auctus_BE_PurchaseOrderAI", dp); // string result = dp["Result"].Value.ToString(); // if (result != "0") // { // throw new Exception(result); // } // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //} //end if ////锁WMO转WPO功能 //if (po.Org.Code == "300")//po.SubType委外订单 //{ // try // { // DataParamList dp = new DataParamList(); // dp.Add(DataParamFactory.Create("DocNo", po.DocNo, ParameterDirection.Input, DbType.String, 50)); // dp.Add(DataParamFactory.CreateOutput("Result", DbType.String)); // DataAccessor.RunSP("sp_Auctus_BE_PurchaseOrderAI", dp); // string result = dp["Result"].Value.ToString(); // if (result != "1") // { // throw new Exception(result); // } // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //}//end if } }