Esempio n. 1
0
        public bool CreateLotAttribute(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, IEnumerable <PODetailSchedular> poDetail)
        {
            var  pd      = poDetail.First();
            bool rtnFlag = false;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/LotSelectUpdate.svc";
                svcLotSelectUpdate.LotSelectUpdateSvcContractClient svcLotSelectUpdate = GetClient <svcLotSelectUpdate.LotSelectUpdateSvcContractClient, svcLotSelectUpdate.LotSelectUpdateSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                svcLotSelectUpdate.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcLotSelectUpdate.LotSelectUpdateTableset dsLotSelectUpdate = new svcLotSelectUpdate.LotSelectUpdateTableset();
                svcLotSelectUpdate.GetNewPartLot(ref dsLotSelectUpdate, pd.PartNum);

                dsLotSelectUpdate.PartLot[0].LotNum = pd.LotNum;

                dsLotSelectUpdate.PartLot[0].Batch          = pd.Batch;
                dsLotSelectUpdate.PartLot[0].MfgBatch       = pd.MBatch;
                dsLotSelectUpdate.PartLot[0].MfgLot         = pd.MLot;
                dsLotSelectUpdate.PartLot[0].HeatNum        = pd.Heat;
                dsLotSelectUpdate.PartLot[0].FirmWare       = pd.Firm;
                dsLotSelectUpdate.PartLot[0].BestBeforeDt   = pd.BestBeforeDate;
                dsLotSelectUpdate.PartLot[0].MfgDt          = pd.OrigMfgDate;
                dsLotSelectUpdate.PartLot[0].CureDt         = pd.CureDate;
                dsLotSelectUpdate.PartLot[0].ExpirationDate = pd.ExpireDate;

                svcLotSelectUpdate.Update(ref dsLotSelectUpdate);
                rtnFlag = true;
            }
            catch (Exception ex)
            {
                //throw new Exception($"Epicor Error : {ex.Message.ToString()}");
                rtnFlag = false;
                LogErrorDetails("LotAttributeTbl", pd.LA_Id, ex.Message.ToString(), "POReceipt->CreateLotAttribute");
                UpdateProcessStatus(pd.id, Constants.StatusCode.ERR, "", 0);
            }
            return(rtnFlag);
        }
        public bool CreateLotAttribute(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, string LotNum, string Company, string Plant, string PartNum)
        {
            bool rtnFlag = false;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/LotSelectUpdate.svc";
                svcLotSelectUpdate.LotSelectUpdateSvcContractClient svcLotSelectUpdate = GetClient <svcLotSelectUpdate.LotSelectUpdateSvcContractClient, svcLotSelectUpdate.LotSelectUpdateSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                svcLotSelectUpdate.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcLotSelectUpdate.LotSelectUpdateTableset dsLotSelectUpdate = new svcLotSelectUpdate.LotSelectUpdateTableset();
                svcLotSelectUpdate.GetNewPartLot(ref dsLotSelectUpdate, PartNum); // <<--

                dsLotSelectUpdate.PartLot[0].LotNum = LotNum;

                //dsLotSelectUpdate.PartLot[0].Batch = pd.Batch;

                //dsLotSelectUpdate.PartLot[0].MfgBatch = pd.MBatch;
                //dsLotSelectUpdate.PartLot[0].MfgLot = pd.MLot;
                //dsLotSelectUpdate.PartLot[0].HeatNum = pd.Heat;
                //dsLotSelectUpdate.PartLot[0].FirmWare = pd.Firm;
                //dsLotSelectUpdate.PartLot[0].BestBeforeDt = pd.BestBeforeDate;
                //dsLotSelectUpdate.PartLot[0].MfgDt = pd.OrigMfgDate;
                //dsLotSelectUpdate.PartLot[0].CureDt = pd.CureDate;
                //dsLotSelectUpdate.PartLot[0].ExpirationDate = pd.ExpireDate;

                svcLotSelectUpdate.Update(ref dsLotSelectUpdate);
                rtnFlag = true;
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
            return(rtnFlag);
        }