コード例 #1
0
        /// <summary>
        /// Check Dummy Pallet Case and put it into Session.SessionKeys.DummyPalletCase
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string palletNo = (string) CurrentSession.GetValue(Session.SessionKeys.PalletNo);
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            string productId = currentProduct.ProId;
            IPalletRepository ipalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();


            //获取Pallet No : IMES_FA..Product.PalletNo: 如果该PalletNo 不是以'NA'或者'BA' 为前缀,则需要报告错误:“非散装FDE 机器,不能使用本功能!”

            string DPC = string.Empty; //Dummy Pallet Case
            DummyShipDetInfo dummyshipdet = new DummyShipDetInfo();
            string snoId = productId;
            dummyshipdet = ipalletRepository.GetDummyShipDet(snoId);
            if (palletNo.Substring(0, 2) == "NA")
            {
                if (!(dummyshipdet == null || dummyshipdet.snoId == "")) 
                {
                    DPC = "NA";        //  Case NA Dummy Pallet
                }
                else DPC = "NAN";       //  Case NA Non Dummy Pallet
            }
            else if (palletNo.Substring(0, 2) == "BA")
            {
                if (!(dummyshipdet == null || dummyshipdet.snoId == ""))
                {
                    DPC = "BA";         //  Case BA Dummy Pallet
                }
                else DPC = "BAN";       //  Case BA Non Dummy Pallet
            }
            else
            {
                FisException ex = new FisException("PAK019", new string[] {}); //非散装FDE 机器,不能使用本功能!
                throw ex;
            }
           
            CurrentSession.AddValue(Session.SessionKeys.DummyPalletCase, DPC);
            CurrentSession.AddValue(Session.SessionKeys.DummyShipDet, dummyshipdet);
	        return base.DoExecute(executionContext);
        }
