Beispiel #1
0
        public bool isLineChanged(ITable table, SwitchesSapLineProperty lineSwitch, int sapLineNumber, ref string reason)
        {
            switch (true)
            {
            case object _ when sap.getInfoBarMsg().Contains("Future"): {
                reason = "SKU is future status";
                putBackPreviousSku(table, lineSwitch, sapLineNumber);
                return(false);
            }

            case object _ when sap.getInfoBarMsg().Contains("excluded"): {
                reason = "SKU is excluded";
                putBackPreviousSku(table, lineSwitch, sapLineNumber);
                return(false);
            }

            case object _ when sap.getInfoBarMsg().Contains("not defined"): {
                reason = "SKU is not defined for the sales organisation";
                putBackPreviousSku(table, lineSwitch, sapLineNumber);
                return(false);
            }

            case object _ when sap.getInfoBarMsg().Contains("not approved"): {
                reason = "SKU is not approved for the sales organisation";
                sap.pressEnter();
                sap.getRidOfPopUps();
                putBackPreviousSku(table, lineSwitch, sapLineNumber);
                return(false);
            }

            default: {
                return(true);
            }
            }
        }
 private void cmirAction(SwitchesSapOrderProperty switchObj, ITable table, SwitchesSapLineProperty lineSwitch, int sapLineNumber, string cmir)
 {
     if (lineSwitch.isSameBarcode && cmir != "")
     {
         table.setCellValue(sapLineNumber, "Customer Material Numb", cmir);
         log.insert("CMIR",
                    "[salesOrg],[soldTo],[sku],[cmir]",
                    $@"'{switchObj.salesOrg}',{switchObj.soldTo},{lineSwitch.newSku},'{cmir}'");
     }
 }
        private static bool isForChange(ITable table, SwitchesSapLineProperty lineSwitch, int sapLineNumber)
        {
            if (!(table.getCell(sapLineNumber, "Material") as dynamic).Changeable)
            {
                lineSwitch.reason = "Line is rejected";
                return(false);
            }

            if (long.Parse(table.getCellValue(sapLineNumber, "Material")) == lineSwitch.newSku)
            {
                lineSwitch.reason = "Line was already switched";
                return(false);
            }

            return(true);
        }
 private void endSwtichesLog(SwitchesSapOrderProperty switchObj, string id, string tableName, SwitchesSapLineProperty lineSwitch, bool isChanged)
 {
     log.update(tableName,
                new[] { "status", "reason" },
                new[] { isChanged ? "success" : "fail", lineSwitch.reason.Replace("'", "") },
                new[] { "[orderNumber]", "[id]", "[SwitchAutomatic]" },
                new[] { switchObj.orderNumber.ToString(), id, "1" });
 }
Beispiel #5
0
 public void putBackPreviousSku(ITable table, SwitchesSapLineProperty lineSwitch, int sapLineNumber)
 {
     table.setCellValue(sapLineNumber, table.columnDict["Material"].First(), lineSwitch.oldSku);
     sap.pressEnter();
     sap.getRidOfPopUps();
 }