示例#1
0
        public static void UpdateState(SpareEntities db, TB_BILL bill, BillState state)
        {
            bill.State = (int)state;//更新【单据】状态为:完成
            OperateType operType;

            switch (state)
            {
            case BillState.New:
            case BillState.Handling:
                operType = OperateType.Update;
                break;

            case BillState.Finished:
                operType = OperateType.Finish;
                break;

            case BillState.Cancelled:
                operType = OperateType.Cancel;
                break;

            default:
                operType = OperateType.Update;
                break;
            }
            BillLogController.Add(db, bill, bill.OperName, operType); //创建【单据日志】
        }
示例#2
0
        public static void UpdateState(SpareEntities db, TB_BILL bill, BillState state)
        {
            bill.State = (int)state;//更新【单据】状态为:完成
            OperateType operType;

            switch (state)
            {
            case BillState.New:
            case BillState.Handling:
                bill.StartTime = DateTime.Now.ToString(SysConfig.LongTimeString);
                operType       = OperateType.Update;
                break;

            case BillState.Finished:
                bill.FinishTime = DateTime.Now.ToString(SysConfig.LongTimeString);
                operType        = OperateType.Finish;
                break;

            case BillState.Cancelled:
                bill.FinishTime = DateTime.Now.ToString(SysConfig.LongTimeString);
                operType        = OperateType.Cancel;
                break;

            default:
                bill.StartTime = DateTime.Now.ToString(SysConfig.LongTimeString);
                operType       = OperateType.Update;
                break;
            }
            AddOrUpdate(db, bill);
            BillLogController.Add(db, bill, bill.OperName, operType); //创建【单据日志】
        }
示例#3
0
        public static void LocStart(SpareEntities db, TB_INVENTORY_LOC locBill)
        {
            var bill = db.TB_INVENTORY_LOC.SingleOrDefault(p => p.BillNum == locBill.BillNum && p.LocCode == locBill.LocCode);

            if (bill != null)
            {
                bill.CheckBeginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//
//                locBill.CheckBeginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//
//                db.TB_INVENTORY_LOC.Attach(locBill);
//                db.Entry(locBill).State = EntityState.Modified;
            }
            else
            {
                locBill.CheckBeginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                db.TB_INVENTORY_LOC.Remove(locBill);
                db.TB_INVENTORY_LOC.Attach(locBill);
                db.Entry(locBill).State = EntityState.Modified;
            }
            //                bill.State = (int)BillState.Handling; //更新单据状态为正在执行
            StoreLocationController.Lock(db, locBill.LocCode);                        //锁定库位

            BillLogController.Add(db, locBill, locBill.OperName, OperateType.Update); //创建【单据日志】
        }
示例#4
0
        public static void LocFinish(SpareEntities db, TB_INVENTORY_LOC locBill, List <TB_INVENTORY_DETAIL> details)
        {
//            locBill.State = (int)BillState.Finished; //更新单据状态为已完成
            var bill = BillController.GetBill(db, locBill.BillNum);

            locBill.CheckEndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            db.TB_INVENTORY_LOC.Remove(locBill);
            db.TB_INVENTORY_LOC.Attach(locBill);
            db.Entry(locBill).State = EntityState.Modified;
            db.TB_INVENTORY_DETAIL.AddOrUpdate(p => p.UID, details.ToArray());
            AdjustStockByInventory(db, bill, details);                                //根据盘点结果调整库存

            BillLogController.Add(db, locBill, locBill.OperName, OperateType.Finish); //创建【单据日志】
        }
示例#5
0
 public static void AddOrUpdate(SpareEntities db, TB_BILL bill)
 {
     db.TB_BILL.AddOrUpdate(p => p.BillNum, bill);
     BillLogController.Add(db, bill, bill.OperName, OperateType.Add); //创建【单据日志】
 }
示例#6
0
 public static void Cancel(SpareEntities db, TB_BILL bill)
 {
     bill.State = (int)BillState.Cancelled;                              //更新单据状态为取消
     BillLogController.Add(db, bill, bill.OperName, OperateType.Cancel); //创建【单据日志】
 }
示例#7
0
 public static void Finish(SpareEntities db, TB_BILL bill)
 {
     bill.State = (int)BillState.Finished;                               //更新单据状态为结束
     BillLogController.Add(db, bill, bill.OperName, OperateType.Finish); //创建【单据日志】
 }
示例#8
0
 public static void Start(SpareEntities db, TB_BILL bill)
 {
     bill.State = (int)BillState.Handling;                               //更新单据状态为正在执行
     BillLogController.Add(db, bill, bill.OperName, OperateType.Update); //创建【单据日志】
 }