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); }
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); }
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); }
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); }
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); }
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; }