buli
2023-07-10 4f200849487fc6f914e237d5af3ecefd6d802457
force-app/main/default/classes/ArriveGoodsController.cls
@@ -88,9 +88,8 @@
  //public String[] proidList =new String[]{};
  public Decimal orderCountAll = 0;
  public Decimal orderCountNotarrive = 0;
  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
  public id return_Order_id = null;
  public id inventory_Order_id = null;
  private id return_Order_id = null;
  private id inventory_Order_id = null;
  public boolean ReturnFLGbln { get; set; }
  public boolean saveFLGbln { get; set; }
  public String ArrType { get; set; }
@@ -103,14 +102,6 @@
  public String product_Type = null;
  public Boolean EngFlag = false;
  public Boolean ETFlag = false;
  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
  public Boolean isLwc = false;
  public String returnError;
  public List<String> warningList;
  public List<String> errorList;
  public String urlType;
  public ArriveGoodsController() {
    baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
    ESetId = ApexPages.currentPage().getParameters().get('esetId');
@@ -130,29 +121,6 @@
    consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
    //add by rentx 20210602 CHAN-C3K4ZQ end
    // OrderAllMap = new Map<String, String>();
  }
  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
  public ArriveGoodsController(String eSetId, String arrType) {
    this.ESetId = eSetId;
    this.ArrType = arrType;
    ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
    ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
    ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
    consumableInventory = new List<ConsumableorderdetailsInfo>();
    consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
    consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
    consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
    orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
    detailsSummary = new List<ConsumableorderdetailsInfo>();
    saveFLGbln = false;
    consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
    noboxBarcodeList = new Set<String>();
    //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
    warningList = new List<String>();
    errorList = new List<String>();
    returnError = null;
    urlType = null;
  }
  //add by rentx 20210602 CHAN-C3K4ZQ start 出错的原因是页面最多展示1000条数据,但是需要展示的数据超过了1000条,现在把展示上线改为1000 * 1000
@@ -392,18 +360,6 @@
  //========20160311======ADD_End==================================
  //获取明细
  public void SearchPro() {
    //从下边移上来 by Link 2023-5-23
    if (barcode == null || barcode.trim() == '') {
      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
      if (isLwc) {
        returnError = '请输入BarCode号';
      } else {
        ApexPages.addmessage(
          new ApexPages.message(ApexPages.severity.INFO, '请输入BarCode号。')
        );
      }
      return;
    }
    notInlist = new List<String>();
    otherAgencyMap = new Map<String, String>();
    barMcodeMap = new Map<String, String>();
@@ -411,10 +367,6 @@
    consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
    consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
    orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
    //update by Link 20230428
    if (isLwc) {
      noboxBarcodeList = new Set<String>();
    }
    //add by rentx 2021-01-27 start
    HosErrorList = new List<String>();
    HosErrorMap = new Map<String, String>();
@@ -485,16 +437,12 @@
    List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
    List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
    //移到最上边 by Link 2023-5-23
    // if(barcode == null || barcode.trim() ==''){
    //     //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
    //     if(isLwc){
    //         returnError = '请输入BarCode号';
    //     }else {
    //         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。'));
    //     }
    //     return;
    // }
    if (barcode == null || barcode.trim() == '') {
      ApexPages.addmessage(
        new ApexPages.message(ApexPages.severity.INFO, '请输入BarCode号。')
      );
      return;
    }
    //对比全部库存中是否存在管理编码一样,barcode号不一样的产品
    reSet1 = [
      SELECT Id, Name, TracingCode__c, Bar_Code__c, Report_Product_Expiration__c
@@ -520,13 +468,6 @@
        } else {
          for (String str : barMcodeMap.keySet()) {
            if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  str +
                  ' 的管理编码已经存在于系统的库存中,请确认输入信息是否有误。'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
                    ApexPages.severity.ERROR,
@@ -534,7 +475,6 @@
                    ' 的管理编码已经存在于系统的库存中,请确认输入信息是否有误。'
                  )
                );
              }
              ErrorIdMap.put(str, str);
              ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
            }
