コード例 #1
0
        /// <summary>
        /// Validate เมื่อ Cell มีการแก้ไขเรียบร้อย  และค่าที่แก้ไขเป็นค่าใหม่
        /// </summary>
        /// <param name="row"></param>
        /// <param name="column"></param>
        private bool ValidateCellEdited(int row, int column)
        {
            if (column == (int)eColView.ITEM_CD)
            {
                ItemValidator itemValidator = new ItemValidator();

                object objItemCode = shtView.GetValue(row, column);
                if (objItemCode != null)
                {
                    NZString itemCode  = new NZString(null, objItemCode);
                    bool     bLoadItem = LoadItemIntoRow(row, itemCode);
                    if (!bLoadItem)
                    {
                        return(false);
                    }
                }
            }
            else if (column == (int)eColView.ORDER_QTY)
            {
                try
                {
                    NZDecimal orderRate = new NZDecimal(null, shtView.Cells[row, (int)eColView.ORDER_UM_RATE].Value);
                    NZDecimal invRate   = new NZDecimal(null, shtView.Cells[row, (int)eColView.INV_UM_RATE].Value);
                    NZDecimal orderQty  = new NZDecimal(null, shtView.Cells[row, (int)eColView.ORDER_QTY].Value);
                    NZDecimal price     = new NZDecimal(null, shtView.Cells[row, (int)eColView.PRICE].Value);

                    decimal invQty = (invRate.NVL(0) / orderRate.NVL(1)) * orderQty.NVL(0);
                    decimal amount = price.NVL(0) * orderQty.NVL(0);

                    shtView.Cells[row, (int)eColView.QTY].Value    = invQty;
                    shtView.Cells[row, (int)eColView.AMOUNT].Value = amount;
                }
                catch
                {
                    shtView.Cells[row, (int)eColView.AMOUNT].Value = 0;
                    shtView.Cells[row, (int)eColView.QTY].Value    = 0;
                }
            }

            else if (column == (int)eColView.PRICE)
            {
                try
                {
                    NZDecimal orderQty = new NZDecimal(null, shtView.Cells[row, (int)eColView.ORDER_QTY].Value);
                    NZDecimal price    = new NZDecimal(null, shtView.Cells[row, (int)eColView.PRICE].Value);

                    decimal amount = price.NVL(0) * orderQty.NVL(0);

                    shtView.Cells[row, (int)eColView.AMOUNT].Value = amount;
                }
                catch
                {
                    shtView.Cells[row, (int)eColView.AMOUNT].Value = 0;
                }
            }

            return(true);
        }
コード例 #2
0
 public ErrorItem CheckIsZeroAdjustQty(NZDecimal adjustQty)
 {
     if (adjustQty.NVL(0) == 0)
     {
         return(new ErrorItem(adjustQty.Owner, TKPMessages.eValidate.VLM0035.ToString()));
     }
     return(null);
 }
コード例 #3
0
        public ErrorItem CheckEmptyPrice(NZDecimal Price)
        {
            if (Price.IsNull)
            {
                return(new ErrorItem(Price.Owner, TKPMessages.eValidate.VLM0169.ToString()));
            }

            if (Price.NVL(0) == 0)
            {
                return(new ErrorItem(Price.Owner, TKPMessages.eValidate.VLM0220.ToString()));
            }
            return(null);
        }
コード例 #4
0
        public ItemWeightDTO ConvertKGtoPCS(NZString MasterNo, NZString ProcessNo, NZDecimal QtyKG, NZInt processCount)
        {
            ItemWeightDTO weightDTO = new ItemWeightDTO();


            NZDecimal decQtyPCS = null;
            //ถ้า convert จาก KG เป็น PCS จะ ใช้น้ำหนักตาม Process
            ItemProcessDAO dao = new ItemProcessDAO();

            ItemProcessDTO itemProcess = new ItemProcessDTO();

            itemProcess.ITEM_CD    = MasterNo;
            itemProcess.PROCESS_CD = ProcessNo;
            itemProcess            = dao.LoadWeightByItemProcessCount(CommonLib.Common.CurrentDatabase, itemProcess, new NZInt(null, (processCount.NVL(0) <= 1 ? 1 : processCount.Value)));

            if (itemProcess != null)
            {
                weightDTO.ItemCD    = MasterNo;
                weightDTO.ProcessCD = ProcessNo;
                weightDTO.QtyKG     = QtyKG;

                decimal decQtyKG = QtyKG.NVL(0);


                if (itemProcess.WEIGHT.NVL(0) == 0)
                {
                    decQtyPCS = null;
                }
                else
                {
                    decQtyPCS = new NZDecimal(null, Math.Round(QtyKG / itemProcess.WEIGHT * 1000, MidpointRounding.AwayFromZero));
                }

                if (decQtyPCS != null && decQtyPCS.NVL(0) > 10000000)
                {
                    EVOFramework.ErrorItem errorItem = null;

                    errorItem = new EVOFramework.ErrorItem(QtyKG.Owner, Rubik.TKPMessages.eValidate.VLM0184.ToString());

                    EVOFramework.ValidateException.ThrowErrorItem(errorItem);
                }

                weightDTO.QtyPCS = decQtyPCS;
            }

            return(weightDTO);
        }
