public static bool IsUpdateDMS(SupplySource supplierItem) { return supplierItem != null && supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.Supplier != null && PubHelper.IsUpdateDMS(supplierItem.SupplierInfo.Supplier) ; }
public static bool IsUpdateDMS(SupplySource supplierItem) { return(supplierItem != null && supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.Supplier != null && PubHelper.IsUpdateDMS(supplierItem.SupplierInfo.Supplier) ); }
public static bool IsUpdateDMS(TransLine transline, out Supplier supt) { supt = null; //return transline.Wh != null && transline.Wh.Code.StartsWith("SHBJ"); if (transline.Wh != null && PubHelper.IsWarehouse2DMS(transline.Wh) //&& PubHelper.IsUpdateDMS(transline.SupplierInfo) ) { //// 批次供应商 //string suptCode = transline.LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1; //if (suptCode.IsNotNullOrWhiteSpace()) //{ // Supplier supt = Supplier.Finder.Find("Code=@Code" // , new OqlParam(suptCode) // ); // if (PubHelper.IsUpdateDMS(supt)) // { // return true; // } //} // 刨除VMI结算 if (IsUpdateWhqoh(transline)) { // 如果不是DMS的出货单,才更新DMS; if (!IsDMSShipment(transline)) { // 如果存在货源表 bool bl = PubHelper.IsUpdateDMS(transline.LotInfo, out supt); if (bl) { SupplySource supplySource = SupplySource.Finder.Find("ItemInfo.ItemID.Code=@ItemCode and SupplierInfo.Supplier.Code=@SuptCode" , new OqlParam(transline.ItemInfo.ItemID.Code) , new OqlParam(supt.Code) ); if (supplySource != null) { return(SupplySourceInserted.IsUpdateDMS(supplySource)); } } } } } return(false); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SupplySource supplierItem = key.GetEntity() as SupplySource; //if (Context.LoginOrg.Code == "10") if (PubHelper.IsOrg_SupplierItem2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (SupplySourceInserted.IsUpdateDMS(supplierItem)) { //if (IsKeyChanged(supplierItem)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = GetUpdateDMSDTO(supplierItem); if (lines != null && lines.Count > 0 ) { try { partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } } } }
public static SupplySource GetSupplySource(DateTime docDate, string newSuptCode, string newItemCode) { if (docDate == null || docDate.Year <= 2010 ) { docDate = Context.LoginDate; } SupplySource suptItem = SupplySource.Finder.Find("SupplierInfo.Code=@SuptCode and ItemInfo.ItemCode=@ItemCode and Effective.IsEffective=1 and @Now between Effective.EffectiveDate and Effective.DisableDate" , new OqlParam(newSuptCode) , new OqlParam(newItemCode) , new OqlParam(docDate) ); return(suptItem); }
public static SalePriceLine GetSalePriceList(SupplySource supplierItem) { string opath = string.Format("SalePriceList.Org.Code={0} and ItemInfo.ItemCode='{1}' and Active=1 and '{2}' between FromDate and ToDate " //, Context.LoginOrg.ID.ToString() , GetPartPriceListOrgCode() , supplierItem.ItemInfo.ItemCode , System.DateTime.Now.ToString()); //if (Context.LoginOrg.Code == Const_OrgCode_Electric) //{ // opath += string.Format(" and SalePriceList.Code='{0}'", Const_ElectricPartPriceListCode); //} //else if (Context.LoginOrg.Code == Const_OrgCode_Hubei) //{ // //opath += string.Format(" and SalePriceList.Code={0}", Const_SalePartPriceListCode); //} string pricelistCode = GetPartPriceListCode(); if (pricelistCode.IsNotNullOrWhiteSpace()) { opath += string.Format(" and SalePriceList.Code='{0}'", pricelistCode); } return(SalePriceLine.Finder.Find(opath)); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SupplySource supplierItem = key.GetEntity() as SupplySource; //if (Context.LoginOrg.Code == "10") if (PubHelper.IsOrg_SupplierItem2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (IsUpdateDMS(supplierItem) ) { try { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); partBaseDto linedto = new partBaseDto(); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); if (supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.SupplierKey != null) { linedto.suptCode = supplierItem.SupplierInfo.Supplier.Code; } if (supplierItem.ItemInfo != null && supplierItem.ItemInfo.ItemIDKey != null) { linedto.partCode = supplierItem.ItemInfo.ItemID.Code; linedto.partName = supplierItem.ItemInfo.ItemID.Name; } if (supplierItem.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = supplierItem.ItemInfo.ItemID.InventoryUOM.Name; } if (supplierItem.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.isFlag = "2"; //SalePriceLine line = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", Context.LoginOrg.ID.ToString(), supplierItem.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SalePriceLine line = PubHelper.GetSalePriceList(supplierItem); if (line != null) { linedto.salePrice = float.Parse(line.Price.ToString("G0")); linedto.unitPrace = linedto.salePrice; } else { linedto.salePrice = 0f; linedto.unitPrace = 0f; } linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isEffective = supplierItem.Effective.IsEffective.ToString(); linedto.actionType = 1; lines.Add(linedto); partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { Receivement entity = key.GetEntity() as Receivement; if (entity != null ) { DateTime docDate = entity.BusinessDate; string oldSuptCode = string.Empty; string newSuptCode = string.Empty; if (entity.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && entity.OriginalData != null && entity.OriginalData.Supplier != null ) { oldSuptCode = entity.OriginalData.Supplier.Code; } if (entity.Supplier != null) { newSuptCode = entity.Supplier.Code; } foreach (RcvLine docline in entity.RcvLines) { string oldItemCode = string.Empty; string newItemCode = string.Empty; if (docline.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && docline.OriginalData != null && docline.OriginalData.ItemInfo != null ) { oldItemCode = docline.OriginalData.ItemInfo.ItemCode; } if (docline.ItemInfo != null) { newItemCode = docline.ItemInfo.ItemCode; } if (newSuptCode.IsNotNullOrWhiteSpace() && newItemCode.IsNotNullOrWhiteSpace() // 新旧不一致,才重取 && (oldSuptCode != newSuptCode || oldItemCode != newItemCode ) ) { /* * 货源表 1 * * 标准采购:9 * 标准收货:2 * 到货:2 * 质检单:6 */ POLine srcPOLine = null; if (docline.SrcPO != null && docline.SrcPO.SrcDocLine != null && docline.SrcPO.SrcDocLine.EntityID > 0 ) { srcPOLine = POLine.Finder.FindByID(docline.SrcPO.SrcDocLine.EntityID); } if (srcPOLine != null) { docline.DescFlexSegments.PrivateDescSeg2 = srcPOLine.DescFlexSegments.PrivateDescSeg9; } else { SupplySource suptSource = PurchaseOrder_BeforeDefaultValue.GetSupplySource(docDate, newSuptCode, newItemCode); if (suptSource != null) { docline.DescFlexSegments.PrivateDescSeg2 = suptSource.DescFlexField.PrivateDescSeg1; } } } } } } } }
private static System.Collections.Generic.List <partBaseDto> GetUpdateDMSDTO(SupplySource supplierItem) { //// 如果修改供应商、和料品,那么删除旧的,新增新的;如果这两个不修改,就不需要更新DMS了; System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); // 关键字段改变,先删除旧的、再新增新的; if (IsKeyChanged(supplierItem)) { partBaseDto linedto = new partBaseDto(); if (supplierItem.OriginalData.SupplierInfo != null && supplierItem.OriginalData.SupplierInfo.SupplierKey != null) { linedto.suptCode = supplierItem.OriginalData.SupplierInfo.Supplier.Code; } if (supplierItem.OriginalData.ItemInfo != null && supplierItem.OriginalData.ItemInfo.ItemIDKey != null) { linedto.partCode = supplierItem.OriginalData.ItemInfo.ItemID.Code; linedto.partName = supplierItem.OriginalData.ItemInfo.ItemID.Name; } if (supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM.Name; } if (supplierItem.OriginalData.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } //SalePriceLine line = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", Context.LoginOrg.ID.ToString(), supplierItem.OriginalData.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SalePriceLine line = PubHelper.GetSalePriceList(supplierItem); if (line != null) { linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; } else { linedto.salePrice = 0f; linedto.unitPrace = 0f; } linedto.isFlag = "2"; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isEffective = supplierItem.OriginalData.Effective.IsEffective.ToString(); linedto.actionType = 3; lines.Add(linedto); linedto = new partBaseDto(); if (supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.SupplierKey != null) { linedto.suptCode = supplierItem.SupplierInfo.Supplier.Code; } if (supplierItem.ItemInfo != null && supplierItem.ItemInfo.ItemIDKey != null) { linedto.partCode = supplierItem.ItemInfo.ItemID.Code; linedto.partName = supplierItem.ItemInfo.ItemID.Name; } if (supplierItem.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = supplierItem.ItemInfo.ItemID.InventoryUOM.Name; } if (supplierItem.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } SalePriceLine line2 = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", supplierItem.MasterOrg.ID.ToString(), supplierItem.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); if (line2 != null) { linedto.salePrice = float.Parse(line2.Price.ToString()); linedto.unitPrace = linedto.salePrice; } else { linedto.salePrice = 0f; linedto.unitPrace = 0f; } linedto.isFlag = "2"; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isEffective = supplierItem.Effective.IsEffective.ToString(); linedto.actionType = 1; lines.Add(linedto); } // UI更新,不管是否关键字段,都更新DMS(熊彬想实现手动同步dms操作) else // if(supplierItem.ActiveType == ActivityTypeEnum.SrvUpdate) { partBaseDto linedto = new partBaseDto(); if (supplierItem.OriginalData.SupplierInfo != null && supplierItem.OriginalData.SupplierInfo.SupplierKey != null) { linedto.suptCode = supplierItem.OriginalData.SupplierInfo.Supplier.Code; } if (supplierItem.OriginalData.ItemInfo != null && supplierItem.OriginalData.ItemInfo.ItemIDKey != null) { linedto.partCode = supplierItem.OriginalData.ItemInfo.ItemID.Code; linedto.partName = supplierItem.OriginalData.ItemInfo.ItemID.Name; } if (supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM.Name; } if (supplierItem.OriginalData.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } //SalePriceLine line = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", Context.LoginOrg.ID.ToString(), supplierItem.OriginalData.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SalePriceLine line = PubHelper.GetSalePriceList(supplierItem); if (line != null) { linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; } else { linedto.salePrice = 0f; linedto.unitPrace = 0f; } linedto.isFlag = "2"; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isEffective = supplierItem.OriginalData.Effective.IsEffective.ToString(); linedto.actionType = 2; lines.Add(linedto); } return(lines); }
private static bool IsKeyChanged(SupplySource supplierItem) { return(supplierItem.OriginalData.ItemInfo.ItemID != supplierItem.ItemInfo.ItemID || supplierItem.OriginalData.SupplierInfo.SupplierKey != supplierItem.SupplierInfo.SupplierKey); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { PurchaseOrder entity = key.GetEntity() as PurchaseOrder; if (entity != null ) { DateTime docDate = entity.BusinessDate; string oldSuptCode = string.Empty; string newSuptCode = string.Empty; if (entity.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && entity.OriginalData != null && entity.OriginalData.Supplier != null ) { oldSuptCode = entity.OriginalData.Supplier.Code; } if (entity.Supplier != null) { newSuptCode = entity.Supplier.Code; } foreach (POLine docline in entity.POLines) { string oldItemCode = string.Empty; string newItemCode = string.Empty; if (docline.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && docline.OriginalData != null && docline.OriginalData.ItemInfo != null ) { oldItemCode = docline.OriginalData.ItemInfo.ItemCode; } if (docline.ItemInfo != null) { newItemCode = docline.ItemInfo.ItemCode; } if (newSuptCode.IsNotNullOrWhiteSpace() && newItemCode.IsNotNullOrWhiteSpace() // 新旧不一致,才重取 && (oldSuptCode != newSuptCode || oldItemCode != newItemCode ) ) { SupplySource suptSource = GetSupplySource(docDate, newSuptCode, newItemCode); if (suptSource != null) { /* * 货源表 1 * * 标准采购:9 * 标准收货:2 * 到货:2 * 质检单:6 */ docline.DescFlexSegments.PrivateDescSeg9 = suptSource.DescFlexField.PrivateDescSeg1; } } } } } } }
public static SalePriceLine GetSalePriceList(SupplySource supplierItem) { string opath = string.Format("SalePriceList.Org.Code={0} and ItemInfo.ItemCode='{1}' and Active=1 and '{2}' between FromDate and ToDate " //, Context.LoginOrg.ID.ToString() , GetPartPriceListOrgCode() , supplierItem.ItemInfo.ItemCode , System.DateTime.Now.ToString()); //if (Context.LoginOrg.Code == Const_OrgCode_Electric) //{ // opath += string.Format(" and SalePriceList.Code='{0}'", Const_ElectricPartPriceListCode); //} //else if (Context.LoginOrg.Code == Const_OrgCode_Hubei) //{ // //opath += string.Format(" and SalePriceList.Code={0}", Const_SalePartPriceListCode); //} string pricelistCode = GetPartPriceListCode(); if (pricelistCode.IsNotNullOrWhiteSpace()) { opath += string.Format(" and SalePriceList.Code='{0}'", pricelistCode); } return SalePriceLine.Finder.Find(opath); }