@@ -586,8 +526,6 @@
    }
    //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '管理编码为空的产品 ' + ErrorIdMap));
    //整体到货
    System.debug('EsetId===>' + EsetId);
    System.debug('ArrType===>' + ArrType);
    if (EsetId == null || EsetId == '') {
      if (ArrType != 'ReG') {
        //到货但产品类型与用户的类型不符
@@ -651,65 +589,6 @@
            }
          }
        }
        System.debug('reSet1===>' + reSet1);
        //add by Wang Xueqin
        //到货但产品类型与用户的类型不符
        reSet1 = [
          SELECT
            Id,
            Name,
            Intra_Trade_List_RMB__c,
            Asset_Model_No__c,
            Consumable_Product__c,
            Consumable_Product__r.Name,
            Consumable_Product__r.Name__c,
            Consumable_Product__r.Asset_Model_No__c,
            Sterilization_limit__c,
            Deliver_date__c,
            Bar_Code__c,
            Arrive_date__c,
            Send_Date__c,
            Consumable_order_minor__r.Name,
            Consumable_order_minor__c,
            Dealer_Arrive__c,
            Guarantee_period_for_products__c,
            CFDA_Status__c,
            ProductPacking_list_manual__c,
            Report_Product_Approbation__c,
            Report_Product_Expiration__c,
            Box_Piece__c,
            Rrturn_count__c,
            Product_Type__c,
            ContractNo_text__c,
            Consumable_order_minor__r.ContractNo__c
          FROM Consumable_order_details2__c
          WHERE
            Bar_Code__c IN :BarCodeListP
            AND (NOT Product_Type__c LIKE :userPro_Typestr)
        ];
        if (reSet1.size() > 0) {
          for (Integer i = 0; i < reSet1.size(); i++) {
            if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
              // 跳过已经处理的消耗品明细
              continue;
            } else {
              String str =
                '产品类型[' +
                reSet1[i].Product_Type__c +
                ']与用户的类型[' +
                userPro_Type +
                ']不符';
              ConsumableorderdetailsRecordserror.add(
                new ConsumableorderdetailsInfo(reSet1[i], str)
              );
              ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
            }
          }
        }
        System.debug('reSet1===>1' + reSet1);
        //end
        //销售产品
        reSet1 = [
          SELECT
@@ -1405,14 +1284,6 @@
                reSet1[i].Lose_Flag__c == true &&
                reSet1[i].ToDueDateDays__c >= 0
              ) {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  warningList.add(
                    '产品' +
                      reSet1[i].Consumable_Product__r.Name +
                      '存在丢失记录'
                  );
                } else {
                  ApexPages.addmessage(
                    new ApexPages.message(
                      ApexPages.severity.WARNING,
@@ -1421,7 +1292,6 @@
                        '存在丢失记录'
                    )
                  ); //如果丢失产品就给提示。
                }
              }
              if (
                reSet1[i].Lose_Flag__c == true &&
@@ -1661,12 +1531,6 @@
                reSet[i].Bar_Code__c != str &&
                reSet[i].TracingCode__c == barMcodeMap.get(str)
              ) {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  warningList.add(
                    '条形码为(' + str + ')的入库数据与发货数据不一致'
                  );
                } else {
                  // 20220815 ljh SWAG-CH65B7 start
                  // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'此管理编码与实际发货BarCode不一致,请核对管理编码('+ str +')的入库及库存数据。'));
                  ApexPages.addmessage(
@@ -1676,7 +1540,6 @@
                    )
                  );
                  // 20220815 ljh SWAG-CH65B7 end
                }
              }
              if (barMcodeMap.get(str) == reSet[i].TracingCode__c) {
                reSet[i].Bar_Code__c = str;
@@ -1723,16 +1586,6 @@
          } else {
            for (String str : barMcodeMap.keySet()) {
              if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  errorList.add(
                    'barcode' +
                      str +
                      '与出库单' +
                      reSet1[i].Sale_orderName__c +
                      ' 中的管理编码一致,但Barcode不同,请确认具体数据。'
                  );
                } else {
                  ApexPages.addmessage(
                    new ApexPages.message(
                      ApexPages.severity.ERROR,
@@ -1743,7 +1596,6 @@
                        ' 中的管理编码一致,但Barcode不同,请确认具体数据。'
                    )
                  );
                }
                ErrorIdMap.put(str, str);
                ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
              }
@@ -1783,26 +1635,14 @@
        if (ArrType != 'ReG') {
          inventoryEntryNoESetId(notInlist);
          if (notInStorelist.size() > 0) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              returnError = 'BarCode号' + notInStorelist + '不存在';
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  'BarCode号' + notInStorelist + '不存在。'
                )
              );
            }
            return;
          }
        } else {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            returnError =
              'BarCode号' +
              notInlist +
              '不存在,无对应的出库单,请先操作产品入库';
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
@@ -1812,7 +1652,6 @@
                  '不存在,无对应的出库单,请先操作产品入库。'
              )
            );
          }
          return;
        }
      }
