Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            FisException ex;
            List<string> errpara = new List<string>(); ;
            string data = (string)CurrentSession.GetValue("Data");
            //ITC-1360-1104
            
            IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
            bool flag = false;

            string type = (string)CurrentSession.GetValue("Doc_type");

            // mantis 2073
            if (type == "Pack List- Summary")
            {
                flag = repPizza.CheckExistVShipmentPakComnByWaybillNo(data);
                if (flag == false)
                {
                    errpara.Add(data);
                    ex = new FisException("CHK1033", errpara); // 無效的 Waybill %1
                    //ex1.stopWF = false;
                    throw ex;
                }
                IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                IList<string> dnList = deliveryRep.GetEdiDnListByWayBill(data);
                if (dnList == null || dnList.Count == 0)
                {
                    ex = new FisException("PAK090", errpara); // 無法找到相應的Delivery
                    //ex1.stopWF = false;
                    throw ex;
                }
                // 頁面只允許輸入 waybill, 這邊替換成 DN 做後續處理, 以免最後頁面 用多個dn,印多個pdf
                CurrentSession.AddValue("WayBill", data);
                CurrentSession.AddValue(Session.SessionKeys.VCode, "DN");
                CurrentSession.AddValue("Data", dnList[0]);
                return base.DoExecute(executionContext);
            }

            //ITC-1360-1104
            //ITC-1360-1148
            //ITC-1360-1147
            if (!String.IsNullOrEmpty(data) && data.Length >= 10)
            {
                flag = repPizza.CheckExistPakDashPakComnByInternalID(data.Substring(0, 10));
                if (flag == true)
                {
                    CurrentSession.AddValue(Session.SessionKeys.VCode, "DN");
                    return base.DoExecute(executionContext);
                }
            }
            flag = repPizza.CheckExistVShipmentPakComnByConsolInvoiceOrShipment(data);
            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "Shipment");
                return base.DoExecute(executionContext);                
            }
            flag = repPizza.CheckExistVShipmentPakComnByWaybillNo(data);
            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "Waybill");
                return base.DoExecute(executionContext);                
            }
            //6.18 BOL
            IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            DeliveryInfo cond = new DeliveryInfo();
            cond.InfoType = "BOL";
            cond.InfoValue = data;
            IList<DeliveryInfo> infoList = new List<DeliveryInfo>();
            infoList = DeliveryRepository.GetDeliveryInfoList(cond);
            if (infoList != null && infoList.Count > 0)
            {
                IList<string> dnList = new List<string>();
                dnList = DeliveryRepository.GetDeliveryNoPrefixByValueAndType(data, "BOL");

                CurrentSession.AddValue(Session.SessionKeys.VCode, "BOL");
                CurrentSession.AddValue(Session.SessionKeys.DeliveryList, dnList);
                CurrentSession.AddValue(Session.SessionKeys.DnCount, dnList.Count);
                CurrentSession.AddValue(Session.SessionKeys.DnIndex, 0);

                ArrayList BOLpdfList = new ArrayList();
                CurrentSession.AddValue("BOLPdfList", BOLpdfList);
                return base.DoExecute(executionContext); 
            }
            //6.18 BOL

            CurrentSession.AddValue(Session.SessionKeys.VCode, "Unknown");
            errpara.Add(data);
            ex = new FisException("CHK816", errpara);
            //ex.stopWF = false;
            throw ex;
            //CurrentSession.AddValue(Session.SessionKeys.VCode, "Unknown");
            //return base.DoExecute(executionContext);
        }        
