private object Deserialize(DssImportHistory dssImportHistory, bool isUpdate)
        {
            PriceListDetail priceListDetail = new PriceListDetail();
            Party party = partyMgrE.CheckAndLoadParty(dssImportHistory[1]);
            if (party.Type.Equals(BusinessConstants.PARTY_TYPE_CUSTOMER))
            {
                priceListDetail.PriceList = this.LoadSalesPriceList(dssImportHistory[1], party);//销售价格单
            }
            else
            {
                priceListDetail.PriceList = this.LoadPurchasePriceList(dssImportHistory[1], party);//采购价格单
            }
            priceListDetail.Currency = this.currencyMgrE.CheckAndLoadCurrency(dssImportHistory[2]);//货币
            priceListDetail.Item = this.itemMgrE.CheckAndLoadItem(dssImportHistory[3]);//零件号
            priceListDetail.Uom = this.uomMgrE.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 = entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_TAX_RATE).Value;
            priceListDetail.IsIncludeTax = false;
            priceListDetail.IsProvisionalEstimate = this.CheckProvisionalEstimate(priceListDetail.UnitPrice);
            #endregion

            return priceListDetail;
        }
Example #2
0
    protected void ODS_PriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string priceListCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"))).Text.Trim();
        string itemCode      = ((TextBox)(this.FV_PriceListDetail.FindControl("tbItem"))).Text.Trim();
        string currencyCode  = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"))).Text.Trim();
        string uomCode       = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"))).Text.Trim();
        string startDate     = ((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim();
        string endDate       = ((TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"))).Text.Trim();

        priceListdetail = (PriceListDetail)e.InputParameters[0];
        if (priceListdetail != null)
        {
            priceListdetail.PriceList = ThePriceListMgr.LoadPriceList(priceListCode);
            item = TheItemMgr.LoadItem(itemCode);
            priceListdetail.Item     = item;
            priceListdetail.Currency = TheCurrencyMgr.LoadCurrency(currencyCode);

            //default uom
            if (uomCode == "")
            {
                priceListdetail.Uom = item.Uom;
            }
            else
            {
                priceListdetail.Uom = TheUomMgr.LoadUom(uomCode);
            }
        }
    }
Example #3
0
    private void UpdateView()
    {
        priceListdetail = ThePriceListDetailMgr.LoadPriceListDetail(Convert.ToInt32(this.code));
        TextBox          tbCode         = (TextBox)(this.FV_PriceListDetail.FindControl("tbCode"));
        TextBox          tbPriceList    = (TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"));
        TextBox          tbStartDate    = (TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"));
        TextBox          tbEndDate      = (TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"));
        TextBox          tbItem         = (TextBox)(this.FV_PriceListDetail.FindControl("tbItem"));
        Controls_TextBox tbCurrency     = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"));
        TextBox          tbUnitPrice    = (TextBox)(this.FV_PriceListDetail.FindControl("tbUnitPrice"));
        Controls_TextBox tbUom          = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"));
        TextBox          tbTaxCode      = (TextBox)(this.FV_PriceListDetail.FindControl("tbTaxCode"));
        CheckBox         cbIsIncludeTax = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsIncludeTax"));

        // CheckBox cbIsProvEst = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsProvEst"));

        if (priceListdetail != null)
        {
            tbCode.Text      = priceListdetail.Id.ToString();
            tbPriceList.Text = priceListdetail.PriceList.Code;
            tbStartDate.Text = priceListdetail.StartDate.ToString("yyyy-MM-dd");
            if (priceListdetail.EndDate != null)
            {
                tbEndDate.Text = ((DateTime)priceListdetail.EndDate).ToString("yyyy-MM-dd");
            }
            tbItem.Text            = priceListdetail.Item.Code;
            tbCurrency.Text        = priceListdetail.Currency.Code;
            tbUnitPrice.Text       = priceListdetail.UnitPrice.ToString("0.########");
            tbUom.Text             = priceListdetail.Uom.Code;
            tbTaxCode.Text         = priceListdetail.TaxCode;
            cbIsIncludeTax.Checked = priceListdetail.IsIncludeTax;
            //  cbIsProvEst.Checked = priceListdetail.IsProvisionalEstimate;
        }
    }
        public ActionResult DeleteConfirmed(int id)
        {
            PriceListDetail priceListDetail = db.PriceListDetails.Find(id);

            db.PriceListDetails.Remove(priceListDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PositionID,PriceListID,ProductID,UnitPrice,Status")] PriceListDetail priceListDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(priceListDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PriceListID = new SelectList(db.PriceListMasters, "PriceListID", "PriceListName", priceListDetail.PriceListID);
     ViewBag.ProductID   = new SelectList(db.Products, "ProductID", "ProductReference", priceListDetail.ProductID);
     return(View(priceListDetail));
 }
Example #6
0
        public void RecalculatePrice(IList <ActingBill> actingBillList, User user, DateTime?efftiveDate)
        {
            if (actingBillList != null && actingBillList.Count > 0)
            {
                DateTime dateTimeNow = DateTime.Now;

                //if (!efftiveDate.HasValue)
                //{
                //    #region 查找结算日期
                //    //DetachedCriteria criteria = DetachedCriteria.For<BillTransaction>();
                //    //criteria.Add(Expression.Eq("ActingBill", actingBill.Id));

                //    //IList<BillTransaction> billTransactionList = billTransactionMgrE.GetAllBillTransaction();
                //    //if (billTransactionList != null && billTransactionList.Count > 0)
                //    //{
                //    //    efftiveDate = billTransactionList[0].EffectiveDate;
                //    //}
                //    //else
                //    //{
                //        //没有找到结算事务,用当前时间去找价格
                //        //efftiveDate = DateTime.Now;
                //    //}
                //    #endregion
                //}

                foreach (ActingBill actingBill in actingBillList)
                {
                    PriceListDetail priceListDetail = null;
                    if (efftiveDate.HasValue)
                    {
                        priceListDetail = this.priceListDetailMgr.GetLastestPriceListDetail(actingBill.PriceList, actingBill.Item, efftiveDate.Value, actingBill.Currency, actingBill.Uom);
                    }
                    else
                    {
                        priceListDetail = this.priceListDetailMgr.GetLastestPriceListDetail(actingBill.PriceList, actingBill.Item, actingBill.EffectiveDate, actingBill.Currency, actingBill.Uom);
                    }

                    if (priceListDetail != null)
                    {
                        actingBill.UnitPrice             = priceListDetail.UnitPrice;
                        actingBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate;
                        actingBill.LastModifyDate        = dateTimeNow;
                        actingBill.LastModifyUser        = user;
                        //不计折扣
                        actingBill.BillAmount = actingBill.UnitPrice * actingBill.BillQty;
                        this.UpdateActingBill(actingBill);
                    }
                }
            }
        }
Example #7
0
    public decimal GetUnitPriceByUom(string priceListCode, string itemCode, DateTime startTime, string currencyCode, string uomCode)
    {
        decimal unitPrice = 0;

        if (priceListCode != string.Empty)
        {
            PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(priceListCode, itemCode, startTime, currencyCode, uomCode);
            if (priceListDetail != null)
            {
                unitPrice = priceListDetail.UnitPrice;
            }
        }
        return(unitPrice);
    }
        // GET: PriceListDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PriceListDetail priceListDetail = db.PriceListDetails.Find(id);

            if (priceListDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(priceListDetail));
        }
Example #9
0
        protected override void DeleteObject(object obj)
        {
            PriceListDetail priceListDetail = (PriceListDetail)obj;

            PriceListDetail newPriceListDetail =
                this.priceListDetailMgr.GetLastestPriceListDetail(priceListDetail.PriceList.Code, priceListDetail.Item.Code, priceListDetail.StartDate,
                                                                  priceListDetail.Currency.Code);

            if (newPriceListDetail != null)
            {
                newPriceListDetail.EndDate = DateTime.Today.AddDays(-1);
                this.priceListDetailMgr.UpdatePriceListDetail(newPriceListDetail);
            }
        }
        // GET: PriceListDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PriceListDetail priceListDetail = db.PriceListDetails.Find(id);

            if (priceListDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PriceListID = new SelectList(db.PriceListMasters, "PriceListID", "PriceListName", priceListDetail.PriceListID);
            ViewBag.ProductID   = new SelectList(db.Products, "ProductID", "ProductReference", priceListDetail.ProductID);
            return(View(priceListDetail));
        }
Example #11
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);
        }
Example #12
0
        protected override void CreateOrUpdateObject(object obj)
        {
            PriceListDetail priceListDetail = (PriceListDetail)obj;

            priceListDetail.IsProvisionalEstimate = CheckProvisionalEstimate(priceListDetail.UnitPrice);


            PriceListDetail newPriceListDetail =
                this.priceListDetailMgr.LoadPriceListDetail(priceListDetail.PriceList.Code, priceListDetail.Currency.Code,
                                                            priceListDetail.Item.Code, priceListDetail.Uom.Code, priceListDetail.StartDate);

            if (newPriceListDetail == null)
            {
                this.priceListDetailMgr.CreatePriceListDetail(priceListDetail);
            }
            else
            {
                CloneHelper.CopyProperty(priceListDetail, newPriceListDetail, this.fields);
                this.priceListDetailMgr.UpdatePriceListDetail(newPriceListDetail);
            }
        }
Example #13
0
        public void RecalculatePrice(string billNo, User user)
        {
            Bill billMstr = this.LoadBill(billNo, true);
            IList <BillDetail> provEstBillDetList = billMstr.BillDetails.Where(p => p.IsProvEst).ToList();

            if (provEstBillDetList != null && provEstBillDetList.Count > 0)
            {
                foreach (BillDetail billDet in provEstBillDetList)
                {
                    PriceListDetail priceListDetail = null;

                    priceListDetail = this.priceListDetailMgr.GetLastestPriceListDetail(billDet.ActingBill.PriceList, billDet.ActingBill.Item, billDet.ActingBill.EffectiveDate, billDet.ActingBill.Currency, billDet.ActingBill.Uom);


                    if (priceListDetail != null)
                    {
                        billDet.UnitPrice = priceListDetail.UnitPrice;
                        billDet.IsProvEst = priceListDetail.IsProvisionalEstimate;
                        // billDet.last = dateTimeNow;
                        // billDet.la.LastModifyUser = user;
                        //是不是还要更新actbill
                        // billDet.OrderAmount = billDet.UnitPrice * billDet.BilledQty;
                        billDetailMgr.UpdateBillDetail(billDet);
                    }
                }

                #region 更新头上暂估标记
                var provEstCount = provEstBillDetList.Where(p => p.IsProvEst).Count();
                if (provEstCount == 0)
                {
                    billMstr.HasProvEst     = false;
                    billMstr.LastModifyDate = DateTime.Now;
                    billMstr.LastModifyUser = user;
                    this.UpdateBill(billMstr);
                }
                #endregion
            }
        }
Example #14
0
    public override void UpdateView()
    {
        List <PriceListDetail> priceListDetailList = new List <PriceListDetail>();
        PriceList priceList = null;
        Flow      flow      = TheFlowMgr.LoadFlow(this.FlowCode, true);

        if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_PO)
        {
            priceList = flow.PriceListFrom;
        }
        else if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_SO)
        {
            priceList = flow.PriceListTo;
        }
        if (priceList != null)
        {
            if (flow.FlowDetails != null && flow.FlowDetails.Count > 0)
            {
                foreach (FlowDetail flowDetail in flow.FlowDetails)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(priceList, flowDetail.Item, DateTime.Now, flow.Currency);
                    if (priceListDetail != null)
                    {
                        priceListDetailList.Add(priceListDetail);
                    }
                }
            }
        }
        if (priceListDetailList.Count > 0)
        {
            this.GV_List.DataSource = priceListDetailList;
            this.GV_List.DataBind();
        }
        else
        {
            this.Parent.Visible = false;
        }
    }
Example #15
0
    public FlowDetailProxy GenerateFlowDetailProxy(string flowCode, string itemCode, string moduleType, string partyFromCode, string partyToCode, bool changeRef, DateTime startTime)
    {
        IList <FlowDetail> flowDetailList = TheFlowDetailMgr.GetFlowDetail(flowCode, true);

        if (flowDetailList != null && flowDetailList.Count > 0)
        {
            foreach (FlowDetail fd in flowDetailList)
            {
                if (fd.Item.Code == itemCode)
                {
                    FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
                    flowDetailProxy.ItemCode        = fd.Item.Code;
                    flowDetailProxy.ItemDescription = fd.Item.Description;
                    if (changeRef)
                    {
                        flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                    }
                    flowDetailProxy.UomCode   = fd.Uom.Code;
                    flowDetailProxy.UnitCount = fd.UnitCount;
                    flowDetailProxy.HuLotSize = fd.HuLotSize == null?Convert.ToInt32(fd.UnitCount) : fd.HuLotSize;

                    if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                    {
                        if (fd.DefaultPriceListFrom != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListFrom.Code;
                            PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListFrom, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailFrom != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                            }
                        }
                    }
                    else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                    {
                        if (fd.DefaultPriceListTo != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListTo.Code;
                            PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListTo, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailTo != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                            }
                        }
                        flowDetailProxy.PackageVolumn = fd.PackageVolumn;
                    }

                    if (changeRef)
                    {
                        if (fd.ReferenceItemCode != null && fd.ReferenceItemCode != string.Empty)
                        {
                            flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                        }
                        else
                        {
                            flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
                        }
                    }
                    return(flowDetailProxy);
                }
            }
        }

        Item item = TheItemMgr.LoadItem(itemCode);

        if (item != null)
        {
            Flow            flow            = TheFlowMgr.LoadFlow(flowCode);
            FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
            flowDetailProxy.ItemCode        = item.Code;
            flowDetailProxy.ItemDescription = item.Description;
            flowDetailProxy.UomCode         = item.Uom.Code;

            if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
            {
                if (flow.PriceListFrom != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListFrom.Code;
                    PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListFrom, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailFrom != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                    }
                }
            }
            else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                if (flow.PriceListTo != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListTo.Code;
                    PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListTo, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailTo != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                    }
                }
            }

            if (changeRef)
            {
                flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
            }
            flowDetailProxy.UnitCount = item.UnitCount;
            flowDetailProxy.HuLotSize = Convert.ToInt32(item.UnitCount);
            return(flowDetailProxy);
        }

        return(null);
    }
