Ejemplo n.º 1
0
        public async Task <IActionResult> CreateInput(Transaction_Detail_Dto model)
        {
            if (await _service.CreateInput(model))
            {
                return(Ok());
            }

            throw new Exception("Creating the rack location failed on save");
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateInput(Transaction_Detail_Dto model)
        {
            var updateBy = User.FindFirst(ClaimTypes.Name).Value;

            if (await _service.CreateInput(model, updateBy))
            {
                return(Ok());
            }

            throw new Exception("Creating the rack location failed on save");
        }
Ejemplo n.º 3
0
        public async Task <bool> CreateInput(Transaction_Detail_Dto model)
        {
            var qrCodeModel = await _repoQRCodeMain.GetByQRCodeID(model.QrCode_Id);

            if (qrCodeModel != null && qrCodeModel.Valid_Status == "Y")
            {
                var listQrCodeDetails = await _repoQRCodeDetail.GetByQRCodeIDAndVersion(qrCodeModel.QRCode_ID, qrCodeModel.QRCode_Version);

                Random ran = new Random();
                int    num = ran.Next(100, 999);
                var    packingListModel = await _repoPackingList.GetByReceiveNo(qrCodeModel.Receive_No);

                WMSB_Transaction_Main inputModel = new WMSB_Transaction_Main();
                inputModel.Transac_Type   = "I";
                inputModel.Transac_No     = model.Input_No;
                inputModel.Transac_Time   = DateTime.Now;
                inputModel.QRCode_ID      = qrCodeModel.QRCode_ID;
                inputModel.QRCode_Version = qrCodeModel.QRCode_Version;
                inputModel.MO_No          = packingListModel.MO_No;
                inputModel.MO_Seq         = packingListModel.MO_Seq;
                inputModel.Purchase_No    = packingListModel.Purchase_No;
                inputModel.Material_ID    = packingListModel.Material_ID;
                inputModel.Material_Name  = packingListModel.Material_Name;
                inputModel.Purchase_Qty   = model.Accumated_Qty;
                inputModel.Transacted_Qty = model.Trans_In_Qty;
                inputModel.Rack_Location  = model.Rack_Location;
                inputModel.Can_Move       = "Y";
                inputModel.Updated_By     = "Emma";
                inputModel.Updated_Time   = DateTime.Now;
                _repoTransactionMain.Add(inputModel);

                var i = 0;
                foreach (var item in model.Detail_Size)
                {
                    WMSB_Transaction_Detail inputDetailModel = new WMSB_Transaction_Detail();
                    inputDetailModel.Transac_No    = inputModel.Transac_No;
                    inputDetailModel.Tool_Size     = listQrCodeDetails[i].Tool_Size;
                    inputDetailModel.Model_Size    = listQrCodeDetails[i].Model_Size;
                    inputDetailModel.Order_Size    = listQrCodeDetails[i].Order_Size;
                    inputDetailModel.Spec_Size     = listQrCodeDetails[i].Spec_Size;
                    inputDetailModel.Qty           = listQrCodeDetails[i].Qty;
                    inputDetailModel.Trans_Qty     = item.Qty;
                    inputDetailModel.Instock_Qty   = item.Qty;
                    inputDetailModel.Untransac_Qty = inputDetailModel.Qty - inputDetailModel.Trans_Qty;
                    inputDetailModel.Updated_By    = "Nam";
                    inputDetailModel.Updated_Time  = DateTime.Now;
                    _repoTransactionDetail.Add(inputDetailModel);
                    i += 1;
                }
                return(await _repoTransactionMain.SaveAll());
            }
            return(false);
        }
Ejemplo n.º 4
0
        public async Task <Transaction_Detail_Dto> GetDetailByQRCodeID(object qrCodeID)
        {
            Transaction_Detail_Dto model = new Transaction_Detail_Dto();
            var qrCodeMainList           = await _repoQRCodeMain.CheckQrCodeID(qrCodeID);

            if (qrCodeMainList.Count == 0)
            {
                return(null);
            }
            else
            {
                var qrCodeModel = qrCodeMainList.Where(x => x.Is_Scanned == "N").FirstOrDefault();
                if (qrCodeModel != null)
                {
                    var packingListModel = await _repoPackingList.GetByReceiveNo(qrCodeModel.Receive_No);

                    var listQrCodeDetails = await _repoQRCodeDetail.GetByQRCodeIDAndVersion(qrCodeID, qrCodeModel.QRCode_Version);

                    decimal?          num        = 0;
                    List <DetailSize> listDetail = new List <DetailSize>();
                    foreach (var item in listQrCodeDetails)
                    {
                        DetailSize detail = new DetailSize();
                        num        += item.Qty;
                        detail.Size = item.Order_Size;
                        detail.Qty  = item.Qty;
                        listDetail.Add(detail);
                    }
                    model.Suplier_No    = packingListModel.Supplier_ID;
                    model.Suplier_Name  = packingListModel.Supplier_Name;
                    model.Detail_Size   = listDetail;
                    model.QrCode_Id     = qrCodeModel.QRCode_ID.Trim();
                    model.Plan_No       = packingListModel.MO_No.Trim();
                    model.Batch         = packingListModel.MO_Seq;
                    model.Mat_Id        = packingListModel.Material_ID.Trim();
                    model.Mat_Name      = packingListModel.Material_Name.Trim();
                    model.Accumated_Qty = num;
                    model.Trans_In_Qty  = 0;
                    model.InStock_Qty   = 0;
                    model.Is_Scanned    = qrCodeModel.Is_Scanned;
                    return(model);
                }
                else
                {
                    model.Is_Scanned = "Y";
                    return(model);
                }
            }
        }