Esempio n. 1
0
        /// <summary>
        ///     添加临时盘点
        /// </summary>
        /// <param name="db"></param>
        /// <param name="locBill">盘点库位</param>
        /// <param name="details">盘点明细</param>
        /// <returns></returns>
        public static void AddTempInventory(SpareEntities db, TB_INVENTORY_LOC locBill,
                                            List <TB_INVENTORY_DETAIL> details)
        {
            var bill = new TB_BILL
            {
                BillType   = (int)BillType.InventoryPlan,
                OperName   = locBill.OperName,
                StartTime  = locBill.CheckBeginTime,
                FinishTime = locBill.CheckEndTime,
                State      = (int)BillState.Finished
            };

            locBill.State = (int)InventoryState.Checked;
            var locList = new List <TB_INVENTORY_LOC> {
                locBill
            };

            SetBillNum(bill);                                              //设置单据编号
            locList.ForEach(p => p.BillNum = bill.BillNum);                //设置明细编号

            InventoryController.AddOrUpdate(db, bill);                     //添加盘点计划
            InventoryController.AddLocList(db, locList);                   //添加盘点库位
            InventoryController.AddDetailList(db, details);                //添加盘点明细

            InventoryController.AdjustStockByInventory(db, bill, details); //根据盘点结果调整库存
        }
Esempio n. 2
0
        /// <summary>
        ///     【盘点单】调整库存
        /// </summary>
        /// <param name="db"></param>
        /// <param name="bill"></param>
        /// <param name="details"></param>
        /// <returns></returns>
        public static void AdjustStockByInventoryLoc(SpareEntities db, TB_BILL bill)
        {
            var details = db.TB_INVENTORY_DETAIL.Where(p => p.BillNum == bill.BillNum).ToList();

            InventoryController.AdjustStockByInventory(db, bill, details);
            BillController.UpdateState(db, bill, BillState.Finished);
            NotifyController.AddNotify(db, bill.OperName, NotifyType.InventoryPlanApprove, bill.BillNum, "");
        }