コード例 #1
0
ファイル: SpareOutController.cs プロジェクト: 0000duck/MES-3
        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);
        }
コード例 #2
0
ファイル: SpareOutController.cs プロジェクト: 0000duck/MES-3
        public static List <TB_OUT> GetList(TB_ASK materialAsk, List <TS_STOCK_DETAIL> stockDetailList)
        {
            List <TB_OUT> partPickList = new List <TB_OUT>();

            if (stockDetailList.Count == 0)
            {
                return(partPickList);
            }
            var stockDetail = stockDetailList.OrderBy(p => p.Batch).First();//FIFO
            var partPick    = new TB_OUT
            {
                PartCode     = materialAsk.PartCode,
                Batch        = stockDetail.Batch,
                BillQty      = materialAsk.Qty,
                FromLocCode  = stockDetail.LocCode,
                UnitPrice    = stockDetail.UnitPrice,
                DeptCode     = materialAsk.DeptCode,
                ProjectCode  = materialAsk.ProjectCode,
                WorklineCode = materialAsk.WorklineCode,
                EqptCode     = materialAsk.EqptCode,
                AskUser      = materialAsk.AskUser,
                AskTime      = materialAsk.AskTime,
                ConfirmUser  = materialAsk.ConfirmUser,
                ConfirmTime  = materialAsk.ConfirmTime
            };

            if (stockDetail.Qty >= materialAsk.Qty)
            {
                partPick.OutQty = materialAsk.Qty;
                partPick.Amount = partPick.UnitPrice * partPick.OutQty;
                partPickList.Add(partPick);
            }
            else
            {
                partPick.OutQty = stockDetail.Qty;
                partPick.Amount = partPick.UnitPrice * partPick.OutQty;
                partPickList.Add(partPick);
                stockDetailList.Remove(stockDetail);
                partPick.OutQty -= stockDetail.Qty;
                var pList = GetList(materialAsk, stockDetailList);
                partPickList.AddRange(pList);
            }
            return(partPickList);
        }
コード例 #3
0
ファイル: SpareAskController.cs プロジェクト: 0000duck/MES-3
 public static void AddOrUpdate(SpareEntities db, TB_ASK ask)
 {
     db.TB_ASK.AddOrUpdate(p => p.UID, ask);
 }