public void Update(ISellIn sellIn)
        {
            if (sellIn.IsPassed())
            {
                Value = 0;
                return;
            }

            var valueIncrement = GetValueIncrement(sellIn);

            Value = Math.Clamp(Value + valueIncrement, StandardQuality.MinValue, StandardQuality.MaxValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 仓管确认
        /// </summary>
        /// <param name="djID">单据ID</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>确认成功返回True,确认失败返回False</returns>
        public bool AffirmBill(int djID, out string error)
        {
            error = null;
            ISellIn serverSell = ServerModule.ServerModuleFactory.GetServerModule <ISellIn>();

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();

            try
            {
                var varBill = from a in dataContxt.S_CannibalizeBill
                              where a.ID == djID
                              select a;

                if (varBill.Count() != 1)
                {
                    throw new Exception("单据信息为空或者不唯一");
                }

                S_CannibalizeBill tempBillInfo = varBill.Single();

                if (tempBillInfo.DJZT == "已确认")
                {
                    throw new Exception("单据不能重复确认");
                }

                tempBillInfo.DJZT = "已确认";
                tempBillInfo.KFRY = BasicInfo.LoginID;
                tempBillInfo.KFRQ = ServerTime.Time;

                //操作总成库存状态
                if (!serverSell.UpdateProductStock(dataContxt, tempBillInfo.DJH, "调拨", tempBillInfo.OutStoreRoom,
                                                   tempBillInfo.InStoreRoom, out error))
                {
                    return(false);
                }

                OpertaionDetailAndStock(dataContxt, tempBillInfo, CE_SubsidiaryOperationType.库房调出);
                OpertaionDetailAndStock(dataContxt, tempBillInfo, CE_SubsidiaryOperationType.库房调入);

                dataContxt.SubmitChanges();
                dataContxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                dataContxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }
        private int GetValueIncrement(ISellIn sellIn)
        {
            int toAdd = 1;

            if (sellIn.Value <= 10)
            {
                toAdd = 2;
            }
            else if (sellIn.Value <= 5)
            {
                toAdd = 3;
            }

            return(toAdd);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 从营销出库单导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadDataFromOutboundOrder_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }

            FormQueryInfo dialog = QueryInfoDialog.GetOutboundBillDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string billNo = dialog.GetStringDataItem("单据号");

                if (MessageDialog.ShowEnquiryMessage("您确定要导入 " + billNo
                                                     + " 营销出库单的信息吗?此过程需要一段时间,是否继续?") == DialogResult.No)
                {
                    return;
                }

                // 营销出库单服务
                ISellIn billServer = ServerModuleFactory.GetServerModule <ISellIn>();

                DataTable bill = billServer.GetBill(billNo, 0);

                string storageID = bill.Rows[0]["StorageID"].ToString();

                DataTable list = billServer.GetList((int)bill.Rows[0]["ID"]);

                if (list.Rows.Count > 0)
                {
                    List <StorageGoods> lstGoods = new List <StorageGoods>(list.Rows.Count);

                    for (int i = 0; i < list.Rows.Count; i++)
                    {
                        StorageGoods goods = new StorageGoods();

                        goods.GoodsCode = list.Rows[i]["GoodsCode"].ToString();
                        goods.GoodsName = list.Rows[i]["GoodsName"].ToString();
                        goods.Spec      = list.Rows[i]["Spec"].ToString();
                        goods.Provider  = list.Rows[i]["Provider"].ToString();
                        goods.BatchNo   = list.Rows[i]["BatchNo"].ToString();
                        goods.Quantity  = (decimal)list.Rows[i]["Count"];
                        goods.StorageID = storageID;

                        lstGoods.Add(goods);
                    }

                    if (是否一次性物品.Checked && GlobalObject.GeneralFunction.IsNullOrEmpty(m_productNumber))
                    {
                        m_productNumber = cmbProductCode.Text;
                    }

                    if (!m_mbpServer.AddFromBill(BasicInfo.LoginID, Convert.ToInt32(
                                                     cmbPurpose.SelectedValue), m_productNumber, billNo, lstGoods, out m_error))
                    {
                        MessageDialog.ShowErrorMessage(m_error);
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("操作成功");

                        SearchData(0);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void Update(ISellIn sellIn)
        {
            int toAdd = sellIn.IsPassed() ? _afterPass : _beforePass;

            Value = Math.Clamp(Value + toAdd, MinValue, MaxValue);
        }
 public void Update(ISellIn sellIn)
 {
 }
Ejemplo n.º 7
0
 protected ItemBase(Item item, ISellIn sellIn, IQuality quality)
 {
     _item    = item;
     _sellIn  = sellIn;
     _quality = quality;
 }