コード例 #5
0
        private void UpdateOnhandQtyText()
        {
            NZDecimal onhand = m_controller.GetOnhandQty(
                dtAdjustDate.NZValue,
                txtMasterNo.Text.ToNZString(),
                new NZString(null, cboStoredLoc.SelectedValue),
                new NZString(null, txtLotNo.Text.Trim()));

            if (m_screenMode == eScreenMode.EDIT)
            {
                AdjustmentEntryUIDM model = m_controller.LoadData(m_editTransactionID);
                if (model.AdjustType.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out))
                {
                    InventoryTransBIZ biz = new InventoryTransBIZ();
                    onhand.Value = onhand.StrongValue + biz.LoadByTransactionID(m_editTransactionID).QTY.StrongValue;
                }
            }

            txtOnhandQty.PathValue = onhand.NVL(0);
        }
コード例 #6
0
        private List <InventoryTransactionDTO> SplitBoxSize(ReceivingEntryUIDM receivingModel
                                                            , List <InventoryTransactionViewDTO> argReceivingList)
        {
            List <InventoryTransactionDTO> listSplitBox = new List <InventoryTransactionDTO>();

            RunningNumberBIZ runningNoBiz   = new RunningNumberBIZ();
            NZString         strLotNoPrefix = runningNoBiz.GenerateLotNoPrefix(new NZDateTime(null, receivingModel.RECEIVE_DATE.StrongValue));

            Dictionary <string, NZInt> dictLastRunningNo = new Dictionary <string, NZInt>();
            NZInt iLastRunningNo = new NZInt();

            InventoryTransactionDTO transDTO = null;

            foreach (InventoryTransactionViewDTO receivingDTO in argReceivingList)
            {
                iLastRunningNo = new NZInt(null, 0);

                //lot size == 0 ไม่ต้องแตก lot
                if ((receivingDTO.LOT_CONTROL_CLS != DataDefine.Convert2ClassCode(DataDefine.eLOT_CONTROL_CLS.Yes)) ||
                    (receivingDTO.LOT_SIZE.NVL(0) <= 0)
                    )
                {
                    transDTO = new InventoryTransactionDTO();

                    transDTO.ITEM_CD         = receivingDTO.ITEM_CD;
                    transDTO.LOT_NO          = receivingDTO.LOT_NO;
                    transDTO.PRICE           = receivingDTO.PRICE;
                    transDTO.QTY             = receivingDTO.QTY;
                    transDTO.EXTERNAL_LOT_NO = receivingDTO.EXTERNAL_LOT_NO;


                    listSplitBox.Add(transDTO);
                }
                else
                {
                    int iTotalBox = (int)Math.Ceiling(receivingDTO.QTY.NVL(0) / receivingDTO.LOT_SIZE.NVL(1));

                    if (dictLastRunningNo.ContainsKey(receivingDTO.ITEM_CD.StrongValue))
                    {
                        iLastRunningNo = dictLastRunningNo[receivingDTO.ITEM_CD.StrongValue];
                    }
                    else
                    {
                        iLastRunningNo = runningNoBiz.GetLastLotNoRunningBox(strLotNoPrefix, receivingModel.STORED_LOC, receivingDTO.ITEM_CD, new NZInt(null, 0));
                        dictLastRunningNo.Add(receivingDTO.ITEM_CD.StrongValue, iLastRunningNo);
                    }

                    NZDecimal dRemainQty = new NZDecimal(null, receivingDTO.QTY.StrongValue);
                    for (int iBox = 0; iBox < iTotalBox; iBox++)
                    {
                        transDTO = new InventoryTransactionDTO();

                        transDTO.ITEM_CD         = receivingDTO.ITEM_CD;
                        transDTO.LOT_NO          = GenerateLotNo(strLotNoPrefix, ref iLastRunningNo);
                        transDTO.PRICE           = receivingDTO.PRICE;
                        transDTO.EXTERNAL_LOT_NO = receivingDTO.EXTERNAL_LOT_NO;

                        if (dRemainQty.NVL(0) >= receivingDTO.LOT_SIZE.NVL(0))
                        {
                            transDTO.QTY     = new NZDecimal(null, receivingDTO.LOT_SIZE.StrongValue);
                            dRemainQty.Value = dRemainQty.StrongValue - transDTO.QTY.StrongValue;
                        }
                        else
                        {
                            transDTO.QTY = new NZDecimal(null, dRemainQty.StrongValue);
                        }



                        listSplitBox.Add(transDTO);
                    }
                }
            }

            return(listSplitBox);
        }