コード例 #1
0
        string authoriseProject(SOOrder sOOrder)
        {
            string result  = "";
            string transID = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                PLNSC.ProjectService.OperationContext projectOperationContext = new PLNSC.ProjectService.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance,
                    transaction  = transID
                };

                ProjectService projectService = new ProjectService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}ProjectService"
                };

                ProjectServiceAuthoriseRequestDTO projectServiceAuthoriseRequestDTO = new ProjectServiceAuthoriseRequestDTO()
                {
                    authsdBy  = "ADMIN",
                    projectNo = sOOrder.OrderNbr.Trim()
                };

                ProjectServiceAuthoriseReplyDTO projectServiceAuthoriseReplyDTO = projectService.authorise(projectOperationContext, projectServiceAuthoriseRequestDTO);

                PLNSC.ProjectService.WarningMessageDTO[] authErrors = projectServiceAuthoriseReplyDTO.warningsAndInformation;

                if (authErrors.Length > 0)
                {
                    result = authErrors[0].message;
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                }
                else
                {
                    result = "OK";
                    transContext.transaction = transID;
                    transactionService.commit(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(result);
        }
コード例 #2
0
        string recordProjectActuals(SOOrder sOOrder)
        {
            string result  = "";
            string transID = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                string raisedDate = (sOOrder.OrderDate ?? DateTime.Now).ToString("yyyyMMdd");

                PLNSC.ProjectService.OperationContext projectOperationContext = new PLNSC.ProjectService.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance,
                    transaction  = transID
                };

                ProjectService projectService = new ProjectService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}ProjectService"
                };

                ProjectServiceActualsRequestDTO projectServiceActualsRequestDTO = new ProjectServiceActualsRequestDTO()
                {
                    actualStrDate = raisedDate,
                    districtCode  = "SC01",
                    projectNo     = sOOrder.OrderNbr.Trim()
                };

                ProjectServiceActualsReplyDTO            projectServiceActualsReplyDTO = projectService.actuals(projectOperationContext, projectServiceActualsRequestDTO);
                PLNSC.ProjectService.WarningMessageDTO[] actualErrors = projectServiceActualsReplyDTO.warningsAndInformation;
                if (actualErrors.Length > 0)
                {
                    result = actualErrors[0].message;
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                }
                else
                {
                    result = "OK";
                    transContext.transaction = transID;
                    transactionService.commit(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(result);
        }
コード例 #3
0
        string createProjectEstimate(SOOrder sOOrder)
        {
            string transID = "";
            string result  = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                EPEmployee ePEmployee = PXSelect <EPEmployee, Where <EPEmployee.userID, Equal <Required <EPEmployee.userID> > > > .Select(Base, sOOrder.OwnerID);

                string estimatorId = ePEmployee != null ? ePEmployee.AcctCD : "ADMIN";

                ProjectEstimateService projectEstimateService = new ProjectEstimateService()
                {
                    Timeout = transactionService.Timeout,
                    Url     = $"{urlPrefix(dbName)}ProjectEstimateService"
                };

                PLNSC.ProjectEstimateRef.OperationContext projectEstimateOperationContext = new PLNSC.ProjectEstimateRef.OperationContext()
                {
                    district     = transContext.district,
                    position     = transContext.position,
                    maxInstances = transContext.maxInstances
                };

                //ProjectEstimateDTO[] projectEstimateDTOs = new ProjectEstimateDTO[1];
                ProjectEstimateDTO projectEstimateDTO = new ProjectEstimateDTO()
                {
                    districtCode                       = transContext.district,
                    projectNo                          = sOOrder.OrderNbr.Trim(),
                    estimateBuildMethod                = "T",
                    estimatorId                        = estimatorId,
                    directEstimateCost                 = Math.Round(sOOrder.OrderTotal ?? 0, 2),
                    directEstimateCostSpecified        = true,
                    directUnallocFinPeriodEst          = Math.Round(sOOrder.OrderTotal ?? 0, 2),
                    directUnallocFinPeriodEstSpecified = true,
                    estimateSpreadCode                 = "A",
                    budgetCode                         = "RAB"
                };
                ProjectEstimateServiceResult projectEstimateServiceResult = projectEstimateService.update(projectEstimateOperationContext, projectEstimateDTO);
                //ProjectEstimateServiceResult[] projectEstimateServiceResults = projectEstimateService.multipleUpdate(projectEstimateOperationContext, projectEstimateDTOs);

                //ProjectEstimateServiceResult projectEstimateServiceResult = projectEstimateServiceResults[0];

                Error[] errors = projectEstimateServiceResult.errors;

                if (errors.Length > 0)
                {
                    result = errors[0].messageText.Trim();
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                }
                else
                {
                    result = "OK";
                    transContext.transaction = transID;
                    transactionService.commit(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(result);
        }
コード例 #4
0
        string modifyProjectRefCodes(SOOrder sOOrder)
        {
            string transID = "";
            string result  = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                BAccount2 customer = PXSelect <BAccount2,
                                               Where <BAccount2.bAccountID, Equal <Required <BAccount2.bAccountID> >,
                                                      And <BAccount2.defLocationID, Equal <Required <BAccount2.defLocationID> >,
                                                           And <BAccount.type, Equal <Required <BAccount.type> > > > > > .Select(Base, sOOrder.CustomerID, sOOrder.CustomerLocationID, "CU");

                string custCD = customer.AcctCD.Trim();

                PLNSC.RefCodesRef.OperationContext refCodesOperation = new PLNSC.RefCodesRef.OperationContext()
                {
                    district     = transContext.district,
                    position     = transContext.position,
                    maxInstances = transContext.maxInstances
                };

                RefCodesService refCodesService = new RefCodesService()
                {
                    Timeout = transactionService.Timeout,
                    Url     = $"{urlPrefix(dbName)}RefCodesService"
                };

                RefCodesServiceModifyRequestDTO refCodesServiceModifyRequestDTO = new RefCodesServiceModifyRequestDTO()
                {
                    entityType  = "PRJ",
                    entityValue = transContext.district.Trim() + sOOrder.OrderNbr.Trim(),
                    refNo       = "001",
                    seqNum      = "001",
                    refCode     = sOOrder.CustomerOrderNbr.Trim()
                };

                RefCodesServiceModifyReplyDTO         refCodesServiceModifyReplyDTO = refCodesService.modify(refCodesOperation, refCodesServiceModifyRequestDTO);
                PLNSC.RefCodesRef.WarningMessageDTO[] refCodesErrors = refCodesServiceModifyReplyDTO.warningsAndInformation;
                if (refCodesErrors.Length > 0)
                {
                    result = refCodesErrors[0].message;
                    transactionService.rollback(transContext);
                }
                else
                {
                    if (sOOrder.CustomerID != null)
                    {
                        RefCodesServiceModifyRequestDTO refCodesServiceModifyRequestDTO2 = new RefCodesServiceModifyRequestDTO()
                        {
                            entityType  = "PRJ",
                            entityValue = transContext.district.Trim() + sOOrder.OrderNbr.Trim(),
                            refNo       = "002",
                            seqNum      = "001",
                            refCode     = custCD
                        };

                        RefCodesServiceModifyReplyDTO         refCodesServiceModifyReplyDTO2 = refCodesService.modify(refCodesOperation, refCodesServiceModifyRequestDTO2);
                        PLNSC.RefCodesRef.WarningMessageDTO[] refCodesErrors2 = refCodesServiceModifyReplyDTO2.warningsAndInformation;
                        if (refCodesErrors2.Length > 0)
                        {
                            result = refCodesErrors2[0].message;
                            transContext.transaction = transID;
                            transactionService.rollback(transContext);
                        }
                        else
                        {
                            result = "OK";
                            transContext.transaction = transID;
                            transactionService.commit(transContext);
                        }
                    }
                    else
                    {
                        result = "OK";
                        transContext.transaction = transID;
                        transactionService.commit(transContext);
                    }
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(result);
        }
コード例 #5
0
        string finalizeEllipseProject(string sONbr)
        {
            string result  = string.Empty;
            string transID = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                ProjectService projectService = new ProjectService()
                {
                    Timeout = transactionService.Timeout,
                    Url     = $"{urlPrefix(dbName)}ProjectService"
                };

                PLNSC.ProjectService.OperationContext projectServiceContext = new PLNSC.ProjectService.OperationContext()
                {
                    district     = transContext.district,
                    position     = transContext.position,
                    maxInstances = transContext.maxInstances
                };

                //ProjectEstimateDTO[] projectEstimateDTOs = new ProjectEstimateDTO[1];
                ProjectServiceFinaliseRequestDTO projectServiceFinaliseRequestDTO = new ProjectServiceFinaliseRequestDTO()
                {
                    districtCode = transContext.district,
                    projectNo    = sONbr.Trim(),
                    finalCostInd = "Y"
                };
                ProjectServiceFinaliseReplyDTO projectServiceFinaliseReplyDTO = projectService.finalise(projectServiceContext, projectServiceFinaliseRequestDTO);
                //ProjectEstimateServiceResult[] projectEstimateServiceResults = projectEstimateService.multipleUpdate(projectEstimateOperationContext, projectEstimateDTOs);

                //ProjectEstimateServiceResult projectEstimateServiceResult = projectEstimateServiceResults[0];

                PLNSC.ProjectService.WarningMessageDTO[] errors = projectServiceFinaliseReplyDTO.warningsAndInformation;

                if (errors.Length > 0)
                {
                    result = errors[0].message.Trim();
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                }
                else
                {
                    result = "OK";
                    transContext.transaction = transID;
                    transactionService.commit(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return(result);
        }
コード例 #6
0
        string actualEffort(string sONbr)
        {
            string result  = string.Empty;
            string transID = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                ProjectService projectService = new ProjectService()
                {
                    Timeout = transactionService.Timeout,
                    Url     = $"{urlPrefix(dbName)}ProjectService"
                };

                PLNSC.ProjectService.OperationContext projectServiceContext = new PLNSC.ProjectService.OperationContext()
                {
                    district     = transContext.district,
                    position     = transContext.position,
                    maxInstances = transContext.maxInstances
                };

                ProjectServiceReadRequestDTO projectServiceReadRequestDTO = new ProjectServiceReadRequestDTO()
                {
                    districtCode = transContext.district,
                    projectNo    = sONbr.Trim()
                };

                ProjectServiceReadReplyDTO projectServiceReadReplyDTO = projectService.read(projectServiceContext, projectServiceReadRequestDTO);
                PLNSC.ProjectService.WarningMessageDTO[] errorRead    = projectServiceReadReplyDTO.warningsAndInformation;
                if (errorRead.Length > 0)
                {
                    result = errorRead[0].message.Trim();
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                    return(result);
                }

                string actStrDate = projectServiceReadReplyDTO.actualStrDate;

                ProjectServiceActualsRequestDTO projectServiceActualsRequestDTO = new ProjectServiceActualsRequestDTO()
                {
                    districtCode  = transContext.district,
                    projectNo     = sONbr.Trim(),
                    actualStrDate = actStrDate,
                    actualFinDate = DateTime.Now.ToString("yyyyMMdd")
                };
                ProjectServiceActualsReplyDTO projectServiceActualReplyDTO = projectService.actuals(projectServiceContext, projectServiceActualsRequestDTO);

                PLNSC.ProjectService.WarningMessageDTO[] errors = projectServiceActualReplyDTO.warningsAndInformation;

                if (errors.Length > 0)
                {
                    result = errors[0].message.Trim();
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                    return(result);
                }
                else
                {
                    result = "OK";
                    transContext.transaction = transID;
                    transactionService.commit(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return(result);
        }
コード例 #7
0
        string modifyPOCostAlloc(POOrder pOOrder, POLine pOLine, int purchaseMethod, string nonCoreDO)
        {
            string result    = "";
            string projectNo = "";

            if (nonCoreDO != string.Empty)
            {
                projectNo = nonCoreDO;
            }
            else
            {
                SOLineSplit sOLineSplit = PXSelect <SOLineSplit, Where <SOLineSplit.pONbr, Equal <Required <SOLineSplit.pONbr> > > > .Select(Base, pOOrder.OrderNbr);

                if (sOLineSplit != null)
                {
                    projectNo = sOLineSplit.OrderNbr.Trim();
                }
                else
                {
                    RQRequisitionOrder rQRequisitionOrder = PXSelect <RQRequisitionOrder,
                                                                      Where <RQRequisitionOrder.orderNbr, Equal <Required <RQRequisitionOrder.orderNbr> >,
                                                                             And <RQRequisitionOrder.orderCategory, Equal <RQOrderCategory.po> > > > .Select(Base, pOOrder.OrderNbr);

                    if (rQRequisitionOrder != null)
                    {
                        string             reqNbr = rQRequisitionOrder.ReqNbr;
                        RQRequisitionOrder poReq  = PXSelect <RQRequisitionOrder,
                                                              Where <RQRequisitionOrder.reqNbr, Equal <Required <RQRequisitionOrder.reqNbr> >,
                                                                     And <RQRequisitionOrder.orderCategory, Equal <RQOrderCategory.so>,
                                                                          And <RQRequisitionOrder.orderType, Equal <SOOrderTypeConstants.salesOrder> > > > > .Select(Base, reqNbr);

                        if (poReq != null)
                        {
                            projectNo = poReq.OrderNbr.Trim();
                        }
                    }
                }
            }


            PLNSC.ScreenService.OperationContext screenContext = new PLNSC.ScreenService.OperationContext()
            {
                district     = "SC01",
                position     = "INTPO",
                maxInstances = 1
            };

            ScreenService screenService = new ScreenService()
            {
                Timeout = sessionTimeout,
                Url     = $"{urlPrefix(dbName)}ScreenService"
            };
            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            bool   loggedIn      = false;
            bool   modifyFlag    = false;
            string screenName    = "";
            string errMess       = "";
            string currentCursor = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                loggedIn = true;
            }
            catch (Exception ex)
            {
                loggedIn = false;
                result   = ex.Message.Trim();
                throw new PXException(ex.Message);
            }

            if (loggedIn)
            {
                try
                {
                    screenReply = screenService.executeScreen(screenContext, "MSO230");
                    screenName  = screenReply.mapName;
                    if (screenName != "MSM230A")
                    {
                        result = CustomMessage.NotMSM220A;
                        throw new PXException(CustomMessage.NotMSM220A);
                    }
                    ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                    fields[0].fieldName = "OPTION1I";
                    fields[0].value     = "5";
                    fields[1].fieldName = "PREQ_NO1I";
                    fields[1].value     = pOLine.RQReqNbr;

                    submitRequest.screenFields = fields;

                    submitRequest.screenKey = "1"; // OK
                    screenReply             = screenService.submit(screenContext, submitRequest);
                    screenName = screenReply.mapName;
                    errMess    = screenReply.message;

                    if (errMess.Trim() != "")
                    {
                        result = errMess.Trim();
                        throw new PXException(errMess.Trim());
                    }

                    if (screenName == "MSM232A")
                    {
                        ScreenFieldDTO[] screenReplyFields = screenReply.screenFields;
                        foreach (ScreenFieldDTO screenFieldDto in screenReplyFields)
                        {
                            if (screenFieldDto.fieldName == "WO_PROJECT1I1")
                            {
                                if (screenFieldDto.value != null)
                                {
                                    if (screenFieldDto.value.Trim() != "")
                                    {
                                        return("OK");
                                    }
                                }
                            }
                        }

                        ScreenNameValueDTO[] fields232A = { new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                        fields232A[0].fieldName = "WO_PROJECT1I1";
                        fields232A[0].value     = projectNo;
                        fields232A[1].fieldName = "PROJECT_IND1I1";
                        fields232A[1].value     = "P";

                        submitRequest.screenFields = fields232A;

                        submitRequest.screenKey = "1"; // OK
                        screenReply             = screenService.submit(screenContext, submitRequest);
                        screenName = screenReply.mapName;
                        errMess    = screenReply.message;

                        if (errMess.Trim() != "" && !screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            result = errMess.Trim();
                            throw new PXException(errMess.Trim());
                        }

                        if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            submitRequest.screenKey = "1"; // OK
                            screenReply             = screenService.submit(screenContext, submitRequest);
                        }

                        screenName = screenReply.mapName;
                        errMess    = screenReply.message;

                        if (errMess.Trim() != "" && !screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            result = errMess.Trim();
                            throw new PXException(errMess.Trim());
                        }
                        else
                        {
                            result = "OK";
                            screenService.positionToMenu(screenContext);
                        }
                    }
                }
                catch (Exception ex)
                {
                    screenService.positionToMenu(screenContext);
                    throw new PXException(ex.Message);
                }
            }

            return(result);
        }
コード例 #8
0
        string receiptPOGoods(POReceipt pOReceipt, string pONbr, List<POReceiptLine> receiptLines)
        {
            string result = "";
            string transID = "";

            bool isOverSupply = false;

            try
            {
                ClientConversation.authenticate(userName, password);

                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url = $"{urlPrefix(dbName)}TransactionService"
                };

                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district = districtCode,
                    position = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                ReceiptDocumentService receipt = new ReceiptDocumentService()
                {
                    Timeout = sessionTimeout,
                    Url = $"{urlPrefix(dbName)}ReceiptDocumentService"
                };

                PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemService receiptPurchaseOrderItemService = new PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemService()
                {
                    Timeout = sessionTimeout,
                    Url = $"{urlPrefix(dbName)}ReceiptPurchaseOrderItemService"
                };

                PLNSC.ReceiptPurchaseOrderItemRef.OperationContext receiptPOItemContext = new PLNSC.ReceiptPurchaseOrderItemRef.OperationContext()
                {
                    district = transContext.district,
                    position = transContext.position,
                    maxInstances = transContext.maxInstances,
                    returnWarnings = transContext.returnWarnings,
                    trace = transContext.trace,
                    transaction = transID
                };

                PLNSC.ReceiptDocumentService.OperationContext receiptContext = new PLNSC.ReceiptDocumentService.OperationContext()
                {
                    district = transContext.district,
                    position = transContext.position,
                    maxInstances = transContext.maxInstances,
                    returnWarnings = transContext.returnWarnings,
                    trace = transContext.trace,
                    transaction = transID
                };

                var userID = PXAccess.GetUserID();
                EPEmployee ePEmployee = PXSelect<EPEmployee, Where<EPEmployee.userID, Equal<Required<EPEmployee.userID>>>>.Select(Base, PXAccess.GetUserID());
                string receivedByUser = ePEmployee.AcctCD.Trim() ?? "ADMIN";

                PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemSearchParam receiptPurchaseOrderItemSearchParam = new PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemSearchParam()
                {
                    documentDistrictCode = "SC01",
                    documentNumber = pONbr,
                    documentTypeDescription = "POP",
                    isReceiveAll = false
                };

                PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemDTO restartParam = new PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemDTO()
                {
                    documentNumber = "",
                    documentDistrictCode = "",
                    documentItem = "",
                    documentTypeDescription = "",
                    receiptDocumentType = ""
                };

                PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemServiceResult[] searchResult = receiptPurchaseOrderItemService.search(receiptPOItemContext, receiptPurchaseOrderItemSearchParam, restartParam);

                if (searchResult.Length > 0)
                {
                    PLNSC.ReceiptPurchaseOrderItemRef.Error[] searchErrors = searchResult[0].errors;
                    PLNSC.ReceiptPurchaseOrderItemRef.Message[] searchMsg = searchResult[0].informationalMessages;
                    if (searchErrors.Length > 0)
                    {
                        result = searchErrors[0].messageText;
                        transContext.transaction = transID;
                        transactionService.rollback(transContext);
                        return result;
                    }
                    
                    ReceiptPurchaseOrderItemDTO[] requestItem = new ReceiptPurchaseOrderItemDTO[searchResult.Length];
                    int arrIndex = 0;
                    foreach (PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemServiceResult receiptPurchaseOrderItemServiceResult in searchResult)
                    {
                        PLNSC.ReceiptPurchaseOrderItemRef.ReceiptPurchaseOrderItemDTO lineReceipt = receiptPurchaseOrderItemServiceResult.receiptPurchaseOrderItemDTO;

                        string testPOReceiptLine = Right("000" + lineReceipt.documentItem.Trim(), 3);
                        string receiptLine = lineReceipt.documentNumber != null ? testPOReceiptLine : "001";
                        decimal receiptQty = 0;
                        pONbr = lineReceipt.documentNumber != null ? lineReceipt.documentNumber.Trim() : " ";

                        foreach (POReceiptLine pOReceiptLine in receiptLines)
                        {
                            string poNbr = pOReceiptLine.PONbr.Trim();
                            string poLine = Right("000" + pOReceiptLine.POLineNbr.ToString(), 3);
                            if (poNbr == pONbr && poLine == receiptLine)
                            {
                                receiptQty = pOReceiptLine.ReceiptQty ?? 0;
                                decimal origOrderQty = pOReceiptLine.OrigOrderQty ?? 0;
                                decimal openOrderQty = pOReceiptLine.OpenOrderQty ?? 0;
                                decimal outstandingQty = openOrderQty != 0 ? openOrderQty : origOrderQty;
                                if (receiptQty > outstandingQty)
                                {
                                    isOverSupply = true;
                                }
                                else
                                {
                                    isOverSupply = false;
                                }
                            }
                        }

                        requestItem[arrIndex] = new ReceiptPurchaseOrderItemDTO()
                        {
                            documentNumber = lineReceipt.documentNumber.Trim() ?? " ",
                            custodianId = lineReceipt.custodianId.Trim() ?? " ",
                            documentItem = receiptLine,
                            receiptQuantity = receiptQty,
                            receiptQuantitySpecified = true,
                            documentTypeDescription = lineReceipt.documentTypeDescription.Trim() ?? " ",
                            documentType = lineReceipt.documentType.Trim() ?? " ",
                            deliveryLocation = lineReceipt.deliveryLocation.Trim() ?? " ",
                            isReceive = true,
                            isReceiveSpecified = true,
                            isCompleteItem = false,
                            isCompleteItemSpecified = true,
                            isOverSupplyItem = isOverSupply,
                            isOverSupplyItemSpecified = true,
                            isBinCodeDisabled = lineReceipt.isBinCodeDisabled,
                            isBinCodeDisabledSpecified = true,
                            isCategoryCodeDisabled = lineReceipt.isCategoryCodeDisabled,
                            isCategoryCodeDisabledSpecified = true,
                            receiptDocumentType = lineReceipt.receiptDocumentType.Trim() ?? " ",
                            receivingDistrictCode = lineReceipt.receivingDistrictCode.Trim() ?? " ",
                            receivingWarehouseId = lineReceipt.receivingWarehouseId.Trim() ?? " ",
                            requestedByEmployeeId = receivedByUser,
                            purchaseRequisition = lineReceipt.purchaseRequisition.Trim() ?? " ",
                            unitOfPurchase = lineReceipt.unitOfPurchase.Trim() ?? " ",
                            unitOfIssueOutstanding = lineReceipt.unitOfIssueOutstanding,
                            unitOfIssueOutstandingSpecified = true,
                            unitOfMeasure = lineReceipt.unitOfMeasure.Trim() ?? " ",
                            unitOfPurchaseOutstanding = lineReceipt.unitOfPurchaseOutstanding,
                            unitOfPurchaseOutstandingSpecified = true
                        };
                        arrIndex += 1;
                    }

                    ReceiptDocumentDTO request = new ReceiptDocumentDTO()
                    {
                        documentNumber = pONbr,
                        receiptReference = "G-" + pOReceipt.ReceiptNbr.Trim() + "RC",
                        receiptPurchaseOrderItemDTOs = requestItem,
                        receiptDate = DateTime.Now,
                        receiptDateSpecified = true,
                        isReceiveAll = false,
                        isReceiveAllSpecified = true,
                        receivedBy = receivedByUser,
                        receivedByPosition = "INTPO",
                        receivingDistrictCode = "SC01",
                        documentDistrictCode = "SC01",
                        documentTypeDescription = "POP"
                    };

                    ReceiptDocumentServiceResult receiptDocumentServiceResult = receipt.update(receiptContext, request);
                    PLNSC.ReceiptDocumentService.Error[] updErrors = receiptDocumentServiceResult.errors;
                    PLNSC.ReceiptDocumentService.Message[] updMessages = receiptDocumentServiceResult.informationalMessages;

                    if (updErrors.Length > 0)
                    {
                        result = updErrors[0].messageText;
                        transContext.transaction = transID;
                        transactionService.rollback(transContext);
                    }
                    else
                    {
                        result = "OK";
                        transContext.transaction = transID;
                        transactionService.commit(transContext);
                    }
                }
                else
                {
                    return "No Item To receive or All Item has already been received";
                }
                //ReceiptPurchaseOrderItemDTO[] requestItem = new ReceiptPurchaseOrderItemDTO[receiptLines.Count];
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return result;
        }
コード例 #9
0
        public virtual IEnumerable createPO(POOrder pOOrder, POLine pOLine)
        {
            RQRequisitionOrder rQRequisitionOrder = PXSelect <RQRequisitionOrder,
                                                              Where <RQRequisitionOrder.orderNbr, Equal <Required <RQRequisitionOrder.orderNbr> >,
                                                                     And <RQRequisitionOrder.orderCategory, Equal <RQOrderCategory.po> > > > .Select(Base, pOOrder.OrderNbr);

            RQRequisition rQRequisition = PXSelect <RQRequisition, Where <RQRequisition.reqNbr, Equal <Required <RQRequisitionOrder.reqNbr> > > > .Select(Base, rQRequisitionOrder.ReqNbr);

            RQRequisitionExt rQRequisitionExt = rQRequisition.GetExtension <RQRequisitionExt>();

            int    purchaseMethod = rQRequisition != null ? rQRequisitionExt.UsrPurchMethod ?? 2 : 2;
            string nonCoreDO      = rQRequisition != null ? rQRequisitionExt.UsrDONbr != null?rQRequisitionExt.UsrDONbr.Trim() : string.Empty : string.Empty;

            string modifyPRResult = string.Empty;

            if (purchaseMethod != 2)
            {
                modifyPRResult = modifyPOCostAlloc(pOOrder, pOLine, purchaseMethod, nonCoreDO);
                if (!modifyPRResult.Trim().Contains("OK"))
                {
                    return(modifyPRResult.Trim());
                }
            }

            PLNSC.ScreenService.OperationContext screenContext = new PLNSC.ScreenService.OperationContext()
            {
                district     = "SC01",
                position     = "INTPO",
                maxInstances = 1
            };

            ScreenService screenService = new ScreenService()
            {
                Timeout = sessionTimeout,
                Url     = $"{urlPrefix(dbName)}ScreenService"
            };
            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            bool   loggedIn      = false;
            bool   modifyFlag    = false;
            string screenName    = "";
            string errMess       = "";
            string currentCursor = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                loggedIn = true;
            }
            catch (Exception ex)
            {
                loggedIn = false;
                throw new PXException(ex.Message);
            }

            if (loggedIn)
            {
                try
                {
                    screenReply = screenService.executeScreen(screenContext, "MSO230");
                    screenName  = screenReply.mapName;
                    if (screenName != "MSM230A")
                    {
                        throw new PXException(CustomMessage.NotMSO230);
                    }
                    ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                    fields[0].fieldName = "OPTION1I";
                    fields[0].value     = "3";
                    fields[1].fieldName = "PREQ_NO1I";
                    fields[1].value     = pOLine.RQReqNbr;
                    fields[2].fieldName = "PREQ_ITEM_NO1I";
                    fields[2].value     = pOLine.RQReqLineNbr.ToString();

                    submitRequest.screenFields = fields;

                    submitRequest.screenKey = "1"; // OK
                    screenReply             = screenService.submit(screenContext, submitRequest);
                    screenName = screenReply.mapName;
                    errMess    = screenReply.message;

                    if (errMess.Trim() != "")
                    {
                        throw new PXException(errMess.Trim());
                    }

                    if (screenName == "MSM23EA")
                    {
                        ScreenFieldDTO[] screenFieldDTOs = screenReply.screenFields;
                        foreach (ScreenFieldDTO screenFieldDTO in screenFieldDTOs)
                        {
                            String fieldName  = screenFieldDTO.fieldName;
                            String preqItemNo = "";
                            if (fieldName == "PREQ_ITEM_NO1I")
                            {
                                preqItemNo = screenFieldDTO.value;
                            }
                        }

                        ScreenNameValueDTO[] field23E = new ScreenNameValueDTO[5];
                        field23E[0]           = new ScreenNameValueDTO();
                        field23E[0].fieldName = "PO_NO1I";
                        field23E[0].value     = pOOrder.OrderNbr.Trim();

                        field23E[1]           = new ScreenNameValueDTO();
                        field23E[1].fieldName = "PO_ITEM1I";
                        field23E[1].value     = pOLine.LineNbr.ToString();

                        field23E[2]           = new ScreenNameValueDTO();
                        field23E[2].fieldName = "PROCESS_ITEM1I";
                        field23E[2].value     = "L";

                        field23E[3]           = new ScreenNameValueDTO();
                        field23E[3].fieldName = "ORDER_DATE1I";
                        field23E[3].value     = DateTime.Now.ToString("yyyyMMdd");

                        field23E[4]           = new ScreenNameValueDTO();
                        field23E[4].fieldName = "PURCH_OFFICER1I";
                        field23E[4].value     = "ADMIN";

                        submitRequest.screenFields = field23E;

                        submitRequest.screenKey = "1"; // OK
                        screenReply             = screenService.submit(screenContext, submitRequest);

                        if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            submitRequest.screenKey = "1"; // OK
                            screenReply             = screenService.submit(screenContext, submitRequest);
                        }

                        screenName    = screenReply.mapName;
                        errMess       = screenReply.message;
                        currentCursor = screenReply.currentCursorFieldName;

                        if (errMess.Trim() != "" && !screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            throw new PXException(errMess.Trim());
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new PXException(e.Message);
                }
            }

            return(null);
        }
コード例 #10
0
        public virtual IEnumerable modifyPO(POOrder pOOrder, POLine pOLine)
        {
            PLNSC.ScreenService.OperationContext screenContext = new PLNSC.ScreenService.OperationContext()
            {
                district     = "SC01",
                position     = "INTPO",
                maxInstances = 1
            };

            ScreenService screenService = new ScreenService()
            {
                Timeout = sessionTimeout,
                Url     = $"{urlPrefix(dbName)}ScreenService"
            };
            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            bool   loggedIn      = false;
            bool   modifyFlag    = false;
            string screenName    = "";
            string errMess       = "";
            string currentCursor = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                loggedIn = true;
            }
            catch (Exception ex)
            {
                loggedIn = false;
                throw new PXException(ex.Message);
            }

            if (loggedIn)
            {
                try
                {
                    screenReply = screenService.executeScreen(screenContext, "MSO220");
                    screenName  = screenReply.mapName;
                    if (screenName != "MSM220A")
                    {
                        throw new PXException(CustomMessage.NotMSM220A);
                    }
                    ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                    fields[0].fieldName = "OPTION1I";
                    fields[0].value     = "1";
                    fields[1].fieldName = "PO_NO1I";
                    fields[1].value     = pOOrder.OrderNbr;
                    fields[2].fieldName = "PO_ITEM_NO1I";
                    fields[2].value     = pOLine.LineNbr.ToString();

                    submitRequest.screenFields = fields;

                    submitRequest.screenKey = "1"; // OK
                    screenReply             = screenService.submit(screenContext, submitRequest);
                    screenName = screenReply.mapName;
                    errMess    = screenReply.message;

                    if (errMess.Trim() != "")
                    {
                        throw new PXException(errMess.Trim());
                    }

                    if (screenName == "MSM22CA")
                    {
                        ScreenFieldDTO[] screenFieldDTOs = screenReply.screenFields;

                        ScreenNameValueDTO[] modifyPOFields = new ScreenNameValueDTO[7];
                        modifyPOFields[0]           = new ScreenNameValueDTO();
                        modifyPOFields[0].fieldName = "GROSS_PR_UOP1I";
                        if (pOLine.LineType == POLineType.GoodsForDropShip || pOLine.LineType == POLineType.GoodsForInventory || pOLine.LineType == POLineType.GoodsForSalesOrder ||
                            pOLine.LineType == POLineType.GoodsForManufacturing || pOLine.LineType == POLineType.GoodsForReplenishment)
                        {
                            modifyPOFields[0].value = Math.Round(pOLine.CuryUnitCost ?? 0, 2).ToString();
                        }
                        else
                        {
                            modifyPOFields[0].value = Math.Round((pOLine.CuryUnitCost ?? 0) * (pOLine.OrderQty ?? 0), 2).ToString();
                        }

                        modifyPOFields[1]           = new ScreenNameValueDTO();
                        modifyPOFields[1].fieldName = "UNIT_OF_ISSUE1I";
                        modifyPOFields[1].value     = pOLine.UOM.Trim();

                        modifyPOFields[2]           = new ScreenNameValueDTO();
                        modifyPOFields[2].fieldName = "CURR_QTY_P1I";
                        if (pOLine.LineType == POLineType.GoodsForDropShip || pOLine.LineType == POLineType.GoodsForInventory || pOLine.LineType == POLineType.GoodsForSalesOrder ||
                            pOLine.LineType == POLineType.GoodsForManufacturing || pOLine.LineType == POLineType.GoodsForReplenishment)
                        {
                            modifyPOFields[2].value = Math.Round(pOLine.OrderQty ?? 0, 2).ToString();
                        }
                        else
                        {
                            modifyPOFields[2].value = string.Empty;
                        }

                        modifyPOFields[3]           = new ScreenNameValueDTO();
                        modifyPOFields[3].fieldName = "UNIT_OF_PURCH1I";
                        modifyPOFields[3].value     = pOLine.UOM.Trim();

                        modifyPOFields[4]           = new ScreenNameValueDTO();
                        modifyPOFields[4].fieldName = "PRICE_CODE1I";
                        modifyPOFields[4].value     = pOOrder.TermsID.Trim();

                        modifyPOFields[5]           = new ScreenNameValueDTO();
                        modifyPOFields[5].fieldName = "DUE_DATE1I";
                        modifyPOFields[5].value     = (pOLine.PromisedDate ?? DateTime.Now).ToString("yyyyMMdd");

                        modifyPOFields[6]           = new ScreenNameValueDTO();
                        modifyPOFields[6].fieldName = "DUE_SITE1I";
                        modifyPOFields[6].value     = (pOLine.PromisedDate ?? DateTime.Now).ToString("yyyyMMdd");

                        submitRequest.screenFields = modifyPOFields;

                        submitRequest.screenKey = "1"; // OK
                        screenReply             = screenService.submit(screenContext, submitRequest);
                        screenName    = screenReply.mapName;
                        errMess       = screenReply.message;
                        currentCursor = screenReply.currentCursorFieldName;

                        if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            submitRequest.screenKey = "1"; // OK
                            screenReply             = screenService.submit(screenContext, submitRequest);
                        }

                        screenName    = screenReply.mapName;
                        errMess       = screenReply.message;
                        currentCursor = screenReply.currentCursorFieldName;

                        if (errMess.Trim() != "" && !screenReply.functionKeys.Contains("XMIT-Confirm"))
                        {
                            throw new PXException(errMess.Trim());
                        }
                    }
                    screenService.positionToMenu(screenContext);
                }
                catch (Exception e)
                {
                    screenService.positionToMenu(screenContext);
                    throw new PXException(e.Message);
                }
            }

            return(null);
        }
コード例 #11
0
        bool reviewPO(POOrder pOOrder)
        {
            bool   result       = false;
            bool   loggedIn     = false;
            string screenName   = "";
            string errorMessage = "";

            PLNSC.ScreenService.OperationContext screenContext = new PLNSC.ScreenService.OperationContext()
            {
                district     = districtCode,
                position     = positionID,
                maxInstances = 1
            };

            ScreenService screenService = new ScreenService()
            {
                Timeout = sessionTimeout,
                Url     = $"{urlPrefix(dbName)}ScreenService"
            };
            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            try
            {
                ClientConversation.authenticate(userName, password);
                loggedIn = true;
            }
            catch (Exception ex)
            {
                loggedIn = false;
                throw new PXException(ex.Message);
            }

            if (loggedIn)
            {
                try
                {
                    ClientConversation.authenticate(userName, password);
                    screenReply = screenService.executeScreen(screenContext, "MSO220");
                    screenName  = screenReply.mapName;

                    if (screenName != "MSM220A")
                    {
                        throw new PXException(CustomMessage.NotMSM221A);
                    }

                    ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                    fields[0].fieldName = "OPTION1I";
                    fields[0].value     = "1";
                    fields[1].fieldName = "PO_NO1I";
                    fields[1].value     = pOOrder.OrderNbr.Trim();

                    submitRequest.screenFields = fields;

                    submitRequest.screenKey = "1"; // OK
                    screenReply             = screenService.submit(screenContext, submitRequest);
                    screenName   = screenReply.mapName;
                    errorMessage = screenReply.message;

                    if (errorMessage.Trim().Contains("PURCHASE ORDER DOES NOT EXIST"))
                    {
                        result = false;
                    }
                    else
                    {
                        result = true;
                    }
                    screenService.positionToMenu(screenContext);
                }
                catch (Exception ex)
                {
                    result = false;
                    throw new PXException(ex.Message);
                }
            }
            return(result);
        }
コード例 #12
0
        string cancelPONonGoods(POReceipt pOReceipt, POReceiptLine pOReceiptLine)
        {
            string result = "";

            PLNSC.ScreenService.OperationContext SSContextClass = new PLNSC.ScreenService.OperationContext()
            {
                district = districtCode,
                position = positionID,
                maxInstances = maxInstance
            };

            ScreenService screenService = new ScreenService()
            {
                Timeout = sessionTimeout,
                Url = $"{urlPrefix(dbName)}ScreenService"
            };

            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            try
            {
                ClientConversation.authenticate(userName, password);

                screenReply = screenService.executeScreen(SSContextClass, "MSO155");
                screenName = screenReply.mapName;

                if (screenName != "MSM155A")
                {
                    throw new PXException(CustomMessage.NotMSO155);
                }

                ScreenNameValueDTO[] fields = {
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO()
                };

                fields[0].fieldName = "OPTION1I";
                fields[0].value = "3";
                fields[1].fieldName = "PO_NO1I";
                fields[1].value = pOReceiptLine.PONbr;
                fields[2].fieldName = "PO_ITEM1I";
                fields[2].value = pOReceiptLine.POLineNbr.ToString();
                fields[3].fieldName = "AUTH_BY1I";
                fields[3].value = "ADMIN";

                submitRequest.screenFields = fields;

                submitRequest.screenKey = "1"; // OK
                screenReply = screenService.submit(SSContextClass, submitRequest);

                screenName = screenReply.mapName;
                errorMsg = screenReply.message;

                if (errorMsg.Trim() != "" && !screenReply.functionKeys.Contains("XMIT-Confirm"))
                {
                    throw new PXException(errorMsg.Trim());
                }

                if (screenName != "MSM156A")
                {
                    throw new PXException(CustomMessage.NotMSM156A);
                }

                ScreenNameValueDTO[] fields156 = {
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO(),
                    new ScreenNameValueDTO()
                };
                string receiptRef = pOReceipt.ReceiptNbr != null ? pOReceipt.ReceiptNbr.Trim() : " ";
                string cancelValue = Math.Round((pOReceiptLine.CuryExtCost * -1) ?? 0, 2).ToString().Trim();
                fields156[0].fieldName = "VALUE_RECVD1I";
                fields156[0].value = cancelValue;
                fields156[1].fieldName = "RECEIPT_REF1I";
                fields156[1].value = "S-" + receiptRef + "RT";
                fields156[2].fieldName = "RECEIPT_DATE1I";
                fields156[2].value = DateTime.Now.ToString("yyyyMMdd");
                fields156[3].fieldName = "ANSWER1I";
                fields156[3].value = "N";

                submitRequest.screenFields = fields156;

                submitRequest.screenKey = "1"; // OK
                screenReply = screenService.submit(SSContextClass, submitRequest);

                screenName = screenReply.mapName;
                errorMsg = screenReply.message;

                if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                {
                    submitRequest.screenKey = "1"; // OK
                    screenReply = screenService.submit(SSContextClass, submitRequest);

                    screenName = screenReply.mapName;
                    errorMsg = screenReply.message;
                }

                screenService.positionToMenu(SSContextClass);

                result = "OK";
            }
            catch (Exception ex)
            {
                result = ex.Message;
                throw new PXException(ex.Message);
            }

            return result;
        }
コード例 #13
0
        string cancelPOGoods(POReceipt pOReceipt, string pONbr, List<POReceiptLine> receiptLines)
        {
            string result = "";
            string transID = "";

            try
            {
                foreach (POReceiptLine pOReceiptLine in receiptLines)
                {
                    ClientConversation.authenticate(userName, password);
                    TransactionService transactionService = new TransactionService()
                    {
                        Timeout = sessionTimeout,
                        Url = $"{urlPrefix(dbName)}TransactionService"
                    };

                    PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                    {
                        district = districtCode,
                        position = positionID,
                        maxInstances = maxInstance
                    };

                    transID = transactionService.begin(transContext);

                    PurchaseOrderReceiptService purchaseOrderReceiptService = new PurchaseOrderReceiptService()
                    {
                        Timeout = sessionTimeout,
                        Url = $"{urlPrefix(dbName)}PurchaseOrderReceiptService"
                    };

                    PLNSC.POReceiptRef.OperationContext cancelPOContext = new PLNSC.POReceiptRef.OperationContext()
                    {
                        district = transContext.district,
                        position = transContext.position,
                        maxInstances = transContext.maxInstances,
                        returnWarnings = transContext.returnWarnings,
                        trace = transContext.trace,
                        transaction = transID
                    };

                    string pOLineNbr = pOReceiptLine.POLineNbr.ToString() ?? string.Empty;

                    PurchaseOrderReceiptSearchParam searchParam = new PurchaseOrderReceiptSearchParam()
                    {
                        purchaseOrderNumber = pOReceiptLine.PONbr,
                        purchaseOrderItemNumber = pOLineNbr
                    };

                    PurchaseOrderReceiptServiceResult[] searchResult = purchaseOrderReceiptService.search(cancelPOContext, searchParam, null);

                    if (searchResult.Length > 0)
                    {
                        for (int j = 0; j < searchResult.Length;j++)
                        {
                            PLNSC.POReceiptRef.Error[] cancelPOErrors = searchResult[j].errors;
                            PLNSC.POReceiptRef.Message[] cancelPOMessages = searchResult[j].informationalMessages;

                            if (cancelPOErrors.Length > 0)
                            {
                                for (int k = 0; k < cancelPOErrors.Length; k++)
                                {
                                    string errorMessage = (k + 1) + ". " + cancelPOErrors[k].messageText;
                                    result += errorMessage;
                                }
                            }
                            PurchaseOrderReceiptDTO purchaseOrderReceiptDTO = searchResult[j].purchaseOrderReceiptDTO;
                            string receiptRef = purchaseOrderReceiptDTO.receiptReference != null ? purchaseOrderReceiptDTO.receiptReference.Trim() : " ";
                            decimal cancelQty = pOReceiptLine.ReceiptQty ?? 0;
                            PurchaseOrderReceiptDTO canceReciptlDTO = new PurchaseOrderReceiptDTO()
                            {
                                purchaseOrderNumber = purchaseOrderReceiptDTO.purchaseOrderNumber,
                                purchaseOrderItemNumber = purchaseOrderReceiptDTO.purchaseOrderItemNumber,
                                receiptReferenceCancel = "G-" + pOReceipt.ReceiptNbr.Trim() + "RT",
                                districtCode = "SC01",
                                cancelledBy = "ADMIN",
                                isOrderComplete = false,
                                isOrderCompleteSpecified = true,
                                custodianId = purchaseOrderReceiptDTO.custodianId,
                                purchaseRequisitionNumber = purchaseOrderReceiptDTO.purchaseRequisitionNumber,
                                cancelQuantity = cancelQty,
                                cancelQuantitySpecified = true,
                                receiptReference = receiptRef,
                                warehouseId = purchaseOrderReceiptDTO.warehouseId != null ? purchaseOrderReceiptDTO.warehouseId.Trim() : "MAIN",
                                changeNumber = purchaseOrderReceiptDTO.changeNumber,
                                correlationId = purchaseOrderReceiptDTO.correlationId,
                                freightCode = purchaseOrderReceiptDTO.freightCode,
                                requisitionDistrict = purchaseOrderReceiptDTO.requisitionDistrict,
                                receivedBy = purchaseOrderReceiptDTO.receivedBy,
                                receiptNumber_2 = purchaseOrderReceiptDTO.receiptNumber_2,
                                quantityNotInvoiced = purchaseOrderReceiptDTO.quantityNotInvoiced,
                                quantityNotInvoicedSpecified = true,

                            };
                            PurchaseOrderReceiptServiceResult purchaseOrderReceiptServiceResult = purchaseOrderReceiptService.cancel(cancelPOContext, canceReciptlDTO);
                            PLNSC.POReceiptRef.Error[] cancelReceiptError = purchaseOrderReceiptServiceResult.errors;
                            if (cancelReceiptError.Length > 0)
                            {
                                result = cancelReceiptError[0].messageText;
                                transContext.transaction = transID;
                                transactionService.rollback(transContext);
                            }
                            else
                            {
                                result = "OK";
                                transContext.transaction = transID;
                                transactionService.commit(transContext);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return result;
        }
コード例 #14
0
        string modifyProject(SOOrder sOOrder)
        {
            int?customerSalesAcctId;
            int?customerSalesSubId;
            int?cogsAcctId;
            int?cogsSubId;
            int?invtAcctId;
            int?invtSubId;
            int?cARAccountID;

            string cogsAcctCd      = "";
            string cogsSubCd       = "";
            string invtAcctCd      = "";
            string invtSubCd       = "";
            string custSalesAcctCD = "";
            string custSalesSubCD  = "";
            string cARAccountCD    = string.Empty;
            string custCD          = "";
            string transID         = "";

            string result = "";

            try
            {
                ClientConversation.authenticate(userName, password);
                TransactionService transactionService = new TransactionService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}TransactionService"
                };
                PLNSC.TransactionRef.OperationContext transContext = new PLNSC.TransactionRef.OperationContext()
                {
                    district     = districtCode,
                    position     = positionID,
                    maxInstances = maxInstance
                };

                transID = transactionService.begin(transContext);

                BAccount2 customer = PXSelect <BAccount2,
                                               Where <BAccount2.bAccountID, Equal <Required <BAccount2.bAccountID> >,
                                                      And <BAccount2.defLocationID, Equal <Required <BAccount2.defLocationID> >,
                                                           And <BAccount.type, Equal <Required <BAccount.type> > > > > > .Select(Base, sOOrder.CustomerID, sOOrder.CustomerLocationID, "CU");

                Location custLocation = PXSelect <Location,
                                                  Where <Location.bAccountID, Equal <Required <Location.bAccountID> >,
                                                         And <Location.locationID, Equal <Required <Location.locationID> > > > > .Select(Base, sOOrder.CustomerID, sOOrder.CustomerLocationID);

                customerSalesAcctId = custLocation.CSalesAcctID;
                customerSalesSubId  = custLocation.CSalesSubID;
                cARAccountID        = custLocation.CARAccountID;

                Account custSalesAccount = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(Base, customerSalesAcctId);

                Account custARAccount = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(Base, cARAccountID);

                Sub custSalesSub = PXSelect <Sub, Where <Sub.subID, Equal <Required <Sub.subID> > > > .Select(Base, customerSalesSubId);

                custSalesAcctCD = custSalesAccount.AccountCD;
                custSalesSubCD  = custSalesSub.SubCD;
                cARAccountCD    = custARAccount.AccountCD;
                custCD          = customer.AcctCD.Trim();

                foreach (SOLine soLine in Base.Transactions.Select(sOOrder.OrderNbr))
                {
                    InventoryItem inventoryItem = PXSelect <InventoryItem,
                                                            Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(Base, soLine.InventoryID);

                    cogsAcctId = inventoryItem.COGSAcctID;
                    cogsSubId  = inventoryItem.COGSSubID;
                    invtAcctId = inventoryItem.InvtAcctID;
                    invtSubId  = inventoryItem.InvtSubID;

                    if (cogsAcctId == null && cogsSubId == null)
                    {
                        throw new PXException(CustomMessage.COGSAccountEmpty);
                    }

                    Account itemInvtAcct = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(Base, invtAcctId);

                    Sub itemInvtSub = PXSelect <Sub, Where <Sub.subID, Equal <Required <Sub.subID> > > > .Select(Base, invtSubId);

                    Account invtCogsAccount = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(Base, cogsAcctId);

                    Sub invtCogsSub = PXSelect <Sub, Where <Sub.subID, Equal <Required <Sub.subID> > > > .Select(Base, cogsSubId);

                    cogsAcctCd = invtCogsAccount.AccountCD;
                    cogsSubCd  = invtCogsSub.SubCD;
                    invtAcctCd = itemInvtAcct.AccountCD;
                    invtSubCd  = itemInvtSub.SubCD;

                    if (cogsAcctId != null && cogsSubId != null)
                    {
                        break;
                    }
                }

                EPEmployee ePEmployee = PXSelect <EPEmployee, Where <EPEmployee.userID, Equal <Required <EPEmployee.userID> > > > .Select(Base, sOOrder.OwnerID);

                string   originatorId         = ePEmployee != null ? ePEmployee.AcctCD : "ADMIN";
                string   stockItemAccount     = custSalesSubCD.Substring(0, 11).Trim() + cogsSubCd.Substring(11, 4).Trim(); // + cogsAcctCd.Trim();
                string   nonStockItemAccount  = cogsSubCd.Trim();                                                           // + cogsAcctCd.Trim();
                string   itemInventoryAccount = invtSubCd.Trim() + invtAcctCd.Trim();
                DateTime actStartDate         = sOOrder.OrderDate ?? DateTime.Now;
                string   raisedDate           = actStartDate.ToString("yyyyMMdd");
                string   planFinishDate       = (sOOrder.RequestDate ?? actStartDate.AddDays(60)).ToString("yyyyMMdd");

                try
                {
                    //ClientConversation.authenticate(userName, password);
                    PLNSC.ProjectService.OperationContext projectOperationContext = new PLNSC.ProjectService.OperationContext()
                    {
                        district     = districtCode,
                        position     = positionID,
                        maxInstances = maxInstance,
                        transaction  = transID
                    };

                    ProjectService projectService = new ProjectService()
                    {
                        Timeout = sessionTimeout,
                        Url     = $"{urlPrefix(dbName)}ProjectService"
                    };

                    ProjectServiceModifyRequestDTO projectRequest = new ProjectServiceModifyRequestDTO()
                    {
                        districtCode       = "SC01",
                        projectNo          = sOOrder.OrderNbr,
                        projDesc           = sOOrder.OrderDesc,
                        originatorId       = originatorId,
                        raisedDate         = raisedDate,
                        planFinDate        = planFinishDate,
                        accountCode        = cARAccountCD,
                        accountCodeEnabled = true
                    };

                    ProjectServiceModifyReplyDTO             projectReply       = projectService.modify(projectOperationContext, projectRequest);
                    PLNSC.ProjectService.WarningMessageDTO[] warningMessageDTOs = projectReply.warningsAndInformation;

                    if (warningMessageDTOs.Length > 0)
                    {
                        result = warningMessageDTOs[0].message;
                        transContext.transaction = transID;
                        transactionService.rollback(transContext);
                    }
                    else
                    {
                        result = "OK";
                        transContext.transaction = transID;
                        transactionService.commit(transContext);
                    }
                }
                catch (Exception ex)
                {
                    result = ex.Message;
                    transContext.transaction = transID;
                    transactionService.rollback(transContext);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(result);
        }
コード例 #15
0
        public virtual IEnumerable createDO(SOOrder sOOrder)
        {
            bool       modifyFlag = false;
            SOOrderExt sOOrderExt = sOOrder.GetExtension <SOOrderExt>();

            if (sOOrder.OrderNbr == null)
            {
                return(null);
            }

            try
            {
                ClientConversation.authenticate(userName, password);
                loggedIn = true;
            }
            catch (Exception ex)
            {
                loggedIn = false;
                throw new PXException(ex.Message);
            }

            if (loggedIn == true)
            {
                string createProjectResult = createProject(sOOrder);
                if (createProjectResult != "OK")
                {
                    if (createProjectResult.Trim().Contains("PROJECT ALREADY EXISTS"))
                    {
                        string modifyProjectResult = modifyProject(sOOrder);
                        modifyFlag = true;
                        if (modifyProjectResult != "OK")
                        {
                            throw new PXException(modifyProjectResult);
                        }
                    }
                    else
                    {
                        throw new PXException(createProjectResult);
                    }
                }

                if (!modifyFlag)
                {
                    string authoriseProjectResult = authoriseProject(sOOrder);
                    if (authoriseProjectResult != "OK")
                    {
                        throw new PXException(authoriseProjectResult);
                    }
                }

                string modifyProjectRefCodesResult = modifyProjectRefCodes(sOOrder);
                if (modifyProjectRefCodesResult != "OK")
                {
                    throw new PXException(modifyProjectRefCodesResult);
                }

                string createProjectEstimateResult = createProjectEstimate(sOOrder);
                if (createProjectEstimateResult != "OK")
                {
                    throw new PXException(createProjectEstimateResult);
                }

                string recordProjectActualsResult = recordProjectActuals(sOOrder);
                if (recordProjectActualsResult != "OK")
                {
                    throw new PXException(recordProjectActualsResult);
                }
            }
            return(null);
        }
コード例 #16
0
        public virtual IEnumerable maintainCustomer(PXCache cache, Customer customer)
        {
            string screenName = "";
            string errMess    = "";
            string customerAcctCD;

            if (customer.AcctCD == null)
            {
                return(null);
            }
            else
            {
                customerAcctCD = customer.AcctCD.Trim();
            }

            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            try
            {
                ClientConversation.authenticate(userName, password);
                ScreenService screenService = new ScreenService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}ScreenService"
                };
                PLNSC.ScreenService.OperationContext screenContext = new PLNSC.ScreenService.OperationContext()
                {
                    district       = districtCode,
                    position       = positionID,
                    maxInstances   = 1,
                    returnWarnings = false,
                    trace          = false
                                     //transaction = transID
                };

                string currencyType = customer.CuryID != null?customer.CuryID.Trim() : "IDR";

                screenReply = screenService.executeScreen(screenContext, "MSO500");
                screenName  = screenReply.mapName;

                if (screenName != "MSM500A")
                {
                    screenService.positionToMenu(screenContext);
                    screenReply = screenService.executeScreen(screenContext, "MSO500");
                    screenName  = screenReply.mapName;
                    if (screenName != "MSM500A")
                    {
                        throw new PXException(CustomMessage.NotMSM500A);
                    }
                }

                ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                fields[0].fieldName = "OPTION1I";
                fields[0].value     = "1";
                fields[1].fieldName = "CUST_NO1I";
                fields[1].value     = customerAcctCD;

                submitRequest.screenFields = fields;

                submitRequest.screenKey = "1"; // OK
                screenReply             = screenService.submit(screenContext, submitRequest);

                screenName = screenReply.mapName;
                errMess    = screenReply.message;

                if (errMess.Trim() != "" && !errMess.Contains("CUSTOMER CODE ALREADY EXISTS"))
                {
                    throw new PXException(errMess.Trim());
                }
                else
                {
                    if (errMess.Contains("CUSTOMER CODE ALREADY EXISTS"))
                    {
                        ScreenNameValueDTO[] fieldsMod = { new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                        fieldsMod[0].fieldName = "OPTION1I";
                        fieldsMod[0].value     = "2";
                        fieldsMod[1].fieldName = "CUST_NO1I";
                        fieldsMod[1].value     = customerAcctCD;

                        submitRequest.screenFields = fieldsMod;

                        submitRequest.screenKey = "1"; // OK
                        screenReply             = screenService.submit(screenContext, submitRequest);

                        screenName = screenReply.mapName;
                        errMess    = screenReply.message;

                        if (errMess.Trim() != "" && !errMess.Contains("CUSTOMER CODE ALREADY EXISTS"))
                        {
                            throw new PXException(errMess.Trim());
                        }
                    }

                    if (screenName == "MSM500B")
                    {
                        BAccount acctCustomer = PXSelect <BAccount,
                                                          Where <BAccount.bAccountID,
                                                                 Equal <Required <BAccount.bAccountID> > > > .Select(Base, customer.BAccountID);

                        Address customerAddress = PXSelect <Address,
                                                            Where <Address.bAccountID, Equal <Required <Address.bAccountID> > > > .Select(Base, customer.BAccountID);

                        Contact contact = PXSelect <Contact,
                                                    Where <Contact.bAccountID, Equal <Required <Contact.bAccountID> > > > .Select(Base, customer.BAccountID);

                        String customerCountry = "";
                        String addressLine1    = "";
                        String addressLine2    = "";

                        String attn  = "";
                        String email = "";
                        String phone = "";

                        if (customerAddress != null)
                        {
                            customerCountry = customerAddress.CountryID.Trim();
                            addressLine1    = customerAddress.AddressLine1.Trim();
                            addressLine2    = customerAddress.AddressLine2 != null?customerAddress.AddressLine2.Trim() : " ";
                        }

                        if (contact != null)
                        {
                            attn = contact.Salutation != null?contact.Salutation.Trim() : " ";

                            email = contact.EMail != null?contact.EMail.Trim() : " ";

                            phone = contact.Phone1 != null?contact.Phone1.Trim() : " ";
                        }

                        if (screenName == "MSM500B")
                        {
                            ScreenNameValueDTO[] fields500B = { new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO() };

                            string customerAcctName = customer.AcctName != null?customer.AcctName.Trim() : " ";

                            fields500B[0].fieldName = "CUST_NAME2I";
                            fields500B[0].value     = customerAcctName;
                            fields500B[1].fieldName = "CURRENCY_TYPE2I";
                            fields500B[1].value     = currencyType;
                            fields500B[2].fieldName = "COUNTRY_CODE2I";
                            fields500B[2].value     = customerCountry;
                            fields500B[3].fieldName = "INV_ADDR_12I";
                            fields500B[3].value     = addressLine1;
                            fields500B[4].fieldName = "INV_ADDR_22I";
                            fields500B[4].value     = addressLine2;
                            fields500B[5].fieldName = "INV_CONTACT2I";
                            fields500B[5].value     = attn;
                            fields500B[6].fieldName = "INV_PHONE2I";
                            fields500B[6].value     = phone;

                            submitRequest.screenFields = fields500B;

                            submitRequest.screenKey = "1"; // OK
                            screenReply             = screenService.submit(screenContext, submitRequest);

                            screenName = screenReply.mapName.Trim();
                            errMess    = screenReply.message;

                            if (errMess.Trim() != "" && !errMess.Contains("WARNING: CHECK PRICING CODE CURRENCY IN DISTRICTS"))
                            {
                                throw new PXException(errMess.Trim());
                            }
                            else
                            {
                                if (errMess.Contains("WARNING: CHECK PRICING CODE CURRENCY IN DISTRICTS"))
                                {
                                    submitRequest.screenKey = "1"; // OK
                                    screenReply             = screenService.submit(screenContext, submitRequest);
                                    screenName = screenReply.mapName.Trim();
                                    errMess    = screenReply.message;
                                }
                            }

                            if (screenName == "MSM500D")
                            {
                                ScreenNameValueDTO[] fields500D = { new ScreenNameValueDTO() };
                                fields500D[0].fieldName = "EMAIL_ADDRESS4I1";
                                fields500D[0].value     = email;

                                submitRequest.screenFields = fields500D;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    throw new PXException(errMess.Trim());
                                }

                                if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                                {
                                    submitRequest.screenKey = "1"; // OK
                                    screenReply             = screenService.submit(screenContext, submitRequest);
                                }

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    throw new PXException(errMess.Trim());
                                }

                                if (screenName == "MSM500C")
                                {
                                    ScreenNameValueDTO[] fields500C = new ScreenNameValueDTO[9];

                                    fields500C[0] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "PMT_METH_IND3I",
                                        value     = "C"
                                    };

                                    fields500C[1] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "CR_TERMS3I",
                                        value     = "U"
                                    };

                                    fields500C[2] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "SECURED3I",
                                        value     = "N"
                                    };

                                    fields500C[3] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "STMT_REQ_SW3I",
                                        value     = "Y"
                                    };

                                    fields500C[4] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "INV_MEDIUM_IND3I",
                                        value     = "P"
                                    };

                                    fields500C[5] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "DAYS_GRACE3I",
                                        value     = "5"
                                    };

                                    fields500C[6] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "DAYS_TO_PAY3I",
                                        value     = "30"
                                    };

                                    string customerClass = customer.CustomerClassID;
                                    string acctGrpCode   = "";

                                    if (customerClass != null)
                                    {
                                        customerClass = customerClass.Trim();
                                        switch (customerClass)
                                        {
                                        case "PLN":
                                            acctGrpCode = "0001";
                                            break;

                                        case "IP":
                                            acctGrpCode = "0002";
                                            break;

                                        case "PJB":
                                            acctGrpCode = "0003";
                                            break;

                                        case "OTHERS":
                                            acctGrpCode = "0000";
                                            break;

                                        default:
                                            acctGrpCode = "0000";
                                            break;
                                        }
                                    }

                                    fields500C[7] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "ACCT_GRP_CODE3I",
                                        value     = acctGrpCode
                                    };

                                    fields500C[8] = new ScreenNameValueDTO()
                                    {
                                        fieldName = "STATEMENT_TYPE3I",
                                        value     = "B"
                                    };

                                    submitRequest.screenFields = fields500C;

                                    submitRequest.screenKey = "1"; // OK
                                    screenReply             = screenService.submit(screenContext, submitRequest);

                                    screenName = screenReply.mapName.Trim();
                                    errMess    = screenReply.message;

                                    if (errMess.Trim() != "" && !errMess.Contains("ACCT GROUP CODE ONLY UPDATED IF VALID FOR DISTRICT"))
                                    {
                                        throw new PXException(errMess.Trim());
                                    }

                                    if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                                    {
                                        submitRequest.screenKey = "1"; // OK
                                        screenReply             = screenService.submit(screenContext, submitRequest);
                                        screenName = screenReply.mapName.Trim();
                                        errMess    = screenReply.message;

                                        if (errMess.Trim() != "")
                                        {
                                            throw new PXException(errMess.Trim());
                                        }
                                        else
                                        {
                                            screenService.positionToMenu(screenContext);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } catch (Exception ex)
            {
                throw new PXException(ex.Message);
            }
            return(null);
        }
コード例 #17
0
        public virtual IEnumerable maintainVendor(PXCache cache, Vendor vendor)
        {
            string screenName = "";
            string errMess    = "";

            if (vendor.AcctCD == null)
            {
                return(null);
            }
            string vendorAcctCD = vendor.AcctCD.Trim();
            string currencyType = vendor.CuryID != null?vendor.CuryID.Trim() : "IDR";

            string vendorAcctName = vendor.AcctName != null?vendor.AcctName.Trim() : " ";

            ScreenDTO screenReply = new ScreenDTO();
            ScreenSubmitRequestDTO submitRequest = new ScreenSubmitRequestDTO();

            try
            {
                ClientConversation.authenticate(userName, password);
                ScreenService screenService = new ScreenService()
                {
                    Timeout = sessionTimeout,
                    Url     = $"{urlPrefix(dbName)}ScreenService"
                };
                OperationContext screenContext = new OperationContext()
                {
                    district       = districtCode,
                    position       = positionID,
                    maxInstances   = 1,
                    returnWarnings = false,
                    trace          = false
                };

                screenReply = screenService.executeScreen(screenContext, "MSO200");
                screenName  = screenReply.mapName;

                if (screenName != "MSM200A")
                {
                    screenService.positionToMenu(screenContext);
                    screenReply = screenService.executeScreen(screenContext, "MSO200");
                    screenName  = screenReply.mapName;
                    if (screenName != "MSM200A")
                    {
                        throw new PXException(CustomMessage.NotMSM200A);
                    }
                }

                ScreenNameValueDTO[] fields = { new ScreenNameValueDTO(), new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                fields[0].fieldName = "OPTION1I";
                fields[0].value     = "1";
                fields[1].fieldName = "SUPPLIER_NO1I";
                fields[1].value     = vendorAcctCD;
                fields[2].fieldName = "SUP_STATUS1I";
                fields[2].value     = "N";

                submitRequest.screenFields = fields;

                submitRequest.screenKey = "1";
                screenReply             = screenService.submit(screenContext, submitRequest);

                screenName = screenReply.mapName;
                errMess    = screenReply.message;

                if (errMess.Trim() != "" && !errMess.Contains("SUPPLIER CODE ALREADY EXISTS"))
                {
                    screenService.positionToMenu(screenContext);
                    throw new PXException(errMess.Trim());
                }
                else
                {
                    if (errMess.Contains("SUPPLIER CODE ALREADY EXISTS"))
                    {
                        ScreenNameValueDTO[] fieldsMod = { new ScreenNameValueDTO(), new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                        fieldsMod[0].fieldName = "OPTION1I";
                        fieldsMod[0].value     = "2";
                        fieldsMod[1].fieldName = "SUPPLIER_NO1I";
                        fieldsMod[1].value     = vendorAcctCD;
                        fieldsMod[2].fieldName = "SUP_STATUS1I";
                        fieldsMod[2].value     = string.Empty;

                        submitRequest.screenFields = fieldsMod;

                        submitRequest.screenKey = "1"; // OK
                        screenReply             = screenService.submit(screenContext, submitRequest);

                        screenName = screenReply.mapName;
                        errMess    = screenReply.message;

                        if (errMess.Trim() != "" && !errMess.Contains("SUPPLIER CODE ALREADY EXISTS"))
                        {
                            screenService.positionToMenu(screenContext);
                            throw new PXException(errMess.Trim());
                        }
                    }

                    if (screenName == "MSM200B")
                    {
                        BAccount acctVendor = PXSelect <BAccount,
                                                        Where <BAccount.bAccountID, Equal <Required <BAccount.bAccountID> > > > .Select(Base, vendor.BAccountID);

                        Address vendorAddress = PXSelect <Address,
                                                          Where <Address.bAccountID, Equal <Required <Address.bAccountID> > > > .Select(Base, vendor.BAccountID);

                        Contact contact = PXSelect <Contact,
                                                    Where <Contact.bAccountID, Equal <Required <Contact.bAccountID> > > > .Select(Base, vendor.BAccountID);

                        String vendorCountry = "";
                        String addressLine1  = "";
                        String addressLine2  = "";
                        String addressLine3  = "";
                        string kota          = string.Empty;
                        string zipCode       = string.Empty;

                        String attn  = "";
                        String email = "";
                        String phone = "";

                        if (vendorAddress != null)
                        {
                            vendorCountry = vendorAddress.CountryID.Trim();
                            addressLine1  = vendorAddress.AddressLine1.Trim();
                            addressLine2  = vendorAddress.AddressLine2 != null?vendorAddress.AddressLine2.Trim() : string.Empty;

                            addressLine3 = vendorAddress.AddressLine3 != null?vendorAddress.AddressLine3.Trim() : string.Empty;

                            kota    = vendorAddress != null ? vendorAddress.City : string.Empty;
                            zipCode = vendorAddress.PostalCode != null?vendorAddress.PostalCode.Trim() : string.Empty;
                        }

                        if (contact != null)
                        {
                            attn = contact.Salutation != null?contact.Salutation.Trim() : " ";

                            email = contact.EMail != null?contact.EMail.Trim() : " ";

                            phone = contact.Phone1 != null?contact.Phone1.Trim() : " ";
                        }

                        if (screenName == "MSM200B")
                        {
                            ScreenNameValueDTO[] fields200B = { new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO(),
                                                                new ScreenNameValueDTO() };

                            fields200B[0].fieldName = "SUPPLIER_NAME2I";
                            fields200B[0].value     = vendorAcctName;
                            fields200B[1].fieldName = "COUNTRY_CODE2I";
                            fields200B[1].value     = vendorCountry;
                            fields200B[2].fieldName = "ORDER_ADDR_12I";
                            fields200B[2].value     = addressLine1;
                            fields200B[3].fieldName = "ORDER_ADDR_22I";
                            fields200B[3].value     = addressLine2;
                            fields200B[4].fieldName = "ORDER_ADDR_32I";
                            fields200B[4].value     = kota;
                            fields200B[5].fieldName = "ORDER_CONTACT2I";
                            fields200B[5].value     = attn;
                            fields200B[6].fieldName = "ORDER_ZIP2I";
                            fields200B[6].value     = zipCode;
                            fields200B[7].fieldName = "ORDER_PHONE2I";
                            fields200B[7].value     = phone;
                            fields200B[8].fieldName = "ORDER_EMAIL_L12I";
                            fields200B[8].value     = email;

                            submitRequest.screenFields = fields200B;

                            submitRequest.screenKey = "1"; // OK
                            screenReply             = screenService.submit(screenContext, submitRequest);

                            screenName = screenReply.mapName.Trim();
                            errMess    = screenReply.message;

                            if (screenName == "MSM200F")
                            {
                                ScreenNameValueDTO[] fields200F = { new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO() };

                                fields200F[0].fieldName = "PAYMENT_NAME6I";
                                fields200F[0].value     = vendorAcctName;
                                fields200F[1].fieldName = "PAYMENT_ADDR_16I";
                                fields200F[1].value     = addressLine1;
                                fields200F[2].fieldName = "PAYMENT_ADDR_26I";
                                fields200F[2].value     = addressLine2;
                                fields200F[3].fieldName = "PAYMENT_ADDR_36I";
                                fields200F[3].value     = addressLine3;
                                fields200F[4].fieldName = "PAYMENT_CTACT6I";
                                fields200F[4].value     = attn;
                                fields200F[5].fieldName = "PAYMENT_PHONE6I";
                                fields200F[5].value     = phone;
                                fields200F[6].fieldName = "PAYMENT_EMAIL_L16I";
                                fields200F[6].value     = email;

                                submitRequest.screenFields = fields200F;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM200D")
                            {
                                ScreenNameValueDTO[] fields200D = { new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO(),
                                                                    new ScreenNameValueDTO() };

                                fields200D[0].fieldName = "RETURNS_NAME4I";
                                fields200D[0].value     = vendorAcctName;
                                fields200D[1].fieldName = "RETURNS_ADDR_14I";
                                fields200D[1].value     = addressLine1;
                                fields200D[2].fieldName = "RETURNS_ADDR_24I";
                                fields200D[2].value     = addressLine2;
                                fields200D[3].fieldName = "RETURNS_ADDR_34I";
                                fields200D[3].value     = addressLine3;
                                fields200D[4].fieldName = "RETURNS_CTACT4I";
                                fields200D[4].value     = attn;
                                fields200D[5].fieldName = "RETURNS_PHONE4I";
                                fields200D[5].value     = phone;
                                fields200D[6].fieldName = "RETURNS_EMAIL_L14I";
                                fields200D[6].value     = email;

                                submitRequest.screenFields = fields200D;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM20EA")
                            {
                                ScreenNameValueDTO[] fields20EA = { new ScreenNameValueDTO() };
                                fields20EA[0].fieldName = "COY_NAME1I";
                                fields20EA[0].value     = "";

                                submitRequest.screenFields = fields20EA;
                                submitRequest.screenKey    = "1"; // OK
                                screenReply = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM200C")
                            {
                                ScreenNameValueDTO[] fields200C = { new ScreenNameValueDTO(), new ScreenNameValueDTO(), new ScreenNameValueDTO() };

                                fields200C[0].fieldName = "CLOSE_XMAS3I";
                                fields200C[0].value     = "N";
                                fields200C[1].fieldName = "CURRENCY_TYPE3I";
                                fields200C[1].value     = currencyType;
                                fields200C[2].fieldName = "NO_ITEM_ORDER3I";
                                fields200C[2].value     = "M";

                                submitRequest.screenFields = fields200C;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM200E")
                            {
                                ScreenNameValueDTO[] fields200E = { new ScreenNameValueDTO() };

                                fields200E[0].fieldName = "LEGAL_NAME_15I";
                                fields200E[0].value     = "";

                                submitRequest.screenFields = fields200E;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM20DA")
                            {
                                ScreenNameValueDTO[] fields20DA =
                                {
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO(),
                                    new ScreenNameValueDTO()
                                };

                                fields20DA[0].fieldName = "INV_STMT_IND1I";
                                fields20DA[0].value     = "L";
                                fields20DA[1].fieldName = "NO_OF_DAYS_PAY1I";
                                fields20DA[1].value     = "30";
                                fields20DA[2].fieldName = "ORDS_ALLOWED1I";
                                fields20DA[2].value     = "Y";
                                fields20DA[3].fieldName = "MAX_ORD_ITEMS1I";
                                fields20DA[3].value     = "999";
                                fields20DA[4].fieldName = "PAYMNT_ALLOWED1I";
                                fields20DA[4].value     = "Y";
                                fields20DA[5].fieldName = "PAYMENT_METH1I";
                                fields20DA[5].value     = "C";
                                fields20DA[6].fieldName = "RECON_REQUIRED1I";
                                fields20DA[6].value     = "Y";

                                submitRequest.screenFields = fields20DA;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                                else
                                {
                                    if (screenReply.functionKeys.Contains("XMIT-Confirm"))
                                    {
                                        submitRequest.screenKey = "1"; // OK
                                        screenReply             = screenService.submit(screenContext, submitRequest);

                                        screenName = screenReply.mapName.Trim();
                                        errMess    = screenReply.message;
                                        if (errMess.Trim() != "")
                                        {
                                            screenService.positionToMenu(screenContext);
                                            throw new PXException(errMess.Trim());
                                        }
                                    }
                                }
                            }

                            if (screenName == "MSM20DB")
                            {
                                ScreenNameValueDTO[] fields20DB = { new ScreenNameValueDTO() };
                                fields20DB[0].fieldName = "ORDER_MEDIUM2I";
                                fields20DB[0].value     = "";

                                submitRequest.screenFields = fields20DB;

                                submitRequest.screenKey = "1"; // OK
                                screenReply             = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM205A")
                            {
                                ScreenNameValueDTO[] fields205A = { new ScreenNameValueDTO() };
                                fields205A[0].fieldName = "DSTRCT_CODE1I";
                                fields205A[0].value     = "";

                                submitRequest.screenFields = fields205A;
                                submitRequest.screenKey    = "1"; // OK
                                screenReply = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM205B")
                            {
                                ScreenNameValueDTO[] fields205B = { new ScreenNameValueDTO() };
                                fields205B[0].fieldName = "DSTRCT_CODE2I";
                                fields205B[0].value     = "";

                                submitRequest.screenFields = fields205B;
                                submitRequest.screenKey    = "1"; // OK
                                screenReply = screenService.submit(screenContext, submitRequest);

                                screenName = screenReply.mapName.Trim();
                                errMess    = screenReply.message;

                                if (errMess.Trim() != "")
                                {
                                    screenService.positionToMenu(screenContext);
                                    throw new PXException(errMess.Trim());
                                }
                            }

                            if (screenName == "MSM200A")
                            {
                                screenService.positionToMenu(screenContext);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new PXException(ex.Message);
            }

            return(null);
        }