コード例 #1
0
        private bool isPLAndCZExpection(int orderNumber, string id, string tableName, string salesOrg)
        {
            if (salesOrg == "PL01" || salesOrg == "CZ01")
            {
                var timeout = DateAndTime.DateAdd(DateInterval.Second, 10, DateAndTime.Now);

                // buggfix - The data necessary to complete this operation is not yet available.
                while (DateTime.Now < timeout)
                {
                    System.Threading.Thread.Sleep(2000);
                    try {
                        if (!sap.idExists(VA02ID.TOTAL_ORDER_CASES_FIELD_ID))
                        {
                            (sap.findById(VA02ID.ADDITIONAL_INFO_B_TAB_ID) as dynamic).Select();
                        }
                        else
                        {
                            break;
                        }
                    } catch (Exception) {
                    }
                }

                string orderQty     = (sap.findById(VA02ID.TOTAL_ORDER_CASES_FIELD_ID) as dynamic).Text();
                string confirmedQty = (sap.findById(VA02ID.TOTAL_CONFIRMED_CASES_FIELD_ID) as dynamic).Text();

                if (orderQty != confirmedQty)
                {
                    log.update(
                        tableName,
                        columnNames: new[] { "endTime", "status", "reason" },
                        values: new[] { Strings.Format(DateTime.Now, "yyyyMMdd HH:mm:ss"), "fail", "Could not change route codes as the CFR becomes lower than 100%" },
                        conditionName: new[] { "orderNumber", "id" },
                        conditionValue: new[] { orderNumber.ToString(), id, });
                    return(true);
                }
                else
                {
                    sap.goBack();
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }