Esempio n. 1
0
        private void Preproduct(string f39PreProductCode, string f39KneadingLine, int f39PrePdtLotAmt, string f39KndCmdNo, ref PreProductPlanSimuItem item, bool inventoryUnderRetrieval, bool acceptedMaterialOnly, ref Dictionary <string, double> lstAmount)
        {
            item.Count += 1;
            var count      = item.Count;
            var preProduct = _unitOfWork.PreProductRepository.GetMany(i => i.F03_PreProductCode == f39PreProductCode).FirstOrDefault();
            var pItem      = new PreproductISimulerItem();

            pItem.KndLine = f39KneadingLine == Constants.F39_KneadingLine.Megabit.ToString("D");
            pItem.Code    = count;
            if (preProduct != null)
            {
                pItem.Name           = preProduct.F03_PreProductName;
                pItem.PreProductCode = preProduct.F03_PreProductCode;
                pItem.batch          = preProduct.F03_BatchLot;
            }
            pItem.Command = f39KndCmdNo;
            pItem.Lot     = f39PrePdtLotAmt;

            pItem.Count = 0;
            var prepdtmkp =
                _unitOfWork.PrePdtMkpRepository.GetAll().Where(i => i.F02_PreProductCode == f39PreProductCode);
            var checkSimulation = true;

            pItem.SimulationPopUpItems = new List <SimulationPopUpItem>();
            foreach (var tm02prepdtmkp in prepdtmkp)
            {
                var simulationPopUp = new SimulationPopUpItem();
                var flag            = Material(tm02prepdtmkp.F02_MaterialCode, tm02prepdtmkp.F02_3FLayinAmount,
                                               tm02prepdtmkp.F02_4FLayinAmount, preProduct.F03_BatchLot, f39PrePdtLotAmt, ref lstAmount, ref simulationPopUp);
                if (!flag)
                {
                    checkSimulation = false;
                }
                pItem.SimulationPopUpItems.Add(simulationPopUp);
            }
            if (prepdtmkp.Any())
            {
                pItem.Simulation = !checkSimulation ? "NG" : "OK";
            }
            item.PreproductISimulerItems.Add(pItem);
        }
Esempio n. 2
0
        private bool Material(string materialCode, double f02_3FLayinAmount, double f02_4FLayinAmount,
                              int f03BatchLot, int f39PrePdtLotAmt, ref Dictionary <string, double> totalAmount, ref SimulationPopUpItem popUpItem)
        {
//f_tcdebuglog( "Enter: function w_tcpp054::wf_material()" )
//Integer li_count
//istr_pd[ii_count].preproduct[ai_count].count += 1
//li_count = istr_pd[ii_count].preproduct[ai_count].count

//String ls_name
//SELECT f01_materialdsp
//  INTO :ls_name
//  FROM tm01_material
// WHERE f01_materialcode = :as_code   ;
            var material = _unitOfWork.MaterialRepository.GetById(materialCode);
            var amount   = totalAmount.FirstOrDefault(i => i.Key.Trim() == materialCode.Trim());
//Real lr_qty, lr_stock, lr_remainder
//lr_qty = ( ar_3f + ar_4f ) * ai_batch * ai_lot

//Integer li_i
//Boolean lb_flag
//FOR li_i = 1 TO w_tcpp051f.ii_count
//    IF w_tcpp051f.istr_amount[li_i].code = as_code THEN
//        lr_stock = w_tcpp051f.istr_amount[li_i].amount
//        lr_remainder = lr_stock - lr_qty
//        w_tcpp051f.istr_amount[li_i].amount = lr_remainder
            var lr_Qty     = (f02_3FLayinAmount + f02_4FLayinAmount) * f03BatchLot * f39PrePdtLotAmt;
            var lrReminder = amount.Value - lr_Qty;

            if (amount.Key != null)
            {
                totalAmount.Remove(amount.Key);
                totalAmount.Add(amount.Key, lrReminder);
            }
            else
            {
                totalAmount.Add(materialCode, lrReminder);
            }

//        IF lr_remainder < 0 THEN
//            lb_flag = FALSE
//        ELSE
//            lb_flag = TRUE
//        END IF
//        exit
//    END IF
//NEXT

            popUpItem.MaterialCode = materialCode;
            if (material != null)
            {
                popUpItem.MaterialName = material.F01_MaterialDsp;
            }
            popUpItem.RequiredQuantity = lr_Qty;
            popUpItem.Remainder        = lrReminder;
            popUpItem.Stock            = amount.Value;



//istr_pd[ii_count].preproduct[ai_count].material[li_count].code = as_code
//istr_pd[ii_count].preproduct[ai_count].material[li_count].name = ls_name
//istr_pd[ii_count].preproduct[ai_count].material[li_count].qty = lr_qty
//istr_pd[ii_count].preproduct[ai_count].material[li_count].stock = lr_stock
//istr_pd[ii_count].preproduct[ai_count].material[li_count].remainder = lr_remainder

//return lb_flag
            return(!(lrReminder < 0));
        }