コード例 #1
0
        //同步送货单
        public void SyncSHD(int SOSysNo)
        {
            var soItem = ExternalDomainBroker.GetSOItemList(SOSysNo);

            soItem = soItem.Where(p => p.InventoryType == ProductInventoryType.Company || p.InventoryType == ProductInventoryType.TwoDoor).ToList();
            //同步送货单

            //foreach (var item in soItem)
            //{
            //    ERPSHDInfo erpinfo = new ERPSHDInfo();
            //    erpinfo.SHDTypeMemo = "送货单";
            //    erpinfo.RefOrderNo = SOSysNo.ToString();
            //    erpinfo.RefOrderType = "销售订单";
            //    erpinfo.SysMemo = erpinfo.RefOrderNo + "/" + erpinfo.RefOrderType;
            //    erpinfo.ZDR = ServiceContext.Current.UserSysNo;
            //    erpinfo.ZDSJ = DateTime.Now;
            //    erpinfo.ZXR = ServiceContext.Current.UserSysNo;
            //    erpinfo.ZXSJ = DateTime.Now;
            //    erpinfo.SHDItemList = new List<ERPSHDItem>();
            //    ERPSHDItem erpitem = new ERPSHDItem();
            //    erpitem.ProductSysNo = item.ProductSysNo;
            //    erpitem.SL = item.Quantity;
            //    erpinfo.SHDItemList.Add(erpitem);
            //    ObjectFactory<ISyncERPBizRecord>.Instance.CreateSHD(erpinfo);
            //}

            var Inventory = soItem.Where(p => p.InventoryType == ProductInventoryType.Company || p.InventoryType == ProductInventoryType.TwoDoor);

            if (Inventory.Count() > 0)
            {
                ERPInventoryAdjustInfo erpAdjustInfo = new ERPInventoryAdjustInfo
                {
                    OrderSysNo     = SOSysNo,
                    OrderType      = "SO",
                    AdjustItemList = new List <ERPItemInventoryInfo>(),
                    Memo           = "在线订单支付确认"
                };
                foreach (var item in Inventory)
                {
                    ERPItemInventoryInfo adjustItem = new ERPItemInventoryInfo
                    {
                        ProductSysNo = item.ProductSysNo,
                        HQQuantity   = -item.Quantity.Value
                    };

                    erpAdjustInfo.AdjustItemList.Add(adjustItem);
                }
                if (erpAdjustInfo.AdjustItemList.Count > 0)
                {
                    string adjustXml = ECCentral.Service.Utility.SerializationUtility.ToXmlString(erpAdjustInfo);
                    ObjectFactory <ICommonBizInteract> .Instance.CreateOperationLog(string.Format("支付确认扣除ERP【总部家电/双开门】库存:{0}", adjustXml)
                                                                                    , BizLogType.Finance_NetPay_Verify
                                                                                    , SOSysNo
                                                                                    , "8601");

                    //ObjectFactory<IAdjustERPInventory>.Instance.AdjustERPInventory(erpAdjustInfo);
                }
            }
        }