コード例 #1
0
        public string Getlowtmpflag(string as_palletno, StoreProductItem item)
        {
            if (string.IsNullOrEmpty(as_palletno))
            {
                for (int i = 0; i < 5; i++)
                {
                    var productCode = "";
                    switch (i)
                    {
                    case 1:
                        productCode = item.ProductCode1;
                        break;

                    case 2:
                        productCode = item.ProductCode2;
                        break;

                    case 3:
                        productCode = item.ProductCode3;
                        break;

                    case 4:
                        productCode = item.ProductCode4;
                        break;

                    case 5:
                        productCode = item.ProductCode5;
                        break;
                    }
                    var tm09 =
                        _unitOfWork.ProductRepository.GetMany(o => o.F09_ProductCode == productCode).FirstOrDefault();
                    if (tm09.F09_LowTmpCls == Constants.Temperature.Low.ToString("D"))
                    {
                        return(Constants.Temperature.Low.ToString("D"));
                    }
                }
                return(Constants.Temperature.Normal.ToString("D"));
            }
            var lstPreproductCode =
                _unitOfWork.ProductShelfStockRepository.GetMany(
                    i => i.F40_PalletNo.Trim().Equals(as_palletno.Trim())).Select(i => i.F40_ProductCode.Trim());
            var lstTm09 =
                _unitOfWork.ProductRepository.GetMany(i => lstPreproductCode.Contains(i.F09_ProductCode.Trim()));

            foreach (var tm09 in lstTm09)
            {
                if (tm09.F09_LowTmpCls == Constants.Temperature.Low.ToString("D"))
                {
                    return(Constants.Temperature.Low.ToString("D"));
                }
            }
            return(Constants.Temperature.Normal.ToString("D"));
        }
コード例 #2
0
        public ActionResult ProcessThirdCommunicationData(StoreProductItem item)
        {
            // Parameters are not valid.
            if (item == null)
            {
                item = new StoreProductItem();
                TryValidateModel(item);
            }

            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            // Find terminal no.
            var teminalNo = _identityService.FindTerminalNo(HttpContext.User.Identity);
            var result    = _storageOfProductDomain.ProcessDataReceiveMessageForC3(teminalNo, item);

            return(Json(result));
        }
コード例 #3
0
        /// <summary>
        /// Responding Reply From C3 Rules:
        /// </summary>
        /// <param name="terminalNo"></param>
        /// <param name="item"></param>
        public List <ThirdCommunicationResponse> ProcessDataReceiveMessageForC3(string terminalNo, StoreProductItem item)
        {
            var items = new List <ThirdCommunicationResponse>();

            var lstTx47 =
                _unitOfWork.ProductWarehouseCommandRepository.GetMany(
                    i => i.F47_TerminalNo.Trim().Equals(terminalNo.Trim()) && i.F47_PictureNo.Trim().Equals(Constants.PictureNo.TCPR011F) &&
                    (i.F47_Status == "6" || i.F47_Status == "7" || i.F47_Status == "8"))
                .OrderBy(i => i.F47_AddDate);

            //OPEN c1 ;
            foreach (var tx47 in lstTx47)
            {
                var tx47Item = Mapper.Map <ThirdCommunicationResponse>(tx47);
                tx47Item.OldStatus   = tx47.F47_Status;
                tx47Item.ProductCode = "";
                if (!string.IsNullOrEmpty(item.ProductCode1))
                {
                    tx47Item.ProductCode = tx47Item.ProductCode + item.ProductCode1;
                }
                if (!string.IsNullOrEmpty(item.ProductCode2))
                {
                    if (string.IsNullOrEmpty(tx47Item.ProductCode))
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + item.ProductCode2;
                    }
                    else
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + ", " + item.ProductCode2;
                    }
                }
                if (!string.IsNullOrEmpty(item.ProductCode3))
                {
                    if (string.IsNullOrEmpty(tx47Item.ProductCode))
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + item.ProductCode3;
                    }
                    else
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + ", " + item.ProductCode3;
                    }
                }
                if (!string.IsNullOrEmpty(item.ProductCode4))
                {
                    if (string.IsNullOrEmpty(tx47Item.ProductCode))
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + item.ProductCode4;
                    }
                    else
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + ", " + item.ProductCode4;
                    }
                }
                if (!string.IsNullOrEmpty(item.ProductCode5))
                {
                    if (string.IsNullOrEmpty(tx47Item.ProductCode))
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + item.ProductCode5;
                    }
                    else
                    {
                        tx47Item.ProductCode = tx47Item.ProductCode + ", " + item.ProductCode5;
                    }
                }


                var newStatus   = "";
                var ls_serialno = "";
                var row         = "";
                var bay         = "";
                var level       = "";
                switch (tx47.F47_Status[0])
                {
                case '6':
                    newStatus = "C";
                    TabletStorageEnd(tx47.F47_PalletNo);
                    break;

                case '7':
                    newStatus = "D";
                    CancelCommand(tx47.F47_PalletNo);
                    break;

                case '8':
                    newStatus = "E";
                    if (!AssignSpaceShelf(tx47.F47_PalletNo, Getlowtmpflag(tx47.F47_PalletNo, item), ref row,
                                          ref bay, ref level, terminalNo))
                    {
                        newStatus = "B";
                        CancelCommand(tx47.F47_PalletNo);
                    }
                    else
                    {
                        if (insertcommand(Constants.F47_CommandNo.TwoTimes.ToString("d"), ref ls_serialno,
                                          item.PalletNo, row, bay, level, terminalNo))
                        {
                            //               f_tcsendmsgtoc3(TX47_CmdNo_TwoTimes, ls_serialno)
                        }
                    }
                    break;
                }
                tx47.F47_Status     = newStatus;
                tx47.F47_UpdateDate = DateTime.Now;
                _unitOfWork.ProductWarehouseCommandRepository.Update(tx47);
                items.Add(tx47Item);
            }

            _unitOfWork.Commit();

            return(items);
        }