Example #16
0
 public virtual void DeletePriceListDetail(PriceListDetail entity)
 {
     Delete(entity);
 }
Example #17
0
 public virtual void CreatePriceListDetail(PriceListDetail entity)
 {
     Create(entity);
 }
 public virtual void UpdatePriceListDetail(PriceListDetail entity)
 {
     Update(entity);
 }
Example #19
0
 public void CreatePriceListDetail(PriceListDetail priceListDetail)
 {
     PriceListDetailMgr.CreatePriceListDetail(priceListDetail);
 }
Example #20
0
 public void DeletePriceListDetail(PriceListDetail priceListDetail)
 {
     PriceListDetailMgr.DeletePriceListDetail(priceListDetail);
 }
Example #21
0
        public IList <OrderDetail> GenerateOrderDetail(OrderHead orderHead, FlowDetail flowDetail, bool isReferencedFlow)
        {
            EntityPreference entityPreference = this.entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL);
            int seqInterval = int.Parse(entityPreference.Value);

            IList <OrderDetail> orderDetailList = new List <OrderDetail>();
            OrderDetail         orderDetail     = new OrderDetail();

            orderDetail.FlowDetail = flowDetail;
            orderDetail.OrderHead  = orderHead;
            if (!isReferencedFlow)
            {
                CloneHelper.CopyProperty(flowDetail, orderDetail, FlowDetail2OrderDetailCloneFields);
            }
            else
            {
                CloneHelper.CopyProperty(flowDetail, orderDetail, ReferenceOrderDetailCloneFields);
            }

            #region 查找价格
            if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT || orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                if (orderDetail.DefaultPriceListFrom != null)
                {
                    PriceListDetail priceListDetailFrom = priceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListFrom, orderDetail.Item, orderHead.StartTime, orderHead.Currency, orderDetail.Uom);
                    if (priceListDetailFrom != null)
                    {
                        orderDetail.PriceListDetailFrom = priceListDetailFrom;
                    }
                }
                if (orderDetail.DefaultPriceListTo != null)
                {
                    PriceListDetail priceListDetailTo = priceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListTo, orderDetail.Item, orderHead.StartTime, orderHead.Currency, orderDetail.Uom);
                    if (priceListDetailTo != null)
                    {
                        orderDetail.PriceListDetailTo = priceListDetailTo;
                    }
                }
            }
            #endregion

            #region 设置退货和次品库位
            //if (orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN
            //    || orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RWO)
            //{
            //    if (flowDetail.LocationFrom != null && flowDetail.LocationFrom.ActingLocation != null)
            //    {
            //        orderDetail.LocationFrom = flowDetail.LocationFrom.ActingLocation;
            //    }

            //    if (flowDetail.LocationTo != null && flowDetail.LocationTo.ActingLocation != null)
            //    {
            //        orderDetail.LocationTo = flowDetail.LocationTo.ActingLocation;
            //    }
            //}
            if (orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RWO)
            {
                orderDetail.LocationTo = this.locationMgr.GetRejectLocation();
            }
            #endregion

            //if (orderDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K)
            //{
            //    #region 处理套件
            //    IList<ItemKit> itemKitList = this.itemKitMgr.GetChildItemKit(orderDetail.Item.Code);

            //    if (itemKitList != null && itemKitList.Count > 0)
            //    {
            //        int count = 0;
            //        decimal? convertRate = null;
            //        foreach (ItemKit itemKit in itemKitList)
            //        {
            //            count++;

            //            if (!convertRate.HasValue)
            //            {
            //                if (itemKit.ParentItem.Uom.Code != orderDetail.Uom.Code)
            //                {
            //                    convertRate = this.uomConversionMgr.ConvertUomQty(orderDetail.Item, orderDetail.Uom, 1, itemKit.ParentItem.Uom);
            //                }
            //                else
            //                {
            //                    convertRate = 1;
            //                }
            //            }

            //            OrderDetail orderDetailOfChildKit = new OrderDetail();
            //            CloneHelper.CopyProperty(orderDetail, orderDetailOfChildKit, OrderDetailOfChildKitCloneFields);
            //            orderDetailOfChildKit.Sequence = orderDetailOfChildKit.Sequence + count;
            //            orderDetailOfChildKit.Item = itemKit.ChildItem;
            //            orderDetailOfChildKit.ReferenceItemCode = this.itemReferenceMgr.GetItemReferenceByItem(itemKit.ChildItem.Code, orderDetail.OrderHead.PartyFrom.Code, orderDetail.OrderHead.PartyTo.Code);
            //            orderDetailOfChildKit.Uom = itemKit.ChildItem.Uom;
            //            orderDetailOfChildKit.UnitCount = itemKit.ChildItem.UnitCount;
            //            //orderDetailOfChildKit.RequiredQty = orderDetailOfChildKit.RequiredQty * itemKit.Qty * convertRate;
            //            //orderDetailOfChildKit.OrderedQty = orderDetailOfChildKit.OrderedQty * itemKit.Qty * convertRate;
            //            orderDetailOfChildKit.GoodsReceiptLotSize = orderDetailOfChildKit.GoodsReceiptLotSize * itemKit.Qty * convertRate;
            //            orderDetailOfChildKit.BatchSize = orderDetailOfChildKit.BatchSize * itemKit.Qty * convertRate;
            //            if (orderDetailOfChildKit.HuLotSize.HasValue)
            //            {
            //                orderDetailOfChildKit.HuLotSize = int.Parse((orderDetailOfChildKit.HuLotSize.Value * itemKit.Qty * convertRate.Value).ToString("#"));
            //            }

            //            #region 计算价格
            //            if (orderDetailOfChildKit.DefaultPriceListFrom != null)
            //            {
            //                PriceListDetail priceListDetailFrom = priceListDetailMgr.GetLastestPriceListDetail(orderDetailOfChildKit.DefaultPriceListFrom, orderDetailOfChildKit.Item, orderHead.StartTime, orderHead.Currency, orderDetailOfChildKit.Uom);
            //                if (priceListDetailFrom != null)
            //                {
            //                    orderDetailOfChildKit.PriceListDetailFrom = priceListDetailFrom;
            //                }
            //            }
            //            if (orderDetailOfChildKit.DefaultPriceListTo != null)
            //            {
            //                PriceListDetail priceListDetailTo = priceListDetailMgr.GetLastestPriceListDetail(orderDetailOfChildKit.DefaultPriceListTo, orderDetailOfChildKit.Item, orderHead.StartTime, orderHead.Currency, orderDetailOfChildKit.Uom);
            //                if (priceListDetailTo != null)
            //                {
            //                    orderDetailOfChildKit.PriceListDetailTo = priceListDetailTo;
            //                }
            //            }
            //            #endregion

            //            //重新设置Sequence
            //            int detailCount = orderHead.OrderDetails != null ? orderHead.OrderDetails.Count : 0;
            //            orderDetail.Sequence = (detailCount + 1) * seqInterval;

            //            orderHead.AddOrderDetail(orderDetailOfChildKit);
            //            orderDetailList.Add(orderDetailOfChildKit);
            //        }
            //    }
            //    else
            //    {
            //        throw new BusinessErrorException("ItemKit.Error.NotFoundForParentItem", orderDetail.Item.Code);
            //    }
            //    #endregion
            //}
            //else
            //{
            //重新设置Sequence
            int detailCount = orderHead.OrderDetails != null ? orderHead.OrderDetails.Count : 0;
            orderDetail.Sequence = (detailCount + 1) * seqInterval;

            #region 参考零件号
            if (orderDetail.ReferenceItemCode == null || orderDetail.ReferenceItemCode == string.Empty)
            {
                string firstPartyCode  = string.Empty;
                string secondPartyCode = string.Empty;
                if (orderHead.Type == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION)
                {
                    firstPartyCode = orderHead.PartyTo.Code;
                }
                else
                {
                    firstPartyCode = orderHead.PartyFrom.Code;
                }
                orderDetail.ReferenceItemCode = itemReferenceMgr.GetItemReferenceByItem(orderDetail.Item.Code, firstPartyCode, secondPartyCode);
            }
            #endregion

            #region 设置默认库位
            orderDetail.LocationFrom = orderDetail.LocationFrom == null ? orderHead.LocationFrom : orderDetail.LocationFrom;
            orderDetail.LocationTo   = orderDetail.LocationTo == null ? orderHead.LocationTo : orderDetail.LocationTo;
            #endregion

            orderHead.AddOrderDetail(orderDetail);
            orderDetailList.Add(orderDetail);
            //}

            return(orderDetailList);
        }
 public virtual void CreatePriceListDetail(PriceListDetail entity)
 {
     Create(entity);
 }