@@ -1820,17 +1659,12 @@
      //add by rentx 2021-01-27 start
      if (HosErrorList.size() > 0) {
        for (String str : HosErrorList) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add('BarCode号:' + str + HosErrorMap.get(str) + '');
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
                'BarCode号:' + str + HosErrorMap.get(str) + ''
              )
            );
          }
        }
      }
      //add by rentx 2021-01-27 end
@@ -2327,17 +2161,12 @@
      if (notInlist.size() > 0) {
        inventoryEntry(notInlist);
        if (notInStorelist.size() > 0) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            returnError = 'BarCode号' + notInStorelist + '不存在';
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
                'BarCode号' + notInStorelist + '不存在。'
              )
            );
          }
          return;
        }
      }
@@ -2346,17 +2175,12 @@
    //add by rentx 2021-01-27 start 当订单为医院特价类型的订单时,如果找不到barcode,不解析,并且默认该barcode对应的明细2为非医院特价产品,直接报错
    if (HosErrorList.size() > 0) {
      for (String str : HosErrorList) {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          errorList.add('BarCode号:' + str + '是非医院特价产品');
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
              'BarCode号:' + str + '是非医院特价产品'
            )
          );
        }
      }
    }
    //add by rentx 2021-01-27 end
@@ -2392,14 +2216,6 @@
          //生产日期
          List<String> janCode = new List<String>();
          if (barCodeList[i].length() < 16) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' +
                  barCodeList[i] +
                  ')的位数不足16,不符合要求错误!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
@@ -2408,7 +2224,6 @@
                    ')的位数不足16,不符合要求错误!'
                )
              );
            }
            continue;
          } else {
            //if(barCodeList[i].substring(0,2) !='01'){
@@ -2419,19 +2234,12 @@
            try {
              Decimal test = Decimal.valueOf(janCodeMark);
            } catch (Exception e) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  '产品BarCode(' + barCodeList[i] + ')的janCode错误!'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
                    ApexPages.severity.ERROR,
                    '产品BarCode(' + barCodeList[i] + ')的janCode错误!'
                  )
                );
              }
              continue;
            }
          }
@@ -2443,19 +2251,12 @@
                  barCodeList[i].length() - 5
                ) != '250'
            ) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
                    ApexPages.severity.ERROR,
                    '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
                  )
                );
              }
              continue;
            }
            if (barCodeList[i].substring(16, 18) == '11') {
@@ -2468,16 +2269,6 @@
                  '-01';
                productionDate = Date.valueOf(productDateStr);
              } catch (Exception e) {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  errorList.add(
                    '产品BarCode(' +
                      barCodeList[i] +
                      ')的生产日期' +
                      productDateStr +
                      '错误!'
                  );
                } else {
                  ApexPages.addmessage(
                    new ApexPages.message(
                      ApexPages.severity.ERROR,
@@ -2488,7 +2279,6 @@
                        '错误!'
                    )
                  );
                }
                continue;
              }
              if (barCodeList[i].length() >= 32) {
@@ -2517,16 +2307,6 @@
                      expirationDate = Date.valueOf(expirationDateStr);
                    }
                  } catch (Exception e) {
                    //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                    if (isLwc) {
                      errorList.add(
                        '产品BarCode(' +
                          barCodeList[i] +
                          ')的滅菌有効期限' +
                          expirationDateStr +
                          '错误!'
                      );
                    } else {
                      ApexPages.addmessage(
                        new ApexPages.message(
                          ApexPages.severity.ERROR,
@@ -2537,7 +2317,6 @@
                            '错误!'
                        )
                      );
                    }
                    continue;
                  }
                  if (barCodeList[i].length() >= 42) {
@@ -2582,16 +2361,6 @@
                  expirationDate = Date.valueOf(expirationDateStr);
                }
              } catch (Exception e) {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  errorList.add(
                    '产品BarCode(' +
                      barCodeList[i] +
                      ')的滅菌有効期限' +
                      expirationDateStr +
                      '错误!'
                  );
                } else {
                  ApexPages.addmessage(
                    new ApexPages.message(
                      ApexPages.severity.ERROR,
@@ -2602,7 +2371,6 @@
                        '错误!'
                    )
                  );
                }
                continue;
              }
              if (barCodeList[i].length() >= 34) {
@@ -2656,15 +2424,7 @@
                    Pattern.compile('[0-9]').matcher(Atr).find() ||
                    Pattern.compile('[0-9]').matcher(Ctr).find()
                  ) {
                    //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                    String str = '管理编码有误,请检查条形码数据。';
                    if (isLwc) {
                      errorList.add(
                        '产品BarCode(' +
                          barCodeList[i] +
                          ')管理编码有误,请检查条形码数据。'
                      );
                    } else {
                      ApexPages.addmessage(
                        new ApexPages.message(
                          ApexPages.severity.ERROR,
@@ -2673,17 +2433,14 @@
                            ')管理编码有误,请检查条形码数据。'
                        )
                      );
                    }
                    continue;
                  }
                }
                // String str = '管理编码不正确,请与管理员确认是否错误。';
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'产品BarCode(' + barCodeList[i] + ')管理编码中有数字,请与管理员确认是否错误!'));
                // continue;
                // gzw DB202305352696 入库管理编码验证程序调整 end
              }
            } else {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  '产品BarCode(' + barCodeList[i] + ')的tracingCode错误!'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
@@ -2691,7 +2448,6 @@
                    '产品BarCode(' + barCodeList[i] + ')的tracingCode错误!'
                  )
                );
              }
              continue;
            }
          }