Esempio n. 2
0
        /// <summary>
        /// 根据输入的TruckID,获取Forwarder对象,并放到Session中
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            var palletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            IList<ForwarderInfo> lstFwder = palletRepository.GetForwarderInfoByTruckID(Key);
            ForwarderInfo fwderInfo = new ForwarderInfo();

            if (lstFwder == null || lstFwder.Count == 0)
            {
                List<string> errpara = new List<string>();
                errpara.Add(this.Key);
                throw new FisException("CHK147", errpara);
            }

            //fwderInfo = lstFwder[0];
            string dateStr = (string)CurrentSession.GetValue(Session.SessionKeys.DateCode);
            try
            {
                lstFwder = (from fr in lstFwder where fr.Date == dateStr select fr).ToList();
                if (lstFwder.Count == 0) throw new NullReferenceException();
                //fwderInfo = lstFwder.First(fi => fi.Date == dateStr);
                //fwderInfo = lstFwder[0];
            }
            catch (Exception)
            {
                List<string> errpara = new List<string>();
                errpara.Add(this.Key);
                throw new FisException("CHK147", errpara);
            }

            IList<MAWBInfo> lstMawb = null;
            foreach (ForwarderInfo fi in lstFwder)
            {
                fwderInfo = fi;
                if (string.IsNullOrEmpty(fwderInfo.MAWB))
                {
                    throw new FisException("CHK148", new string[] { } );
                }

                lstMawb = palletRepository.GetMAWBInfoByMAWBorHAWB(fwderInfo.MAWB);
                if (lstMawb == null || lstMawb.Count == 0)
                {
                    throw new FisException("CHK148", new string[] { } );
                }
            }

			if (!palletRepository.PickCardCheck(Key, dateStr))
			{
                List<string> errpara = new List<string>();
                errpara.Add(this.Key);
                throw new FisException("CHK189", errpara);
			}

            string isAutoBOL = "N"; //是自動單?
            if (lstMawb != null && lstMawb.Count > 0)
            {
                MAWBInfo mawbInfo = lstMawb[0];
                IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                DeliveryInfo cond = new DeliveryInfo();
                cond.DeliveryNo = mawbInfo.Delivery;
                cond.InfoType = "Flag";
                IList<DeliveryInfo> lstD = DeliveryRepository.GetDeliveryInfoList(cond);
                if (lstD != null && lstD.Count > 0)
                {
                    foreach (DeliveryInfo di in lstD)
                    {
                        if ("N".Equals(di.InfoValue))
                        {
                            isAutoBOL = "Y";
                            break;
                        }
                    }
                }
            }
            CurrentSession.AddValue("IsAutoBOL", isAutoBOL);

            CurrentSession.AddValue(Session.SessionKeys.Forwarder, fwderInfo);
            CurrentSession.AddValue(Session.SessionKeys.Forwarder+"List", lstFwder);
            return base.DoExecute(executionContext);
        }
Esempio n. 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {            
            string data = (string)CurrentSession.GetValue("Data");
            //ITC-1360-1104
            
            IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
            bool flag = false;
            //ITC-1360-1104
            //ITC-1360-1148
            //ITC-1360-1147
            if (!String.IsNullOrEmpty(data) && data.Length >= 10)
            {
                flag = repPizza.CheckExistPakDashPakComnByInternalID(data.Substring(0, 10));
                if (flag == true)
                {
                    CurrentSession.AddValue(Session.SessionKeys.VCode, "DN");
                    return base.DoExecute(executionContext);
                }
            }
            flag = repPizza.CheckExistVShipmentPakComnByConsolInvoiceOrShipment(data);
            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "Shipment");
                return base.DoExecute(executionContext);                
            }
            flag = repPizza.CheckExistVShipmentPakComnByWaybillNo(data);
            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "Waybill");
                return base.DoExecute(executionContext);                
            }
            //6.18 BOL
            IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            DeliveryInfo cond = new DeliveryInfo();
            cond.InfoType = "BOL";
            cond.InfoValue = data;
            IList<DeliveryInfo> infoList = new List<DeliveryInfo>();
            infoList = DeliveryRepository.GetDeliveryInfoList(cond);
            if (infoList != null && infoList.Count > 0)
            {
                IList<string> dnList = new List<string>();
                dnList = DeliveryRepository.GetDeliveryNoPrefixByValueAndType(data, "BOL");

                CurrentSession.AddValue(Session.SessionKeys.VCode, "BOL");
                CurrentSession.AddValue(Session.SessionKeys.DeliveryList, dnList);
                CurrentSession.AddValue(Session.SessionKeys.DnCount, dnList.Count);
                CurrentSession.AddValue(Session.SessionKeys.DnIndex, 0);

                ArrayList BOLpdfList = new ArrayList();
                CurrentSession.AddValue("BOLPdfList", BOLpdfList);
                return base.DoExecute(executionContext); 
            }
            //6.18 BOL

            CurrentSession.AddValue(Session.SessionKeys.VCode, "Unknown");
            List<string> errpara = new List<string>();
            errpara.Add(data);
            FisException ex = new FisException("CHK816", errpara);
            //ex.stopWF = false;
            throw ex;
            //CurrentSession.AddValue(Session.SessionKeys.VCode, "Unknown");
            //return base.DoExecute(executionContext);
        }