Example #23
0
 public virtual void DeletePriceListDetail(PriceListDetail entity)
 {
     entityDao.DeletePriceListDetail(entity);
 }
 public virtual void DeletePriceListDetail(PriceListDetail entity)
 {
     Delete(entity);
 }
Example #25
0
 public virtual void UpdatePriceListDetail(PriceListDetail entity)
 {
     entityDao.UpdatePriceListDetail(entity);
 }
Example #26
0
 public virtual void UpdatePriceListDetail(PriceListDetail entity)
 {
     Update(entity);
 }
Example #27
0
    private void UpdateView()
    {
        priceListdetail = ThePriceListDetailMgr.LoadPriceListDetail(Convert.ToInt32(this.code));
        TextBox tbCode = (TextBox)(this.FV_PriceListDetail.FindControl("tbCode"));
        TextBox tbPriceList = (TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"));
        TextBox tbStartDate = (TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"));
        TextBox tbEndDate = (TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"));
        TextBox tbItem = (TextBox)(this.FV_PriceListDetail.FindControl("tbItem"));
        Controls_TextBox tbCurrency = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"));
        TextBox tbUnitPrice = (TextBox)(this.FV_PriceListDetail.FindControl("tbUnitPrice"));
        Controls_TextBox tbUom = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"));
        TextBox tbTaxCode = (TextBox)(this.FV_PriceListDetail.FindControl("tbTaxCode"));
        CheckBox cbIsIncludeTax = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsIncludeTax"));
           // CheckBox cbIsProvEst = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsProvEst"));

        if (priceListdetail != null)
        {
            tbCode.Text = priceListdetail.Id.ToString();
            tbPriceList.Text = priceListdetail.PriceList.Code;
            tbStartDate.Text = priceListdetail.StartDate.ToString("yyyy-MM-dd");
            if (priceListdetail.EndDate != null)
            {
                tbEndDate.Text = ((DateTime)priceListdetail.EndDate).ToString("yyyy-MM-dd");
            }
            tbItem.Text = priceListdetail.Item.Code;
            tbCurrency.Text = priceListdetail.Currency.Code;
            tbUnitPrice.Text = priceListdetail.UnitPrice.ToString("0.########");
            tbUom.Text = priceListdetail.Uom.Code;
            tbTaxCode.Text = priceListdetail.TaxCode;
            cbIsIncludeTax.Checked = priceListdetail.IsIncludeTax;
          //  cbIsProvEst.Checked = priceListdetail.IsProvisionalEstimate;
        }
    }
Example #28
0
        public async Task <int> CreatePriceDetail(PriceListDetail priceListDetails)
        {
            var result = await this.httpService.Post <PriceListDetail>("/priceListDetails", priceListDetails);

            return(result.Id);
        }
Example #29
0
 public virtual void CreatePriceListDetail(PriceListDetail entity)
 {
     entityDao.CreatePriceListDetail(entity);
 }
 public virtual void CreatePriceListDetail(PriceListDetail entity)
 {
     entityDao.CreatePriceListDetail(entity);
 }
Example #31
0
 public void UpdatePriceListDetail(PriceListDetail priceListDetail)
 {
     PriceListDetailMgr.UpdatePriceListDetail(priceListDetail);
 }
Example #32
0
    protected void ODS_PriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string priceListCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"))).Text.Trim();
        string itemCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbItem"))).Text.Trim();
        string currencyCode = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"))).Text.Trim();
        string uomCode = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"))).Text.Trim();
        string startDate = ((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim();
        string endDate = ((TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"))).Text.Trim();

        priceListdetail = (PriceListDetail)e.InputParameters[0];
        if (priceListdetail != null)
        {
            priceListdetail.PriceList = ThePriceListMgr.LoadPriceList(priceListCode);
            item = TheItemMgr.LoadItem(itemCode);
            priceListdetail.Item = item;
            priceListdetail.Currency = TheCurrencyMgr.LoadCurrency(currencyCode);

            //default uom
            if (uomCode == "")
            {
                priceListdetail.Uom = item.Uom;
            }
            else
            {
                priceListdetail.Uom = TheUomMgr.LoadUom(uomCode);
            }
        }
    }
 public virtual void DeletePriceListDetail(PriceListDetail entity)
 {
     entityDao.DeletePriceListDetail(entity);
 }
Example #34
0
    public string AdjustInProcessLocationTo()
    {
        try
        {
            InProcessLocation ip      = TheInProcessLocationMgr.LoadInProcessLocation(this.IpNo, true);
            Receipt           receipt = new Receipt();
            InProcessLocation nmlIp   = CloneHelper.DeepClone(ip);
            IList <InProcessLocationDetail> nmlReceiptDetailList = new List <InProcessLocationDetail>();
            foreach (InProcessLocationDetail ipdet in ip.InProcessLocationDetails)
            {
                #region 对应的ipdet
                InProcessLocationDetail nmlInProcessLocationDetail = new InProcessLocationDetail();
                nmlInProcessLocationDetail.Qty = 0 - ipdet.Qty;
                nmlInProcessLocationDetail.OrderLocationTransaction = TheOrderLocationTransactionMgr.GetOrderLocationTransaction(ipdet.OrderLocationTransaction.OrderDetail, BusinessConstants.IO_TYPE_IN)[0];
                nmlInProcessLocationDetail.IsConsignment            = ipdet.IsConsignment;
                nmlInProcessLocationDetail.PlannedBill = ipdet.PlannedBill;
                nmlReceiptDetailList.Add(nmlInProcessLocationDetail);
                #endregion

                #region 收货单明细
                ReceiptDetail receiptDetail = new ReceiptDetail();
                receiptDetail.Receipt     = receipt;
                receiptDetail.ReceivedQty = nmlInProcessLocationDetail.Qty;
                receiptDetail.ShippedQty  = nmlInProcessLocationDetail.Qty;
                receiptDetail.OrderLocationTransaction = nmlInProcessLocationDetail.OrderLocationTransaction;
                receiptDetail.IsConsignment            = ipdet.IsConsignment;
                nmlInProcessLocationDetail.PlannedBill = ipdet.PlannedBill;

                OrderDetail orderDetail = receiptDetail.OrderLocationTransaction.OrderDetail;

                OrderHead orderHead = orderDetail.OrderHead;

                if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListFrom, orderDetail.Item, DateTime.Now, orderDetail.OrderHead.Currency);
                    if (priceListDetail == null)
                    {
                        throw new BusinessErrorException("Order.Error.NoPriceListReceipt", new string[] { orderDetail.Item.Code });
                    }
                    receiptDetail.PlannedAmount = priceListDetail.UnitPrice * (decimal)receiptDetail.ReceivedQty;
                }
                else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListTo, orderDetail.Item, DateTime.Now, orderDetail.OrderHead.Currency);
                    if (priceListDetail == null)
                    {
                        throw new BusinessErrorException("Order.Error.NoPriceListReceipt", new string[] { orderDetail.Item.Code });
                    }
                    receiptDetail.PlannedAmount = priceListDetail.UnitPrice * (decimal)receiptDetail.ReceivedQty;
                }

                receipt.AddReceiptDetail(receiptDetail);
                #endregion
            }


            nmlIp.InProcessLocationDetails = nmlReceiptDetailList;
            if (receipt.InProcessLocations == null)
            {
                receipt.InProcessLocations = new List <InProcessLocation>();
            }
            receipt.InProcessLocations.Add(nmlIp);

            TheReceiptMgr.CreateReceipt(receipt, this.CurrentUser);
            return(receipt.ReceiptNo);
        }
        catch (BusinessErrorException ex)
        {
            throw (ex);
        }
    }
 public virtual void UpdatePriceListDetail(PriceListDetail entity)
 {
     entityDao.UpdatePriceListDetail(entity);
 }
Example #36
0
        public async Task <int> UpdatePriceDetail(PriceListDetail priceListDetails)
        {
            var result = await this.httpService.Put <PriceListDetail>($"/priceListDetails/{priceListDetails.Id}", priceListDetails);

            return(result.Id);
        }
        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;
        }