@@ -2788,32 +2544,17 @@
                barCodeList[i].length() - 5
              ) != '250'
          ) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
                )
              );
            }
            continue;
          }
          List<String> otCodeList = new List<String>();
          Map<String, String> otCodeMap = new Map<String, String>();
          if (barCodeList[i].length() < 7) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' +
                  barCodeList[i] +
                  ')的位数不足16,不符合要求错误!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
@@ -2822,7 +2563,6 @@
                    ')的位数不足16,不符合要求错误!'
                )
              );
            }
            continue;
          } else if (barCodeList[i].length() == 11) {
            String otCode4 = barCodeList[i].substring(3, 7);
@@ -2864,31 +2604,21 @@
          barOtcodeMap.put(barCodeList[i], otCodeMap);
          barCode241List.add(barCodeList[i]);
        } else {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add('产品BarCode(' + barCodeList[i] + ')不符合要求!');
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
                '产品BarCode(' + barCodeList[i] + ')不符合要求!'
              )
            );
          }
          continue;
        }
      } else {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          errorList.add('产品BarCode(' + barCodeList[i] + ')不符合要求!');
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
              '产品BarCode(' + barCodeList[i] + ')不符合要求!'
            )
          );
        }
        continue;
      }
    }
@@ -2951,18 +2681,6 @@
          }
        }
        if (errorMap.size() > 0) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add(
              'BarCode号[' +
                errorMap.values() +
                ']产品类型[' +
                product_Type +
                ']与用户类型[' +
                userPro_Type +
                ']不符'
            );
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
@@ -2975,7 +2693,6 @@
                  ']不符'
              )
            );
          }
        }
      }
    }
@@ -3011,18 +2728,6 @@
        }
      }
      if (errorMap.size() > 0) {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          errorList.add(
            'BarCode号[' +
              errorMap.values() +
              ']产品类型[' +
              product_Type +
              ']与用户[' +
              userPro_Type +
              ']类型不符'
          );
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
@@ -3035,7 +2740,6 @@
                ']类型不符'
            )
          );
        }
      }
      product2InStore = [
        SELECT
@@ -3076,16 +2780,6 @@
                      '-01';
                    productionDate = Date.valueOf(productDateStr);
                  } catch (Exception e) {
                    //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                    if (isLwc) {
                      errorList.add(
                        '产品BarCode(' +
                          bar +
                          ')的生产日期' +
                          productDateStr +
                          '错误!'
                      );
                    } else {
                      ApexPages.addmessage(
                        new ApexPages.message(
                          ApexPages.severity.ERROR,
@@ -3096,7 +2790,6 @@
                            '错误!'
                        )
                      );
                    }
                    continue;
                  }
                  if (bar.length() >= oTcodeLength + 3 + 16) {
@@ -3150,16 +2843,6 @@
                          expirationDate = Date.valueOf(expirationDateStr);
                        }
                      } catch (Exception e) {
                        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                        if (isLwc) {
                          errorList.add(
                            '产品BarCode(' +
                              bar +
                              ')的滅菌有効期限' +
                              expirationDateStr +
                              '错误!'
                          );
                        } else {
                          ApexPages.addmessage(
                            new ApexPages.message(
                              ApexPages.severity.ERROR,
@@ -3170,7 +2853,6 @@
                                '错误!'
                            )
                          );
                        }
                        continue;
                      }
                      if (bar.length() >= oTcodeLength + 3 + 25) {
@@ -3254,16 +2936,6 @@
                      expirationDate = Date.valueOf(expirationDateStr);
                    }
                  } catch (Exception e) {
                    //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                    if (isLwc) {
                      errorList.add(
                        '产品BarCode(' +
                          bar +
                          ')的滅菌有効期限' +
                          expirationDateStr +
                          '错误!'
                      );
                    } else {
                      ApexPages.addmessage(
                        new ApexPages.message(
                          ApexPages.severity.ERROR,
@@ -3274,7 +2946,6 @@
                            '错误!'
                        )
                      );
                    }
                    continue;
                  }
                  if (bar.length() >= oTcodeLength + 20) {
@@ -3332,15 +3003,7 @@
                        Pattern.compile('[0-9]').matcher(Atr).find() ||
                        Pattern.compile('[0-9]').matcher(Ctr).find()
                      ) {
                        String str = '管理编码不正确,请与管理员确认是否错误。';
                        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                        if (isLwc) {
                          errorList.add(
                            '产品BarCode(' +
                              bar +
                              ')管理编码有误,请检查条形码数据。'
                          );
                        } else {
                        String str = '管理编码有误,请检查条形码数据。';
                          ApexPages.addmessage(
                            new ApexPages.message(
                              ApexPages.severity.ERROR,
@@ -3349,7 +3012,6 @@
                                ')管理编码有误,请检查条形码数据。'
                            )
                          );
                        }
                        continue;
                      }
                    }
