| | |
| | | public static boolean isRunning = false; |
| | | public static String barcode { get; set; } |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { |
| | | get; |
| | | set; |
| | | } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { |
| | | get; |
| | | set; |
| | | } |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { get; set; } |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { |
| | | get; |
| | | set; |
| | | } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; } |
| | | public static Map<String, String> existIdMap { get; set; } |
| | | public static Map<String, String> errorIdMap { get; set; } |
| | | public static Map<String, String> allMap { get; set; } |
| | |
| | | res.entity = data; |
| | | |
| | | String UserName = UserInfo.getUserId(); |
| | | user useracc = [ |
| | | SELECT Accountid, Work_Location__c |
| | | FROM user |
| | | WHERE id = :UserName |
| | | ]; |
| | | user useracc = [SELECT Accountid, Work_Location__c FROM user WHERE id = :UserName]; |
| | | accountid = useracc.Accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ]; |
| | | for (Integer j = 0; j < arriveDat.size(); j++) { |
| | | consumableorderdetailsRecords.add( |
| | | new ConsumableorderdetailsInfo(arriveDat[j]) |
| | | ); |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(arriveDat[j])); |
| | | } |
| | | } |
| | | |
| | |
| | | Unitprice_To_agency__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE |
| | | Consumable_order__c = :ESetId |
| | | AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | orderpieceorboxMap.put( |
| | | orderdetails[i].Product_Pattern__c, |
| | | orderdetails[i].Box_Piece__c |
| | | ); |
| | | if ( |
| | | orderdetails[i].Unitprice_To_agency__c != null && |
| | | orderdetails[i].Unitprice_To_agency__c != 0 |
| | | ) { |
| | | orderagencypriceMap.put( |
| | | orderdetails[i].Product_Pattern__c, |
| | | orderdetails[i].Unitprice_To_agency__c |
| | | ); |
| | | orderpieceorboxMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Box_Piece__c); |
| | | if (orderdetails[i].Unitprice_To_agency__c != null && orderdetails[i].Unitprice_To_agency__c != 0) { |
| | | orderagencypriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Unitprice_To_agency__c); |
| | | } |
| | | orderpriceMap.put( |
| | | orderdetails[i].Product_Pattern__c, |
| | | orderdetails[i].Delivery_List_RMB__c |
| | | ); |
| | | orderdetCountMap.put( |
| | | orderdetails[i].Product_Pattern__c, |
| | | orderdetails[i].Shipment_Count__c |
| | | ); |
| | | orderpriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Delivery_List_RMB__c); |
| | | orderdetCountMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Shipment_Count__c); |
| | | } |
| | | List<hospitalprice__c> hlist = [ |
| | | SELECT id |
| | |
| | | } |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put( |
| | | 'consumableorderdetailsRecordserror', |
| | | consumableorderdetailsRecordserror |
| | | ); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | data.put('coc', coc); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | |
| | | } |
| | | Map<String, String> proHosMap = new Map<String, String>(); |
| | | Map<String, String> proIdMap = new Map<String, String>(); |
| | | List<hospitalprice__c> hpList = [ |
| | | SELECT id, hospital__c, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid |
| | | ]; |
| | | List<hospitalprice__c> hpList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hpList != null && hpList.size() > 0) { |
| | | for (hospitalprice__c hp : hpList) { |
| | | if ( |
| | | hp.product__c != null && |
| | | String.valueof(hp.product__c).length() >= 15 |
| | | ) { |
| | | if (hp.product__c != null && String.valueof(hp.product__c).length() >= 15) { |
| | | proIdMap.put(('' + hp.product__c).subString(0, 15) + '是', ''); |
| | | if (hp.hospital__c == coc.Order_ForHospital__c) { |
| | | proHosMap.put(('' + hp.product__c).subString(0, 15) + '是', ''); |
| | |
| | | newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c |
| | | ) { |
| | | String str = '该商品出货单位错误'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | if (coc.OutPattern__c == true) { |
| | | System.debug( |
| | | 'testPattern:' + |
| | | newdet2[j].Product_Pattern__c + |
| | | '---' + |
| | | orderdetails[i].Product_Pattern__c |
| | | ); |
| | | if ( |
| | | newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c |
| | | ) { |
| | | System.debug('testPattern:'+newdet2[j].Product_Pattern__c+'---'+orderdetails[i].Product_Pattern__c); |
| | | if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | //add by rentx 2021-03-22 start |
| | | if (newdet2[j].exchangeOutPattern__c == true) { |
| | | //如果当前经销商下没有维护对应的特价产品 报错 |
| | | if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | String str = '没有维护该产品的特价医院'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } else { |
| | | String str = '该商品出库医院错误'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该产品没有管理编码,无法出库,请与特约经销商管理部人员联系,修正数据'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经取消'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else if ( |
| | | !orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c) |
| | | ) { |
| | | } else if (!orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)) { |
| | | String str = '不是本出库单的出库产品'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (containsFlg == false) { |
| | | String str = |
| | | '该商品是' + |
| | | reSet1[i].Arrive_Owner_Work_Location__c + |
| | | '的库存'; |
| | | String str = '该商品是' + reSet1[i].Arrive_Owner_Work_Location__c + '的库存'; |
| | | if (reSet1[i].Dealer_Info_text__c != accountName) { |
| | | str = '该商品在其他经销商库存'; |
| | | } |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经销售'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出库'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经丢失'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Integer a = 0; |
| | | for (Integer j = 0; j < newdet2.size(); j++) { |
| | | if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && a < orderdetails[i].Shipment_Count__c) { |
| | | if ( |
| | | newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && |
| | | a < orderdetails[i].Shipment_Count__c |
| | | ) { |
| | | if ( |
| | | (existIdMap.containsKey(newdet2[j].Bar_Code__c) && |
| | | newdet2[j].Bar_Code__c == '盒') || |
| | | (existIdMap.containsKey(newdet2[j].Bar_Code__c) && newdet2[j].Bar_Code__c == '盒') || |
| | | errorIdMap.containsKey(newdet2[j].Bar_Code__c) |
| | | ) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else if (newdet2[j].Isoverdue__c == 0) { |
| | | String str = '该商品已经超出减菌有效期的有效范围'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } else if (newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c) { |
| | | String str = '该商品出货单位错误'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) { |
| | | Matcher n = Pattern.compile('[0-9]') |
| | | .matcher(newdet2[j].TracingCode__c); |
| | | Matcher n = Pattern.compile('[0-9]').matcher(newdet2[j].TracingCode__c); |
| | | if (n.find()) { |
| | | if (newdet2[j].TracingCode__c.length() == 5) { |
| | | String tr = newdet2[j].TracingCode__c; |
| | | String Ctr = tr.substring(tr.length() - 3, tr.length()); |
| | | String Btr = tr.substring(tr.length() - 4, tr.length() - 3); |
| | | String Atr = tr.substring(tr.length() - 5, tr.length() - 4); |
| | | if ( |
| | | Pattern.compile('[0-9]').matcher(Atr).find() || |
| | | Pattern.compile('[0-9]').matcher(Ctr).find() |
| | | ) { |
| | | if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { |
| | | String str = '管理编码有误,请检查条形码数据。'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | errorIdMap.put( |
| | | newdet2[j].Bar_Code__c, |
| | | newdet2[j].Bar_Code__c |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | // continue; |
| | | } |
| | | checkBarcodeResult.put( |
| | | newdet2[j].Bar_Code__c, |
| | | newdet2[j].Bar_Code__c |
| | | ); |
| | | consumableorderdetailsRecords.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j]) |
| | | ); |
| | | checkBarcodeResult.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(newdet2[j])); |
| | | a++; |
| | | existIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } else if ( |
| | | newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c |
| | | ) { |
| | | if ( |
| | | a >= orderdetails[i].Shipment_Count__c && |
| | | orderdetails[i].Box_Piece__c == '个' |
| | | ) { |
| | | } else if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | if (a >= orderdetails[i].Shipment_Count__c && orderdetails[i].Box_Piece__c == '个') { |
| | | // 跳过超过数量的消耗品明细 |
| | | continue; |
| | | } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) { |
| | |
| | | // String str = '该商品超出订货数量'; |
| | | String str = '该产品超出出库单产品范围'; |
| | | //CHAN-C23BWX update by rentx 2021-04-28 end |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(newdet2[j], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品未到货确认'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | (Dealer_Saled__c = TRUE |
| | | OR Dealer_Shipment__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c IN :exitlist |
| | | WHERE (Dealer_Saled__c = TRUE OR Dealer_Shipment__c = TRUE) AND Dealer_Returned__c = FALSE AND Bar_Code__c IN :exitlist |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if ( |
| | | errorIdMap.containsKey(reSet1[i].Bar_Code__c) || |
| | | existIdMap.containsKey(reSet1[i].Bar_Code__c) |
| | | ) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出货'; |
| | | consumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | |
| | | } |
| | | if (notexitlist.size() > 0) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode号'+ notexitlist + '不存在。')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | 'BarCode号' + notexitlist + '不存在。', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, 'BarCode号' + notexitlist + '不存在。', ''); |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put( |
| | | 'consumableorderdetailsRecordserror', |
| | | consumableorderdetailsRecordserror |
| | | ); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | |
| | | ) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '请输入产品 ' + ass.Prod.Name + ' 的出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '请输入产品 ' + ass.Prod.Name + ' 的出货数量', ''); |
| | | } |
| | | if (ass.outboundCount > deliverycnt) { |
| | | // ass.orderdetails2.Rrturn_count__c.addError('超出出库数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | ass.orderdetails2.Name + '超出出库数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Decimal a = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if ( |
| | | ass.orderdetails2.Product_Pattern__c == |
| | | orderdetails[i].Product_Pattern__c |
| | | ) { |
| | | if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | a = a + ass.outboundCount; |
| | | } |
| | | } |
| | |
| | | if (a < orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'数量小于出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '商品' + |
| | | orderdetails[i].Consumable_product__r.Name + |
| | | '数量小于出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '数量小于出货数量', ''); |
| | | } else if (a > orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'超出出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', ''); |
| | | } |
| | | } |
| | | List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>(); |
| | |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i] |
| | | .RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment; |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | for ( |
| | | Consumable_order_details2__c codctmp : consumableorderdetails2Nobox |
| | | ) { |
| | | for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | insDetails.Id = codctmp.Id; |
| | | insDetails.Consumable_Sale_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Consumable_Shipment_order__c = ESetId; |
| | | insDetails.Send_Date__c = Date.today(); |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == |
| | | null |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == |
| | | null |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null |
| | | ? coc.Dealer_Info__r.Name |
| | | : ass.orderdetails2.Frist_Transfer_Agency__c; |
| | | insDetails.Agency_Transfer__c = true; |
| | |
| | | insDetails.Consumable_Sale_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Consumable_Shipment_order__c = ESetId; |
| | | insDetails.Send_Date__c = Date.today(); |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == |
| | | null |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == |
| | | null |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null |
| | | ? coc.Dealer_Info__r.Name |
| | | : ass.orderdetails2.Frist_Transfer_Agency__c; |
| | | insDetails.Agency_Transfer__c = true; |
| | |
| | | System.debug('barcode = ' + barcode); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug( |
| | | 'consumableorderdetailsRecords = ' + consumableorderdetailsRecords |
| | | ); |
| | | System.debug('consumableorderdetailsRecords = ' + consumableorderdetailsRecords); |
| | | System.debug('orderdetails = ' + orderdetails); |
| | | System.debug('orderpriceMap = ' + orderpriceMap); |
| | | System.debug('orderagencypriceMap = ' + orderagencypriceMap); |
| | |
| | | ) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量')); |
| | | // return null; |
| | | System.debug( |
| | | 'ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c |
| | | ); |
| | | System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c); |
| | | System.debug('ass.outboundCount = ' + ass.outboundCount); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '请输入产品 ' + ass.Prod.Name + ' 的出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '请输入产品 ' + ass.Prod.Name + ' 的出货数量', ''); |
| | | } |
| | | if (ass.outboundCount > deliverycnt) { |
| | | // ass.orderdetails2.Rrturn_count__c.addError('超出出库数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | ass.orderdetails2.Name + '超出出库数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Decimal a = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if ( |
| | | ass.orderdetails2.Product_Pattern__c == |
| | | orderdetails[i].Product_Pattern__c |
| | | ) { |
| | | if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | a = a + ass.outboundCount; |
| | | } |
| | | } |
| | | if (a < orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'数量小于出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '商品' + |
| | | orderdetails[i].Consumable_product__r.Name + |
| | | '数量小于出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '数量小于出货数量', ''); |
| | | } else if (a > orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'超出出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', ''); |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i] |
| | | .RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | for ( |
| | | Consumable_order_details2__c codctmp : consumableorderdetails2Nobox |
| | | ) { |
| | | for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | insDetails.Id = codctmp.Id; |
| | |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | if ( |
| | | orderagencypriceMap.containsKey( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ) == true |
| | | ) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | } |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | if ( |
| | | orderagencypriceMap.containsKey( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ) == true |
| | | ) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get( |
| | | ass.orderdetails2.Product_Pattern__c |
| | | ); |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | } |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | e.getMessage() + e.getStackTraceString(), |
| | | '' |
| | | ); |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | |
| | | @AuraEnabled |
| | | public Decimal outboundCount { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo( |
| | | Consumable_order_details2__c e, |
| | | string str |
| | | ) { |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) { |
| | | orderdetails1 = new Consumable_orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |