예제 #1
0
 private string GetPartNoFromCustPartNo(string custPartNo, string customerNo)
 {
     if (string.IsNullOrEmpty(custPartNo))
     {
         return(string.Empty);
     }
     using (CHubEntities db = new CHubEntities())
     {
         G_CATALOG_CUSTOMER_PART_BLL custBLL = new G_CATALOG_CUSTOMER_PART_BLL(db);
         string PartNo = custBLL.GetPartNoFromCustPartNo(custPartNo, customerNo);
         if (string.IsNullOrEmpty(PartNo))
         {
             G_PART_DESCRIPTION_BLL partBLL = new G_PART_DESCRIPTION_BLL(db);
             if (partBLL.IsPartNoExist(custPartNo))
             {
                 return(custPartNo);
             }
             else
             {
                 return(string.Empty);
             }
         }
         return(PartNo);
     }
 }
예제 #2
0
        public string CheckOrderLineItemAction(OrderLineCheckArg olArg)
        {
            //reset
            olArg.olItem.PartNo            = string.Empty;
            olArg.olItem.AltAVLCheckColor  = string.Empty;
            olArg.olItem.PriAVLCheckColor  = string.Empty;
            olArg.olItem.PartNoPlaceHolder = string.Empty;
            olArg.olItem.PriAVLCheck       = null;
            olArg.olItem.AltAVLCheck       = null;
            olArg.olItem.DescCN            = string.Empty;
            olArg.olItem.Description       = string.Empty;
            olArg.olItem.ItemBackColor     = string.Empty;
            olArg.olItem.WarningMsg        = string.Empty;
            olArg.olItem.WarningColor      = string.Empty;

            olArg.olItem.LastCheckNo = olArg.olItem.CustomerPartNo;
            olArg.olItem.LastQty     = olArg.olItem.Qty;

            string msg = string.Empty;

            olArg.olItem.PartNo = GetPartNoFromCustPartNo(olArg.olItem.CustomerPartNo, olArg.customerNo);


            olArg.olItem.PartNoPlaceHolder = string.Empty;
            if (string.IsNullOrEmpty(olArg.olItem.PartNo))
            {
                olArg.olItem.PartNoPlaceHolder = "Can't find Part NO";
                olArg.olItem.ItemBackColor     = CHubConstValues.ErrorColor;
                return(null);
            }
            else
            {
                CHubEntities           db       = new CHubEntities();
                G_PART_DESCRIPTION_BLL pDescBLL = new G_PART_DESCRIPTION_BLL(db);

                //Get description
                G_PART_DESCRIPTION pDesc = pDescBLL.GetPartDescription(olArg.olItem.PartNo);
                olArg.olItem.Description = pDesc.DESCRIPTION;
                olArg.olItem.DescCN      = pDesc.DESC_CN;

                //check inactive status
                if (pDesc.PART_STATUS == PartStatusEnum.I.ToString())
                {
                    olArg.olItem.WarningMsg = string.Format("SSC:{0},", pDesc.CURRENT_SALES_STATUS_CODE);
                    //olArg.olItem.WarningColor = CHubConstValues.WarningColor;
                }

                string usingSysID = olArg.primarySysID;
                //Do AVL check
                if (olArg.olItem.Qty > 0)
                {
                    if (string.IsNullOrEmpty(olArg.primarySysID) || string.IsNullOrEmpty(olArg.primaryWareHouse))
                    {
                        msg = "No Primary SysID and WareHouse information";
                    }


                    G_NETAVL_BLL netBLL = new G_NETAVL_BLL(db);
                    //Primary AVL check
                    decimal priNet = netBLL.GetSpecifyNETAVL(olArg.primarySysID, olArg.olItem.PartNo, olArg.primaryWareHouse);
                    if (priNet == 0)
                    {
                        olArg.olItem.PriAVLCheckColor = CHubConstValues.NoStockColor;
                    }
                    else if (priNet >= olArg.olItem.Qty)
                    {
                        olArg.olItem.PriAVLCheckColor = CHubConstValues.SatisfyStockColor;
                    }
                    else
                    {
                        olArg.olItem.PriAVLCheckColor = CHubConstValues.PartialStockColor;
                    }
                    olArg.olItem.PriAVLCheck = priNet;

                    //if primary is no enough do  Alt AVL check
                    if (priNet < olArg.olItem.Qty)
                    {
                        if (!(string.IsNullOrEmpty(olArg.altSysID) || string.IsNullOrEmpty(olArg.altWareHosue)))
                        {
                            decimal altNet = netBLL.GetSpecifyNETAVL(olArg.altSysID, olArg.olItem.PartNo, olArg.altWareHosue);
                            if (altNet == 0)
                            {
                                olArg.olItem.AltAVLCheckColor = CHubConstValues.NoStockColor;
                            }
                            else if (altNet >= olArg.olItem.Qty)
                            {
                                olArg.olItem.AltAVLCheckColor = CHubConstValues.SatisfyStockColor;
                                usingSysID = olArg.altSysID;
                            }
                            else
                            {
                                olArg.olItem.AltAVLCheckColor = CHubConstValues.PartialStockColor;
                            }
                            olArg.olItem.AltAVLCheck = altNet;
                        }
                    }
                }

                //Do G_OESALES_CATALOG_VALIDATION
                G_OESALES_CATALOG_VALIDATION oeSaleValidation = new G_OESALES_CATALOG_VALIDATION(usingSysID, olArg.olItem.PartNo, olArg.olItem.Qty);
                olArg.olItem.WarningMsg += oeSaleValidation.ValidationAction();
                if (!string.IsNullOrEmpty(olArg.olItem.WarningMsg))
                {
                    olArg.olItem.WarningColor = CHubConstValues.WarningColor;
                }
            }

            return(msg);
        }
예제 #3
0
        public ActionResult FuzzyQueryParNo(string fuzzypartNo)
        {
            G_PART_DESCRIPTION_BLL gpBLL = new G_PART_DESCRIPTION_BLL();

            return(Json(gpBLL.fuzzyqueryByPartNo(fuzzypartNo)));
        }