@@ -3359,19 +3021,12 @@
                    // gzw DB202305352696 入库管理编码验证程序调整 end
                  }
                } else {
                  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                  if (isLwc) {
                    errorList.add(
                      '产品BarCode(' + bar + ')的tracingCode错误!'
                    );
                  } else {
                    ApexPages.addmessage(
                      new ApexPages.message(
                        ApexPages.severity.ERROR,
                        '产品BarCode(' + bar + ')的tracingCode错误!'
                      )
                    );
                  }
                  continue;
                }
              }
@@ -3448,14 +3103,6 @@
        //生产日期
        List<String> janCode = new List<String>();
        if (barCodeList[i].length() < 16) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add(
              '产品BarCode(' +
                barCodeList[i] +
                ')的位数不足16,不符合要求错误!'
            );
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
@@ -3464,26 +3111,18 @@
                  ')的位数不足16,不符合要求错误!'
              )
            );
          }
          continue;
        } else {
          janCodeMark = barCodeList[i].substring(2, 16);
          try {
            Decimal test = Decimal.valueOf(janCodeMark);
          } catch (Exception e) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' + barCodeList[i] + ')的janCode错误!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  '产品BarCode(' + barCodeList[i] + ')的janCode错误!'
                )
              );
            }
            continue;
          }
        }
@@ -3495,19 +3134,12 @@
                barCodeList[i].length() - 5
              ) != '250'
          ) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
                )
              );
            }
            continue;
          }
          if (barCodeList[i].substring(16, 18) == '11') {
@@ -3520,16 +3152,6 @@
                '-01';
              productionDate = Date.valueOf(productDateStr);
            } catch (Exception e) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  '产品BarCode(' +
                    barCodeList[i] +
                    ')的生产日期' +
                    productDateStr +
                    '错误!'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
                    ApexPages.severity.ERROR,
@@ -3540,7 +3162,6 @@
                      '错误!'
                  )
                );
              }
              continue;
            }
            if (barCodeList[i].length() >= 32) {
@@ -3569,16 +3190,6 @@
                    expirationDate = Date.valueOf(expirationDateStr);
                  }
                } catch (Exception e) {
                  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                  if (isLwc) {
                    errorList.add(
                      '产品BarCode(' +
                        barCodeList[i] +
                        ')的滅菌有効期限' +
                        expirationDateStr +
                        '错误!'
                    );
                  } else {
                    ApexPages.addmessage(
                      new ApexPages.message(
                        ApexPages.severity.ERROR,
@@ -3589,7 +3200,6 @@
                          '错误!'
                      )
                    );
                  }
                  continue;
                }
                if (barCodeList[i].length() >= 42) {
@@ -3634,16 +3244,6 @@
                expirationDate = Date.valueOf(expirationDateStr);
              }
            } catch (Exception e) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                errorList.add(
                  '产品BarCode(' +
                    barCodeList[i] +
                    ')的滅菌有効期限' +
                    expirationDateStr +
                    '错误!'
                );
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(
                    ApexPages.severity.ERROR,
@@ -3654,7 +3254,6 @@
                      '错误!'
                  )
                );
              }
              continue;
            }
            if (barCodeList[i].length() >= 34) {
@@ -3705,15 +3304,7 @@
                  Pattern.compile('[0-9]').matcher(Atr).find() ||
                  Pattern.compile('[0-9]').matcher(Ctr).find()
                ) {
                  String str = '管理编码不正确,请与管理员确认是否错误。';
                  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                  if (isLwc) {
                    errorList.add(
                      '产品BarCode(' +
                        barCodeList[i] +
                        ')管理编码有误,请检查条形码数据。'
                    );
                  } else {
                  String str = '管理编码有误,请检查条形码数据。';
                    ApexPages.addmessage(
                      new ApexPages.message(
                        ApexPages.severity.ERROR,
@@ -3722,7 +3313,6 @@
                          ')管理编码有误,请检查条形码数据。'
                      )
                    );
                  }
                  continue;
                }
              }