コード例 #2
0
        /// <summary>
        /// Generate DummyPalletNo, and Save the Relation with Product in the IMES_PAK..Dummy_ShipDet Table
        /// </summary>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            FisException ex;
            List<string> erpara = new List<string>();
          //  Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
          //  string productId = currentProduct.ProId;
          //  绑定的是每一个刷入的CustSN的ProductID与DummyPalletNo的关系 
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IList<string> ScanedProductIDList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);

            IDeliveryRepository iDeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            string DPC = (string)CurrentSession.GetValue(Session.SessionKeys.DummyPalletCase);
            string dummyPalletNo = (string)CurrentSession.GetValue(Session.SessionKeys.DummyPalletNo);
            string generateDummyPalletNo = string.Empty;


            if (DPC == "NA" || DPC == "BA")
            {
                //DummyShipDetInfo currentDummyshipdet = (DummyShipDetInfo)CurrentSession.GetValue(Session.SessionKeys.DummyShipDet);

                //currentDummyshipdet.bol = dummyPalletNo;
                //currentDummyshipdet.editor = this.Editor;
                //currentDummyshipdet.cdt = DateTime.Now;
               
                ////update:
                //DummyShipDetInfo condDummyshipdet = new DummyShipDetInfo();
                //condDummyshipdet.snoId = currentDummyshipdet.snoId;
                //iDeliveryRepository.UpdateDummyShipDetInfo(currentDummyshipdet, condDummyshipdet);

            }

            else if (DPC == "NAN" || DPC == "BAN")
            {
                DummyShipDetInfo dummyshipdet = new DummyShipDetInfo();
                IList<DummyShipDetInfo> dummyshipdetList = null;

                //---- NumberControl ----
                INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                NumControl currentMaxNum = numCtrlRepository.GetMaxValue("Dummy", "DummyPalletNo");
                if (currentMaxNum == null)
                {
                    // 从数据库DummyShip_Det表获取当前最大值
                    dummyshipdetList = iDeliveryRepository.GetDummyShipDetInfoList(dummyshipdet); //拿全集

                    if (dummyshipdetList == null || dummyshipdetList.Count <= 0)
                    {
                        //generateDummyPalletNo = "9000000001";
                        //产线确认修改生产号规则:流水号初始值十进制   60000000
                        generateDummyPalletNo = "90" + "60000000";
                    }
                    else
                    {
                        int max = 0;
                        foreach (DummyShipDetInfo iDSD in dummyshipdetList)
                        {
                            if (iDSD.plt != null && iDSD.plt != "")
                            {
                                if (iDSD.plt.Length != 10)
                                {
                                    erpara.Add(iDSD.plt);
                                    ex = new FisException("PAK071", erpara);
                                    throw ex;
                                }

                                if (iDSD.plt.Substring(0, 2) != "90")
                                {
                                    erpara.Add(iDSD.plt);
                                    ex = new FisException("PAK048", erpara);
                                    throw ex;
                                }

                                Boolean exitLetter = Regex.Matches(iDSD.plt.Substring(2, 8), "[a-zA-Z]").Count > 0;

                                if (exitLetter)
                                {
                                    erpara.Add(iDSD.plt);
                                    ex = new FisException("PAK109", erpara);
                                    throw ex;
                                }

                                int temp = Convert.ToInt32(iDSD.plt.Substring(2, 8));
                                if (temp > max)
                                {
                                    max = temp;
                                }
                            }
                        }
                        if (max == 0)
                        {
                            generateDummyPalletNo = "90" + "60000000";
                        }
                        else
                        {
                            max = max + 1;
                            string maxString = max.ToString();
                            int maxlength = maxString.Length;
                            if (maxlength < 8)
                            {
                                int len = 8 - maxlength;
                                for (int i = 0; i < len; i++)
                                {
                                    maxString = "0" + maxString;
                                }
                            }
                            generateDummyPalletNo = "90" + maxString;
                        }
                    }

                    currentMaxNum = new NumControl();
                    currentMaxNum.NOName = "DummyPalletNo";
                    currentMaxNum.NOType = "Dummy";
                    currentMaxNum.Value = generateDummyPalletNo;
                    currentMaxNum.Customer = this.Customer;

                    IUnitOfWork uof = new UnitOfWork();
                    numCtrlRepository.InsertNumControlDefered(uof, currentMaxNum);
                    uof.Commit();
                    SqlTransactionManager.Commit();
                }
                else
                {
                    if (currentMaxNum.Value.Length != 10)
                    {
                        erpara.Add(currentMaxNum.Value);
                        ex = new FisException("PAK071", erpara);
                        throw ex;
                    }

                    if (currentMaxNum.Value.Substring(0, 2) != "90")
                    {
                        erpara.Add(currentMaxNum.Value);
                        ex = new FisException("PAK048", erpara);
                        throw ex;
                    }

                    int temp = Convert.ToInt32(currentMaxNum.Value.Substring(2, 8));
                    temp = temp + 1;
                    string maxtemp = temp.ToString();
                    int maxlength = maxtemp.Length;
                    if (maxlength < 8)
                    {
                        int len = 8 - maxlength;
                        for (int i = 0; i < len; i++)
                        {
                            maxtemp = "0" + maxtemp;
                        }
                    }
                    generateDummyPalletNo = "90" + maxtemp;

                
                    //currentMaxNum = new NumControl();
                    //currentMaxNum.NOName = "DummyPalletNo";
                    //currentMaxNum.NOType = "Dummy";
                    currentMaxNum.Value = generateDummyPalletNo;
                    //currentMaxNum.Customer = this.Customer;

                    IUnitOfWork uof = new UnitOfWork();

                    numCtrlRepository.Update(currentMaxNum, uof);
                    uof.Commit();
                    SqlTransactionManager.Commit();
                }

                //---- NumberControl ----

                // 每一个刷入的CustSN的ProductID与都要与该生成的DummyPalletNo绑定,并且bol应记录BOL (For NAN: dummyPalletNo = ideliveryRepository.GetDeliveryInfoValue(deliveryNo, "BOL");)
                foreach (string iprodId in ScanedProductIDList)
                {
                    dummyshipdet = new DummyShipDetInfo();

                    dummyshipdet.plt = generateDummyPalletNo;
                    dummyshipdet.snoId = iprodId;
                    dummyshipdet.bol = dummyPalletNo;
                    dummyshipdet.editor = this.Editor;
                    dummyshipdet.cdt = DateTime.Now;
                    dummyshipdet.udt = DateTime.Now;

                    // insert:
                    iDeliveryRepository.InsertDummyShipDetInfoDefered(CurrentSession.UnitOfWork, dummyshipdet);
                }

                
            }
            

            CurrentSession.AddValue(Session.SessionKeys.GenerateDummyPalletNo, generateDummyPalletNo);
           
            return base.DoExecute(executionContext);
        }