コード例 #4
0
        /// <summary>
        ///Insert,Update And Delete Data
        /// </summary>
        /// <returns></returns>
        public ResponseResult UpdaDateCreateAndDelete(StoreProductItem item, string terminalNo)
        {
            #region Delete old details on the pallet

            //Delete data from “TX40_PdtShfStk” table, where [F40_PalletNo] = Pallet No textbox value
            _unitOfWork.ProductShelfStockRepository.Delete(i => i.F40_PalletNo.Trim().Equals(item.PalletNo.Trim()));

            //Delete data from “TX53_OutSidePrePdtStk” table, where [F53_PalletNo] = Pallet No textbox value.
            _unitOfWork.OutSidePrePdtStkRepository.Delete(i => i.F53_PalletNo.Trim().Equals(item.PalletNo.Trim()));

            //Delete data from “TX57_Pdtshf” table, where [F57_PalletNo] = Pallet No textbox value.
            _unitOfWork.ProductShelfRepository.Delete(i => i.F57_PalletNo.Trim().Equals(item.PalletNo.Trim()));
            _unitOfWork.Commit();
            #endregion

            #region Insert And Update Datas


            //	Insert new data into “TX57_PdtShf” table
            var outFlg = item.OutOfSpec
                ? Constants.StorageOfProductStatus.OutOfPlan.ToString("D")
                : Constants.StorageOfProductStatus.Normal.ToString("D");
            if (!string.IsNullOrEmpty(item.PalletNo))
            {
                _unitOfWork.ProductShelfRepository.InsertProductShelf(item.PalletNo.Trim(), outFlg, 0);
            }


            //-	Suppose System Date is the current system date.
            DateTime systemDate = DateTime.Now;
            //If the “Normal” radio button is checked, retrieve System Date from [f56_tbtenddate] in “TX56_tbtpdt” table, where [f56_Productcode] = [Product Code] and [f56_prepdtlotno] = [Prepdt LotNo]
            //If the “Out of Plan” radio button is checked, retrieve System Date from [f58_tbtenddate]
            if (Constants.StorageOfProductStatus.Normal.Equals(item.StorageOfProductStatus))
            {
                UpdateTableProduct(item.ProductCode1, item.PreProductLotNo1,
                                   item.PackQty1, item.PackUnit1, item.OutOfSpec, item.Fraction1);
                UpdateTableProduct(item.ProductCode2, item.PreProductLotNo2,
                                   item.PackQty2, item.PackUnit2, item.OutOfSpec, item.Fraction2);
                UpdateTableProduct(item.ProductCode3, item.PreProductLotNo3,
                                   item.PackQty3, item.PackUnit3, item.OutOfSpec, item.Fraction3);
                UpdateTableProduct(item.ProductCode4, item.PreProductLotNo4,
                                   item.PackQty4, item.PackUnit4, item.OutOfSpec, item.Fraction4);
                UpdateTableProduct(item.ProductCode5, item.PreProductLotNo5,
                                   item.PackQty5, item.PackUnit1, item.OutOfSpec, item.Fraction5);
            }
            else
            {
                UpdateOutOfPlanProduct(item.ProductCode1, item.PreProductLotNo1,
                                       item.PackQty1, item.PackUnit1, item.OutOfSpec, item.Fraction1);
                UpdateOutOfPlanProduct(item.ProductCode2, item.PreProductLotNo2,
                                       item.PackQty2, item.PackUnit2, item.OutOfSpec, item.Fraction2);
                UpdateOutOfPlanProduct(item.ProductCode3, item.PreProductLotNo3,
                                       item.PackQty3, item.PackUnit3, item.OutOfSpec, item.Fraction3);
                UpdateOutOfPlanProduct(item.ProductCode4, item.PreProductLotNo4,
                                       item.PackQty4, item.PackUnit4, item.OutOfSpec, item.Fraction4);
                UpdateOutOfPlanProduct(item.ProductCode5, item.PreProductLotNo5,
                                       item.PackQty5, item.PackUnit5, item.OutOfSpec, item.Fraction5);
            }

            //Insert new data into “TX40_PdtShfStk”:
            var stockFlag = Constants.F40_StockFlag.TX40_StkFlg_Str;
            #region Get System Date

            #endregion

            var certificationflg = item.OutOfSpec
                ? Constants.F40_CertificationFlag.TX40_CrtfctnFlg_OutofSpec.ToString("D")
                : Constants.F40_CertificationFlag.TX40_CrtfctnFlg_Normal.ToString("D");

            _unitOfWork.ProductShelfStockRepository.InsertProductShelfStock(item.PalletNo,
                                                                            item.PreProductLotNo1, item.ProductCode1,
                                                                            item.LotNo1, stockFlag, item.PackQty1, item.Fraction1, item.PackQty1 * item.PackUnit1 + item.Fraction1,
                                                                            item.TabletingEndDate1,
                                                                            certificationflg);
            _unitOfWork.ProductShelfStockRepository.InsertProductShelfStock(item.PalletNo,
                                                                            item.PreProductLotNo2, item.ProductCode2,
                                                                            item.LotNo2, stockFlag, item.PackQty2, item.Fraction2, item.PackQty2 * item.PackUnit2 + item.Fraction2,
                                                                            item.TabletingEndDate2,
                                                                            certificationflg);
            _unitOfWork.ProductShelfStockRepository.InsertProductShelfStock(item.PalletNo,
                                                                            item.PreProductLotNo3, item.ProductCode3,
                                                                            item.LotNo3, stockFlag, item.PackQty3, item.Fraction3, item.PackQty3 * item.PackUnit3 + item.Fraction3,
                                                                            item.TabletingEndDate3,
                                                                            certificationflg);
            _unitOfWork.ProductShelfStockRepository.InsertProductShelfStock(item.PalletNo,
                                                                            item.PreProductLotNo4, item.ProductCode4,
                                                                            item.LotNo4, stockFlag, item.PackQty4, item.Fraction4, item.PackQty4 * item.PackUnit4 + item.Fraction4,
                                                                            item.TabletingEndDate4,
                                                                            certificationflg);
            _unitOfWork.ProductShelfStockRepository.InsertProductShelfStock(item.PalletNo,
                                                                            item.PreProductLotNo5, item.ProductCode5,
                                                                            item.LotNo5, stockFlag, item.PackQty5, item.Fraction5, item.PackQty5 * item.PackUnit5 + item.Fraction5,
                                                                            item.TabletingEndDate5,
                                                                            certificationflg);
            //Update data in TX51_PdtShfSts table
            var lstProductCode =
                new List <string>(new String[]
                                  { item.ProductCode1, item.ProductCode2, item.ProductCode3, item.ProductCode4, item.ProductCode5 });
            var lowTemp     = Constants.TX37LowTmpCls.TX37_LowTmpCls_Low.ToString("D");
            var normal      = Constants.TX37LowTmpCls.TX37_LowTmpCls_Nml.ToString("D");
            var emptyShelf  = Constants.F51_ShelfStatus.TX51_ShfSts_Epy;
            var normalShelf = Constants.F51_ShelfType.Normal.ToString("D");
            var isChecked   = false;

            // var serialNo = 0;

            var f47From = GetConveyorCode(terminalNo);
            var f47To   = "";
            for (int j = 0; j < lstProductCode.Count; j++)
            {
                if (!string.IsNullOrEmpty(lstProductCode[j]))
                {
                    var productCode = lstProductCode[j];
                    var product     =
                        _unitOfWork.ProductRepository.Get(
                            i =>
                            i.F09_ProductCode.Trim().Equals(productCode.Trim()) &&
                            (i.F09_LowTmpCls.Equals(lowTemp) || i.F09_LowTmpCls.Equals(normal)));

                    if (product != null)
                    {
                        var productShelfStatuses =
                            _unitOfWork.ProductShelfStatusRepository.GetMany(
                                i =>
                                i.F51_ShelfStatus.Equals(emptyShelf) && i.F51_ShelfType.Equals(normalShelf));


                        if (product.F09_LowTmpCls == lowTemp)
                        {
                            productShelfStatuses =
                                productShelfStatuses.Where(
                                    i =>
                                    i.F51_LowTmpShfAgnOrd != null).OrderBy(i => i.F51_LowTmpShfAgnOrd);
                        }
                        else
                        {
                            productShelfStatuses =
                                productShelfStatuses.Where(
                                    i =>
                                    i.F51_CmdShfAgnOrd != null).OrderBy(i => i.F51_CmdShfAgnOrd);
                        }
                        foreach (var productShelfStatus in productShelfStatuses)
                        {
                            productShelfStatus.F51_ShelfStatus     = Constants.F51_ShelfStatus.TX51_ShfSts_RsvStr;
                            productShelfStatus.F51_StockTakingFlag =
                                Constants.F51_StockTakingFlag.TX51_StkTkgFlg_InvNotChk;
                            productShelfStatus.F51_PalletNo   = item.PalletNo;
                            productShelfStatus.F51_TerminalNo = terminalNo;
                            productShelfStatus.F51_UpdateDate = DateTime.Now;
                            _unitOfWork.ProductShelfStatusRepository.Update(productShelfStatus);

                            isChecked = true;

                            f47To = productShelfStatus.F51_ShelfRow + productShelfStatus.F51_ShelfBay +
                                    productShelfStatus.F51_ShelfLevel;
                            break;
                        }
                    }
                }
            }
            //Insert or update tx48
            var isNoManage = true;
            var serialNo   = _unitOfWork.NoManageRepository.CreateOrUpdateTX48(ref isNoManage,
                                                                               Constants.GetColumnInNoManager.Pdtwhscmdno, 0, 0, 0, 0, 1);

            var F47CmdSeqNo = serialNo.ToString("D4");

            //Insert Tx47
            _unitOfWork.ProductWarehouseCommandRepository.InsertProductWarehouseCommand(
                Constants.F47_CommandNo.Storage.ToString("D"), F47CmdSeqNo,
                Constants.CommandType.CmdType_0, Constants.F47_StrRtrType.Product.ToString("D"),
                Constants.F47_Status.AnInstruction.ToString("D"), item.PalletNo, f47From, f47To,
                terminalNo,
                Constants.PictureNo.TCPR011F);

            var message = "0001" + terminalNo.PadLeft(4) + Constants.PictureNo.TCPR011F.PadLeft(8) +
                          "0066" +
                          F47CmdSeqNo + "1000" +
                          Constants.F50_CommandType.CmdType_0.ToString("D").PadLeft(4) +
                          Constants.F47_Status.AnInstruction.ToString("D").PadLeft(4) + f47From + f47To +
                          item.PalletNo.PadLeft(4);
            _notificationService.SendMessageToC3("TCPR011F", message);

            #endregion

            _unitOfWork.Commit();
            if (!isChecked)
            {
                return(new ResponseResult(true, "There is no empty location available in the warehouse now!"));
            }
            return(new ResponseResult(true));
        }