Ejemplo n.º 1
0
 public static void ValidateSendOSIStatus(BomStatus status, UPSPOBOM poBom)
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     logger.DebugFormat("BEGIN: {0}()", methodName);
     try
     {
         logger.InfoFormat("Reply SendOSIStatus retCode:{0} message:{1} datastring:{2}", status.retcode.ToString(), status.message, status.datastring);
         if (status.retcode == 0) //Holding process need waiting time
         {
             
              poBom.State = SendBOMState.SendOSIOK;
           
         }               
         else
         {
            poBom.State = SendBOMState.SendOSIFail;
            poBom.ErrorText = string.Format("Return Code:{0} DataString:{1} Message:{2}", status.retcode, status.datastring, status.message);
          }
     }
     catch (Exception e)
     {
         logger.Error(methodName, e);
         throw e;
     }
     finally
     {
         logger.DebugFormat("END: {0}()", methodName);
     }
 }
Ejemplo n.º 2
0
        public static void ValidatePoStatus(BomStatus status, UPSPOBOM poBom, AppConfig config)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}()", methodName);
            try
            {
                logger.InfoFormat("Reply ValidatePoStatus retCode:{0} message:{1} datastring:{2}", status.retcode.ToString(), status.message, status.datastring);
                if (status.retcode == 0) //Holding process need waiting time
                {                    
                     poBom.State = SendBOMState.VerifyOK;                 
                }
                else if (status.retcode == 1) //need send OSI
                {
                    if (!string.IsNullOrEmpty(status.datastring))
                    {
                        poBom.State = SendBOMState.NeedSendOSI;


                        //產生OSI String ??????
                        //HP說目前OS只有CustomerPO欄位
                        //string osiString = "<CustomerPO>{0}</CustomerPO>";
                        //osiString = string.Format(osiString, poBom.CustPO);
                        string osiString = GenOSIString(poBom, status.datastring, config);

                        ValidateSendOSIStatus(RequestUPSSendOSI(poBom, osiString), poBom);
                        if (poBom.State == SendBOMState.SendOSIOK)
                        {
                            //6.UPSVerifyPO
                            BomStatus validatePoStatus = UPSWS.RequestUPSVerifyPOReady(poBom);
                            //7.UPSGetRange
                            UPSWS.ValidatePoStatus(validatePoStatus, poBom, config);
                        }
                    }
                    else
                    {
                        poBom.State = SendBOMState.VerifyFail;
                         poBom.ErrorText = string.Format("Return Code:{0} DataString:{1} Message:{2}", status.retcode, status.datastring, status.message);
                    }
                }
                else
                {
                    poBom.State = SendBOMState.VerifyFail;
                    poBom.ErrorText = string.Format("Return Code:{0} DataString:{1} Message:{2}", status.retcode, status.datastring, status.message);

                }
            }
            catch (Exception e)
            {
                logger.Error(methodName, e);
                throw e;
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
        }
Ejemplo n.º 3
0
        public static void ValidateSendBomStatus(BomStatus status, UPSPOBOM poBom, AppConfig config)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}()", methodName);
            try
            {
                logger.InfoFormat("Reply SendBomStatus PO:{0} retCode:{1} message:{2} datastring:{3}", poBom.HPPO, status.retcode.ToString(), status.message, status.datastring);
                if (status.retcode == 0) //Holding process need waiting time
                {
                    poBom.State = SendBOMState.SendBOMHolding;
                    
                }
                else if (status.retcode == 1) // Send OSI 
                {
                    
                    poBom.State = SendBOMState.NeedSendOSI;
                  

                    //產生OSI String ??????
                    //HP說目前OS只有CustomerPO欄位
                    //string osiString = "<CustomerPO>{0}</CustomerPO>";
                    //osiString = string.Format(osiString, poBom.CustPO);
                   string osiString = GenOSIString(poBom, status.datastring, config);

                    ValidateSendOSIStatus(RequestUPSSendOSI(poBom, osiString), poBom);
                }
                else if (status.retcode == 2)
                {                  
                   poBom.State = SendBOMState.SendBOMOK;                  
                }
                else if (status.retcode == 4)
                {                    
                    poBom.State = SendBOMState.SendBOMUnSupportedAV;
                    poBom.ErrorText = string.Format("Reply SendBomStatus  PO:{0} Code:{1} DataString:{2} Message:{3}", poBom.HPPO, status.retcode, status.datastring, status.message);
                }
                else if (status.retcode == 3)
                {
                    poBom.State = SendBOMState.AlreadySendBOM;
                    poBom.ErrorText = string.Format("Reply SendBomStatus PO:{0} Code:{1} DataString:{2} Message:{3}", poBom.HPPO, status.retcode, status.datastring, status.message);
                }
                else
                {
                    poBom.State = SendBOMState.SendBOMFail;
                    poBom.ErrorText = string.Format("Reply SendBomStatus  PO:{0} Code:{1} DataString:{2} Message:{3}", poBom.HPPO, status.retcode, status.datastring, status.message);
                }
            }
            catch (Exception e)
            {
                logger.Error(methodName, e);
                throw e;
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
        }