예제 #1
0
        protected override void CreateOrUpdateObject(object obj)
        {
            IList <object> list        = (IList <object>)obj;
            Supplier       supplier    = (Supplier)list[0];
            ShipAddress    shipAddress = (ShipAddress)list[1];
            BillAddress    billAddress = (BillAddress)list[2];

            Supplier oldSupplier = supplierMgr.LoadSupplier(supplier.Code);

            if (oldSupplier == null)
            {
                supplier.IsActive = true;
                this.supplierMgr.CreateSupplier(supplier);
            }
            else
            {
                CloneHelper.CopyProperty(supplier, oldSupplier, this.Supplier2SupplierFields);
                this.supplierMgr.UpdateSupplier(oldSupplier);
            }


            BillAddress newBillAddress = this.billAddressMgr.LoadBillAddress(billAddress.Code);

            if (newBillAddress == null)
            {
                billAddress.IsActive = true;
                this.billAddressMgr.CreateBillAddress(billAddress);
            }
            else
            {
                CloneHelper.CopyProperty(billAddress, newBillAddress, this.BillAddress2BillAddressFields);
                this.billAddressMgr.UpdateBillAddress(newBillAddress);
            }

            ShipAddress newShipAddress = this.shipAddressMgr.LoadShipAddress(shipAddress.Code);

            if (newShipAddress == null)
            {
                shipAddress.IsActive = true;
                this.shipAddressMgr.CreateShipAddress(shipAddress);
            }
            else
            {
                CloneHelper.CopyProperty(shipAddress, newShipAddress, this.ShipAddress2ShipAddressFields);
                this.shipAddressMgr.UpdateShipAddress(newShipAddress);
            }
        }
예제 #2
0
        private object Deserialize(DssImportHistory dssImportHistory, bool isUpdate)
        {
            PriceListDetail priceListDetail = new PriceListDetail();

            PriceList priceList = priceListMgr.LoadPriceList(dssImportHistory[1].Trim());

            if (priceList != null)
            {
                priceListDetail.PriceList = priceList;
            }
            else
            {
                Party    party    = partyMgr.CheckAndLoadParty(dssImportHistory[1].Trim());
                Supplier supplier = supplierMgr.LoadSupplier(dssImportHistory[1].Trim());
                if (supplier != null)
                {
                    priceListDetail.PriceList = this.LoadPurchasePriceList(dssImportHistory[1], party);//采购价格单
                }
                else
                {
                    priceListDetail.PriceList = this.LoadSalesPriceList(dssImportHistory[1], party);//销售价格单
                }
            }

            priceListDetail.Currency  = this.currencyMgr.CheckAndLoadCurrency(dssImportHistory[2]);                                                               //货币
            priceListDetail.Item      = this.itemMgr.CheckAndLoadItem(dssImportHistory[3]);                                                                       //零件号
            priceListDetail.Uom       = this.uomMgr.CheckAndLoadUom(dssImportHistory[4]);                                                                         //单位
            priceListDetail.StartDate = dssImportHistory[6] != null?DssHelper.GetDate(dssImportHistory[6], BusinessConstants.DSS_SYSTEM_CODE_QAD) : DateTime.Now; //开始日期

            if (isUpdate)
            {
                priceListDetail.UnitPrice = decimal.Parse(dssImportHistory[5]);//单价
                if (dssImportHistory[7] != null)
                {
                    priceListDetail.EndDate = DssHelper.GetDate(dssImportHistory[7], BusinessConstants.DSS_SYSTEM_CODE_QAD);                             //结束日期
                }
            }

            #region 默认值
            priceListDetail.TaxCode               = string.Empty;//todo
            priceListDetail.IsIncludeTax          = false;
            priceListDetail.IsProvisionalEstimate = this.CheckProvisionalEstimate(priceListDetail.UnitPrice);
            #endregion

            return(priceListDetail);
        }