コード例 #3
0
ファイル: GetDummyPallet.cs プロジェクト: wra222/testgit
        /// <summary>
        /// Get Dummy Pallet No and put it into Session.SessionKeys.DummyPalletNo
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            FisException ex;
            List<string> erpara = new List<string>();

            string DPC = (string)CurrentSession.GetValue(Session.SessionKeys.DummyPalletCase);
            DummyShipDetInfo dummyshipdet = new DummyShipDetInfo();
            dummyshipdet = (DummyShipDetInfo)CurrentSession.GetValue(Session.SessionKeys.DummyShipDet);
            string deliveryNo = (string) CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
            string dummyPalletNo = string.Empty;
            IDeliveryRepository ideliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            
            switch (DPC)
            {
                case "NA":
                    if (dummyshipdet == null || string.IsNullOrEmpty(dummyshipdet.plt))
                    {
                        FisException fe = new FisException("PAK106", new string[] { });  //请维护DummyShipDet表数据!
                        throw fe;

                    }
                    dummyPalletNo = dummyshipdet.plt;
                    break;
                case "NAN":
                    dummyPalletNo = ideliveryRepository.GetDeliveryInfoValue(deliveryNo, "BOL");
                    if (string.IsNullOrEmpty(dummyPalletNo))
                    {
                        erpara.Add("BOL");
                        ex = new FisException("PAK047", erpara); ////没有InfoType为 %1 的DeliveryInfo!
                        throw ex;
                    }
                    break;
                case "BA":
                    if (dummyshipdet == null || string.IsNullOrEmpty(dummyshipdet.plt))
                    {
                        FisException fe = new FisException("PAK106", new string[] { });  //请维护DummyShipDet表数据!
                        throw fe;

                    }
                    dummyPalletNo = dummyshipdet.plt;
                    break;
                case "BAN":
                    Delivery currentDelivery = (Delivery) CurrentSession.GetValue(Session.SessionKeys.Delivery);
                    //ITC-1360-1368:Revision: 8761 : 增加说明Delivery.ShipDate 在Pallet Verify (FDE Only) 的业务中使用的时候,需要转换为yyyy/mm/dd 格式的字符串使用
                    //string shipDate = currentDelivery.ShipDate.ToString();
                    string shipDate = currentDelivery.ShipDate.ToString("yyyy/MM/dd");
                    if (string.IsNullOrEmpty(shipDate))
                    {
                        FisException fe = new FisException("PAK056", new string[] { });  //Delivery %1 的资料维护不全!
                        throw fe;
                    }
                    string carrier = ideliveryRepository.GetDeliveryInfoValue(deliveryNo, "Carrier");
                    if (string.IsNullOrEmpty(carrier))
                    {
                        erpara.Add("Carrier");
                        ex = new FisException("PAK047", erpara);    //没有InfoType为 %1 的DeliveryInfo!
                        throw ex;
                    }                   
                    dummyPalletNo = shipDate + carrier;
                    break;
                default:
                    break;
            }

            //ITC-1360-1276: Dummy_ShipDet.PLT才是Dummy Pallet No,而ShipDate (IMES_PAK..Delivery.ShipDate)属性值和 Carrier (IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'Carrier')属性值仅是UI 显示的Pallet No 
            // Check the Dummy Pallet No Naming Rule: Prefix:90
            //if (dummyPalletNo.Substring(0, 2) != "90")
            //{
            //    erpara.Add(dummyPalletNo);
            //    ex = new FisException("PAK048", erpara);
            //    throw ex;
            //}

            CurrentSession.AddValue(Session.SessionKeys.DummyPalletNo, dummyPalletNo);

            return base.DoExecute(executionContext);
        }