@@ -3732,19 +3322,12 @@
              // gzw DB202305352696 入库管理编码验证程序调整 end
            }
          } else {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              errorList.add(
                '产品BarCode(' + barCodeList[i] + ')的tracingCode错误!'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  '产品BarCode(' + barCodeList[i] + ')的tracingCode错误!'
                )
              );
            }
            continue;
          }
        }
@@ -3830,30 +3413,17 @@
              barCodeList[i].length() - 5
            ) != '250'
        ) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add('产品BarCode(' + barCodeList[i] + ')没有管理编码!');
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
                '产品BarCode(' + barCodeList[i] + ')没有管理编码!'
              )
            );
          }
          continue;
        }
        List<String> otCodeList = new List<String>();
        Map<String, String> otCodeMap = new Map<String, String>();
        if (barCodeList[i].length() < 7) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add(
              '产品BarCode(' +
                barCodeList[i] +
                ')的位数不足16,不符合要求错误!'
            );
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
@@ -3862,7 +3432,6 @@
                  ')的位数不足16,不符合要求错误!'
              )
            );
          }
          continue;
        } else if (barCodeList[i].length() == 11) {
          String otCode4 = barCodeList[i].substring(3, 7);
@@ -3904,14 +3473,6 @@
        barOtcodeMap.put(barCodeList[i], otCodeMap);
        barCode241List.add(barCodeList[i]);
      } else {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          errorList.add(
            '产品BarCode(' +
              barCodeList[i] +
              ')没有janCode或OTcode,不符合要求!'
          );
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
@@ -3920,7 +3481,6 @@
                ')没有janCode或OTcode,不符合要求!'
            )
          );
        }
        continue;
      }
    }
@@ -3960,18 +3520,6 @@
          }
        }
        if (errorMap.size() > 0) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            errorList.add(
              'BarCode号[' +
                errorMap.values() +
                ']产品类型[' +
                product_Type +
                ']与用户的类型[' +
                userPro_Type +
                ']不符'
            );
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
@@ -3984,7 +3532,6 @@
                  ']不符'
              )
            );
          }
        }
      }
      product2InStore = [
@@ -4076,18 +3623,6 @@
        }
      }
      if (errorMap.size() > 0) {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          errorList.add(
            'BarCode号[' +
              errorMap.values() +
              ']产品类型[' +
              product_Type +
              ']与用户[' +
              userPro_Type +
              ']类型不符'
          );
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
@@ -4100,7 +3635,6 @@
                ']类型不符'
            )
          );
        }
      }
      product2InStore = [
        SELECT
@@ -4140,16 +3674,6 @@
                    '-01';
                  productionDate = Date.valueOf(productDateStr);
                } catch (Exception e) {
                  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                  if (isLwc) {
                    errorList.add(
                      '产品BarCode(' +
                        bar +
                        ')的生产日期' +
                        productDateStr +
                        '错误!'
                    );
                  } else {
                    ApexPages.addmessage(
                      new ApexPages.message(
                        ApexPages.severity.ERROR,
@@ -4160,7 +3684,6 @@
                          '错误!'
                      )
                    );
                  }
                  continue;
                }
                if (bar.length() >= oTcodeLength + 3 + 16) {
@@ -4215,16 +3738,6 @@
                        expirationDate = Date.valueOf(expirationDateStr);
                      }
                    } catch (Exception e) {
                      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                      if (isLwc) {
                        errorList.add(
                          '产品BarCode(' +
                            bar +
                            ')的滅菌有効期限' +
                            expirationDateStr +
                            '错误!'
                        );
                      } else {
                        ApexPages.addmessage(
                          new ApexPages.message(
                            ApexPages.severity.ERROR,
@@ -4235,7 +3748,6 @@
                              '错误!'
                          )
                        );
                      }
                      continue;
                    }
                    if (bar.length() >= oTcodeLength + 3 + 25) {
@@ -4314,16 +3826,6 @@
                    expirationDate = Date.valueOf(expirationDateStr);
                  }
                } catch (Exception e) {
                  //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                  if (isLwc) {
                    errorList.add(
                      '产品BarCode(' +
                        bar +
                        ')的滅菌有効期限' +
                        expirationDateStr +
                        '错误!'
                    );
                  } else {
                    ApexPages.addmessage(
                      new ApexPages.message(
                        ApexPages.severity.ERROR,
@@ -4334,7 +3836,6 @@
                          '错误!'
                      )
                    );
                  }
                  continue;
                }
                if (bar.length() >= oTcodeLength + 20) {
@@ -4384,15 +3885,7 @@
                      Pattern.compile('[0-9]').matcher(Atr).find() ||
                      Pattern.compile('[0-9]').matcher(Ctr).find()
                    ) {
                      String str = '管理编码不正确,请与管理员确认是否错误。';
                      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                      if (isLwc) {
                        errorList.add(
                          '产品BarCode(' +
                            bar +
                            ')管理编码有误,请检查条形码数据。'
                        );
                      } else {
                      String str = '管理编码有误,请检查条形码数据。';
                        ApexPages.addmessage(
                          new ApexPages.message(
                            ApexPages.severity.ERROR,
@@ -4401,7 +3894,6 @@
                              ')管理编码有误,请检查条形码数据。'
                          )
                        );
                      }
                      continue;
                    }
                  }
