public static void AdjustStockByInventory(SpareEntities db, TB_BILL bill, List <TB_INVENTORY_DETAIL> details) { var stockMoveList = new List <TB_STOCK_MOVE>(); foreach (TB_INVENTORY_DETAIL detail in details) { StoreLocationController.UnLock(db, detail.CheckLocCode);//解锁库位 var diffqty = detail.BookQty - detail.CheckQty; if (diffqty == 0) { continue; } var stockMove = detail.ToStockMove(); if (diffqty < 0) { stockMove.FromLocCode = "OTHER"; stockMove.ToLocCode = stockMove.ToLocCode; stockMove.Qty = (decimal) - diffqty; } else { stockMove.FromLocCode = stockMove.ToLocCode; stockMove.ToLocCode = "OTHER"; stockMove.Qty = (decimal)diffqty; } stockMoveList.Add(stockMove); } StockDetailController.ListMove(db, bill, stockMoveList);//盘点差异执行移库 }
internal static List <TB_OUT> GetList(SpareEntities db, TB_ASK materialAsk) { List <TB_OUT> partPickList = new List <TB_OUT>(); var stockDetailList = StockDetailController.GetListByPartCode(db, materialAsk.PartCode).Where(p => p.Qty > 0).ToList(); if (stockDetailList.Count == 0) { return(partPickList); } partPickList = SpareOutController.GetList(materialAsk, stockDetailList); return(partPickList); }