コード例 #4
0
ファイル: GetFDETotalQty.cs プロジェクト: wra222/testgit
        /// <summary>
        /// SVN 2569: Add new
        /// Get FDE Total Qty and put it into Session.SessionKeys.Qty
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //FisException ex;
            //List<string> erpara = new List<string>();

            string DPC = (string)CurrentSession.GetValue(Session.SessionKeys.DummyPalletCase);
            string dummyPalletNo = (string) CurrentSession.GetValue(Session.SessionKeys.DummyPalletNo);
            IDeliveryRepository ideliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IList<Delivery> DeliveryList = new List<Delivery>();
            int TotalQty = 0;

            switch (DPC)
            {
                case "NA":
                    TotalQty = 0;
                    break;
                case "NAN":
                    //DeliveryList= ideliveryRepository.GetDeliveryListByInfoType("BOL");
                    //if (DeliveryList == null || DeliveryList.Count <= 0)
                    //{
                    //    erpara.Add("BOL");
                    //    ex = new FisException("CHK020", erpara);
                    //    throw ex;
                    //}
                    //TotalQty = DeliveryList.Count;
                    
                    //ITC-1360-1743
                    //For Case NA Non Dummy Pallet,Total Qty 为IMES_PAK..Dummy_ShipDet 中
                    //满足BOL = 方才刷入的Customer S/N 对应的Product 结合的Delivery 的BOL(IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'BOL')属性值的记录总数

                    string dn = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
                    string DeliveryValue = ideliveryRepository.GetDeliveryInfoValue(dn, "BOL");

                    DummyShipDetInfo dummyshipdet = new DummyShipDetInfo();
                    dummyshipdet.bol = DeliveryValue;
                   
                    IList<DummyShipDetInfo> dummyshipdetList = null;
                    dummyshipdetList = ideliveryRepository.GetDummyShipDetInfoList(dummyshipdet);

                    if (dummyshipdetList == null || dummyshipdetList.Count <= 0)
                    {
                        //erpara.Add("BOL");
                        //ex = new FisException("CHK020", erpara);
                        //throw ex;
                        TotalQty = 0;
                    }
                    TotalQty = dummyshipdetList.Count;

                    break;
                case "BA":
                    TotalQty = 0;
                    break;
                case "BAN":
                    //DeliveryList = ideliveryRepository.GetDeliveryListByInfoType("Carrier");
                    //if (DeliveryList == null || DeliveryList.Count <= 0)
                    //{
                    //    erpara.Add("BOL");
                    //    ex = new FisException("PAK047", erpara);
                    //    throw ex;
                    //}
                    //TotalQty = DeliveryList.Count;

                    //For Case BA Non Dummy Pallet,Total Qty 为Dummy_ShipDet 表中
                    //BOL = 方才刷入的Customer S/N 对应的Product 结合的Delivery (IMES_FA..Product.DeliveryNo)的ShipDate (IMES_PAK..Delivery.ShipDate)属性值 + Carrier 
                    //(IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'Carrier')属性值相等的记录数量

                    // 其实就是dummyPalletNo (dummyPalletNo = shipDate + carrier;)

                    DummyShipDetInfo BANdummyshipdet = new DummyShipDetInfo();
                    BANdummyshipdet.bol = dummyPalletNo;

                    IList<DummyShipDetInfo> BANdummyshipdetList = null;
                    BANdummyshipdetList = ideliveryRepository.GetDummyShipDetInfoList(BANdummyshipdet);

                    if (BANdummyshipdetList == null || BANdummyshipdetList.Count <= 0)
                    {
                        //erpara.Add("BOL");
                        //ex = new FisException("CHK020", erpara);
                        //throw ex;
                        TotalQty = 0;
                    }
                    TotalQty = BANdummyshipdetList.Count;
                    

                    break;
                default:
                    break;
            }

            CurrentSession.AddValue(Session.SessionKeys.Qty, TotalQty.ToString());

            return base.DoExecute(executionContext);
        }