@@ -4411,17 +3903,12 @@
                  // gzw DB202305352696 入库管理编码验证程序调整 end
                }
              } else {
                //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
                if (isLwc) {
                  errorList.add('产品BarCode(' + bar + ')的tracingCode错误!');
                } else {
                  ApexPages.addmessage(
                    new ApexPages.message(
                      ApexPages.severity.ERROR,
                      '产品BarCode(' + bar + ')的tracingCode错误!'
                    )
                  );
                }
                continue;
              }
            }
@@ -4469,30 +3956,20 @@
    if (notEqualBARcodeCunMap.size() > 0) {
      for (String widget : notEqualBARcodeCunMap.keySet()) {
        if (notEqualBARcodeCunMap.get(widget).size() > 0) {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            warningList.add('以下barcode产品与订货产品不一致。');
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.INFO,
                '以下barcode产品与订货产品不一致。'
              )
            );
          }
          for (
            String barcodeListTTT : (List<String>) notEqualBARcodeCunMap.get(
              widget
            )
          ) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              warningList.add(barcodeListTTT);
            } else {
              ApexPages.addmessage(
                new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)
              );
            }
          }
        }
      }
@@ -4921,14 +4398,9 @@
      ConsumableorderdetailsRecords.size() < 1 &&
      consumableInventory.size() < 1
    ) {
      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
      if (isLwc) {
        returnError = '不存在到货明细';
      } else {
        ApexPages.addmessage(
          new ApexPages.message(ApexPages.severity.ERROR, '不存在到货明细')
        );
      }
      return null;
    }
    if (EsetId != null && EsetId != '') {
@@ -4936,16 +4408,6 @@
      if (resultcheck.length() > 0) {
        for (String widget : overOrderBARcodeCunMap.keySet()) {
          if (overOrderBARcodeCunMap.get(widget).size() > 0) {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              warningList.add(
                '产品' +
                  widget +
                  '本次到货数量超过' +
                  overOrderBARcodeCunMap.get(widget).size() +
                  '个订货的数量。'
              );
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.INFO,
@@ -4956,20 +4418,14 @@
                    '个订货的数量。'
                )
              );
            }
            for (
              String barcodeListTTT : (List<String>) overOrderBARcodeCunMap.get(
                widget
              )
            ) {
              //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
              if (isLwc) {
                warningList.add(barcodeListTTT);
              } else {
                ApexPages.addmessage(
                  new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)
                );
              }
            }
          }
        }
@@ -5002,7 +4458,6 @@
      arriveId = orderMain.id;
      Decimal arriveAmount = 0;
      for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse) {
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------'));
        Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
        insDetails.Id = ass.esd.Id;
        insDetails.Consumable_Arrived_order__c = orderMain.id;
@@ -5129,7 +4584,6 @@
      if (updateconsumableorderdetails2.size() > 0) {
        update updateconsumableorderdetails2;
      }
      List<Consumable_order_details2__c> insertconsumableorderdetails2 = new List<Consumable_order_details2__c>();
      for (Consumable_order_details2__c Cod2 : consumableorderdetails2Insert) {
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------'));
@@ -5227,12 +4681,7 @@
      // Integer a = 1/0;
    } catch (Exception e) {
      Database.rollback(sp);
      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
      if (isLwc) {
        returnError = e.getLineNumber() + '---' + e.getMessage();
      } else {
        ApexPages.addMessages(e);
      }
      return null;
    }
    if (resultcheck.length() > 0) {
@@ -5240,7 +4689,6 @@
    } else if (resultcheckWithoutOrder.size() > 0) {
      return null;
    } else {
      urlType = 'UnabletoEdit';
      return UnabletoEdit();
      // return null;
    }
@@ -5650,7 +5098,11 @@
        Inventory_Order_Sheet.Order_ProType__c = userPro_Type;
        insert Inventory_Order_Sheet;
        inventory_Order_id = Inventory_Order_Sheet.id;
        //List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id]; //Commented By Li Jun 20230616
        List<Consumable_order__c> consumable_order_Inv = [
          SELECT Name
          FROM Consumable_order__c
          WHERE id = :Inventory_Order_Sheet.id
        ];
        // WYIN-BLZE48盘点丢失产品增加入库方式 update by vivek 2020-03-05 end
        List<Consumable_order_details2__c> codcList = new List<Consumable_order_details2__c>();
@@ -5671,11 +5123,7 @@
            codi.esd.Return_reason__c == null ||
            codi.esd.Return_reason__c == ''
          ) {
            if (isLwc) {
              returnError = '请补充返品原因';
            } else {
              codi.esd.Return_reason__c.addError('请补充返品原因');
            }
            return null;
          }
@@ -5686,11 +5134,7 @@
              codi.esd.Bar_Code__c;
            Integer deliverycnt = BarcodeCntMap.get(key);
            if (codi.esd.Rrturn_count__c > deliverycnt) {
              if (isLwc) {
                returnError = '超出出库数量';
              } else {
                codi.esd.Rrturn_count__c.addError('超出出库数量');
              }
              return null;
            }
          }
@@ -5911,7 +5355,6 @@
            codcList.add(codi.esd);
          }
        }
        //明细2不存在的对应的到货订单明细 2017-07-05
        Integer i = 1;
        //for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
@@ -5925,17 +5368,9 @@
          // }
          if (ass.ReturnReason == null || ass.ReturnReason == '') {
            //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
            if (isLwc) {
              returnError = '请补充返品原因';
            } else {
              ApexPages.addmessage(
                new ApexPages.message(
                  ApexPages.severity.ERROR,
                  '请补充返品原因'
                )
              new ApexPages.message(ApexPages.severity.ERROR, '请补充返品原因')
              );
            }
            return null;
          }
@@ -6034,51 +5469,31 @@
          // WYIN-BPE3T4 虚拟盘点单 update by vivek 2020-05-11 start
          // return ToReturnGoodsPage();
          if (hasLoseGoods) {
            urlType = 'ToInventoryGoodsPage';
            return ToInventoryGoodsPage();
            // return null;
          } else {
            urlType = 'ToReturnGoodsPage';
            return ToReturnGoodsPage();
            // return null;
          }
          // WYIN-BPE3T4 虚拟盘点单 update by vivek 2020-05-11 start
        } else {
          //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
          if (isLwc) {
            returnError = '没有需要登录的返品';
          } else {
            ApexPages.addmessage(
              new ApexPages.message(
                ApexPages.severity.ERROR,
                '没有需要登录的返品'
              )
            );
          }
          return null;
        }
      } else {
        //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
        if (isLwc) {
          returnError = '没有需要登录的返品';
        } else {
          ApexPages.addmessage(
            new ApexPages.message(
              ApexPages.severity.ERROR,
              '没有需要登录的返品'
            )
          new ApexPages.message(ApexPages.severity.ERROR, '没有需要登录的返品')
          );
        }
        return null;
      }
    } catch (Exception e) {
      Database.rollback(sp);
      //LWC:Lwcflag和报错提醒 update by Link 2023-04-27
      if (isLwc) {
        returnError = e.getLineNumber() + '---' + e.getMessage();
      } else {
        ApexPages.addMessages(e);
      }
      return null;
    }
  }
@@ -6160,7 +5575,7 @@
    return ref;
  }
  public class ConsumableorderdetailsInfo implements Comparable {
  class ConsumableorderdetailsInfo implements Comparable {
    public Consumable_order_details2__c esd { get; set; }
    public Product2__c Prod { get; set; }
    public String ProductName { get; set; }
@@ -6178,10 +5593,6 @@
    public Decimal arrivedCount { get; set; }
    public String ReportProductExpirationDate { get; set; }
    public ConsumableorderdetailsInfo() {
    }
    public ConsumableorderdetailsInfo(
      Consumable_order_details2__c e,
      string str