| New file |
| | |
| | | public without sharing class LexArriveGoodsMainController { |
| | | /*****************検索用******************/ |
| | | //经销商产品分类 |
| | | public static String agencyProType {get;set;} |
| | | // public static Consumable_order__c coc { get; set; } |
| | | public static String category1 { get; set; } |
| | | private static String cate1ForSort = null; |
| | | private static Date cate2ForSort = Date.today(); |
| | | private static Date cate2 = Date.today(); |
| | | private static String[] columus = new String[]{ 'Product2__c.Name'}; |
| | | // 产品 ID |
| | | private static String ESetId = ''; |
| | | private static String accountid = null; |
| | | // 订单 字段标签 |
| | | public static List<String> title { get; private set; } |
| | | // 订单 字段名 |
| | | public static List<String> column; |
| | | public static List<List<String>> columns { get; private set; } |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 20200904 ljh 汇总使用 start |
| | | public static Integer Total_num {get; set;} |
| | | public static Integer OrderNumber_arrived {get; set;} |
| | | public static Integer Delivery_detail_count {get; set;} |
| | | public static Integer OrderNumber_notarrive {get; set;} |
| | | public static Integer More_than_seven_days {get; set;} |
| | | |
| | | @AuraEnabled |
| | | public static Results init(){ |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | List<String> idList = new List<String>(); |
| | | idList.add('a2K10000002zHyDEAU'); |
| | | idList.add('a2K10000002zIJEEA2'); |
| | | idList.add('a2K10000002zK9rEAE'); |
| | | idList.add('a2K10000004AKGBEA4'); |
| | | idList.add('a2K10000004ALqeEAG'); |
| | | idList.add('a2K10000004AMmrEAG'); |
| | | idList.add('a2K10000004ANvDEAW'); |
| | | idList.add('a2K10000004AOVxEAO'); |
| | | idList.add('a2K10000004AOJZEA4'); |
| | | idList.add('a2K10000004AOLuEAO'); |
| | | idList.add('a2K10000004AOLfEAO'); |
| | | // coc = new Consumable_order__c(); |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> Useracc = New List<user>(); |
| | | Useracc = [select accountid, Work_Location__c,UserPro_Type__c from user where id =:userId]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Order_ProType__c =\'' + agencyProType +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' and showFalseNotshowTrue__c = false order by Deliver_date__c'; // |
| | | // soql = 'select id,name,ContractNo__c,Total_num__c,OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,More_than_seven_days__c,Shipment_date__c,First_Delivery__c from Consumable_order__c where id in :idList'; |
| | | raesList = Database.query(soql); |
| | | //20200904 ljh add start |
| | | Total_num = 0; |
| | | OrderNumber_arrived = 0; |
| | | Delivery_detail_count = 0; |
| | | OrderNumber_notarrive = 0; |
| | | More_than_seven_days = 0; |
| | | System.debug('-----1------'+raesList); |
| | | for(Consumable_order__c conorder :raesList){ |
| | | if(conorder.Total_num__c != null){ |
| | | Total_num += (Integer)conorder.Total_num__c; |
| | | } |
| | | if(conorder.OrderNumber_arrived__c != null){ |
| | | OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c; |
| | | } |
| | | if(conorder.Delivery_detail_count__c != null){ |
| | | Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c; |
| | | } |
| | | if(conorder.OrderNumber_notarrive__c != null){ |
| | | OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c; |
| | | } |
| | | if(conorder.More_than_seven_days__c != null){ |
| | | More_than_seven_days += (Integer)conorder.More_than_seven_days__c; |
| | | } |
| | | } |
| | | results.agencyProType = agencyProType; |
| | | results.accountId = accountid; |
| | | results.title = title; |
| | | results.raesList = raesList; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.totalNum = Total_num; |
| | | results.orderNumberArrived = OrderNumber_arrived; |
| | | results.deliveryDetailCount = Delivery_detail_count; |
| | | results.orderNumberNotarrive = OrderNumber_notarrive; |
| | | results.moreThanSevenDays = More_than_seven_days; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails(String category1Str, Date cate2Str, String accountidStr, String userWorkLocationStr, String agencyProTypeStr){ |
| | | Results results = new Results(); |
| | | category1 = category1Str; |
| | | cate2 = cate2Str; |
| | | accountid = accountidStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | agencyProType = agencyProTypeStr; |
| | | try { |
| | | // cate2 = coc.Shipment_date__c; |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) '; |
| | | soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += 'and showFalseNotshowTrue__c = false'; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if(cate2 != null){ |
| | | soql += ' and Shipment_date__c = :cate2 '; |
| | | } |
| | | soql += ' and Order_ProType__c =\'' + agencyProType +'\''; |
| | | soql += ' order by Deliver_date__c'; |
| | | system.debug('====soql:' + soql); |
| | | raesList = Database.query(soql); |
| | | results.raesList = raesList; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String category1; |
| | | @AuraEnabled |
| | | public Date cate2; |
| | | @AuraEnabled |
| | | public String eSetId; |
| | | @AuraEnabled |
| | | public String accountId; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public Integer totalNum; |
| | | @AuraEnabled |
| | | public Integer orderNumberArrived; |
| | | @AuraEnabled |
| | | public Integer deliveryDetailCount; |
| | | @AuraEnabled |
| | | public Integer orderNumberNotarrive; |
| | | @AuraEnabled |
| | | public Integer moreThanSevenDays; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexArriveGsDetailsController { |
| | | public static Consumable_order__c coc { get; set; } |
| | | private static String accountid = null; |
| | | private static Decimal orderallcount = 0; |
| | | public static Boolean arrivetoorder { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } |
| | | private static String eSetId = ''; |
| | | private static Integer consumableorderdetailsCount = null; |
| | | |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static Results init(String eSetIdStr) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | eSetId = eSetIdStr; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | try { |
| | | //取经销商信息 |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> useracc = New List<user>(); |
| | | useracc = [select accountid from user where id =:userId]; |
| | | accountid = useracc[0].accountid; |
| | | List<Consumable_order__c> rs = New List<Consumable_order__c>(); |
| | | if(eSetId == NULL || eSetId == '') { |
| | | |
| | | }else { |
| | | rs = [SELECT id,name,Order_reason__c,Arrive_Order__c,Arrive_Order__r.Total_num__c,Arrive_Order__r.IsShipment__c,Arrive_Order__r.Name, |
| | | recordtypeid,Order_status__c,Deliver_date__c,Arrive_total_amount__c |
| | | FROM Consumable_order__c |
| | | WHERE id =:eSetId]; |
| | | coc = new Consumable_order__c(); |
| | | if(rs.size()>0){ |
| | | coc = rs[0]; |
| | | orderallcount = coc.Arrive_Order__r.Total_num__c; |
| | | } |
| | | if(coc.Arrive_Order__c == null){ |
| | | arrivetoorder = true; |
| | | } |
| | | List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [SELECT Id,Dealer_Arrive__c,Bar_Code__c, RecordTypeid, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name,Dealer_Saled__c, |
| | | Sterilization_limit__c,Deliver_date__c, |
| | | Intra_Trade_List_RMB__c,Asset_Model_No__c,Arrive_Date__c,Send_Date__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Product2__r.Packing_list_manual__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_Arrived_order__c = :eSetId |
| | | ORDER BY Name ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){ |
| | | bss.packing_list = bss.Prod.Product2__r.Packing_list_manual__c; |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | //update by rentx 20210622 start CHAN-C3K4ZQ |
| | | bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null ? '' : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format(); |
| | | bss.Sterilization_limitStr = bss.esd.Sterilization_limit__c == null ? '' : bss.esd.Sterilization_limit__c.format(); |
| | | //update by rentx 20210622 end CHAN-C3K4ZQ |
| | | } |
| | | consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | //add by rentx 20210622 CHAN-C3K4ZQ |
| | | // makeRecordsView(consumableorderdetailsRecords); |
| | | //add by rentx 20210622 CHAN- |
| | | for(ConsumableorderdetailsInfo con : consumableorderdetailsRecords){ |
| | | con.prodName = con.esd.Consumable_Product__r.Name__c; |
| | | } |
| | | results.coc = coc; |
| | | results.accountid = accountid; |
| | | results.orderallcount = orderallcount; |
| | | results.arrivetoorder = arrivetoorder; |
| | | results.consumableorderdetailsRecords = consumableorderdetailsRecords; |
| | | results.consumableorderdetailsCount = consumableorderdetailsCount; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //出库 |
| | | @AuraEnabled |
| | | public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm) { |
| | | Results results = new Results(); |
| | | try { |
| | | orderallcount = orderallcountParm; |
| | | consumableorderdetailsCount = consumableorderdetailsCountParm; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>(); |
| | | //发货明细2 |
| | | orderdetails = [SELECT Id |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_order_minor__c =:coc.Arrive_Order__c |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = true ]; |
| | | if(orderallcount!= consumableorderdetailsCount){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '订单不完全到货,无法出库'; |
| | | return results; |
| | | } |
| | | if(coc.Arrive_Order__r.IsShipment__c == true){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '订单已经出库'; |
| | | return results; |
| | | } |
| | | results.url = '/lexsummonscreat?arriveorder=' + eSetId +'&KeyWords=Redirect'; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public Decimal orderallcount; |
| | | @AuraEnabled |
| | | public Boolean arrivetoorder; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords; |
| | | @AuraEnabled |
| | | public Integer consumableorderdetailsCount; |
| | | @AuraEnabled |
| | | public String url; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd; |
| | | @AuraEnabled |
| | | public Product2__c Prod; |
| | | @AuraEnabled |
| | | public Decimal packing_list; |
| | | @AuraEnabled |
| | | public Date expiration_Date; |
| | | @AuraEnabled |
| | | public String approbation_No; |
| | | @AuraEnabled |
| | | public String expiration_DateStr; |
| | | @AuraEnabled |
| | | public String Sterilization_limitStr; |
| | | @AuraEnabled |
| | | public String prodName; |
| | | |
| | | |
| | | // 已存在消耗品明细用 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 排序Consumable_order__c |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexCancelRemoveBoxController { |
| | | //经销商产品分类 |
| | | public static String agencyProType {get;set;} |
| | | public static String userPro_Typestr = null; |
| | | public static String barcode { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; } |
| | | //错误明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; } |
| | | //拆盒明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; } |
| | | public static boolean saveFLGbln {get;set;} |
| | | //错误信息 |
| | | public static String alertMessage {set;get;} |
| | | //拆盒明细件数 |
| | | public static Integer getinventorysize(){ |
| | | return ConsumableorderdetailsRecordsdummy.size(); |
| | | } |
| | | public static Map<String, String> ExistIdMap = new Map<String, String>(); |
| | | public static Map<String, String> ErrorIdMap = new Map<String, String>(); |
| | | public static Map<String, String> AllMap = new Map<String, String>(); |
| | | public static List<String> BarCodeListP = new List<String>(); |
| | | //不符合的barcode和型号 |
| | | public static list<String> notInlist = new list<String>(); |
| | | public static String baseUrl {get;private set;} |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | //public String[] proidList =new String[]{}; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | |
| | | public LexCancelRemoveBoxController(){ |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInventory = new List<ConsumableorderdetailsInfo>(); |
| | | saveFLGbln = FALSE; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> Useracc = New List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid]; |
| | | //String view_product = accountInfo[0].view_product__c; |
| | | accountName = accountInfo[0].Name; |
| | | //proidList = view_product.split(','); |
| | | data.put('accountName',accountName); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | public static List<String> ParseBarCode(String Code){ |
| | | String[] Cache = new String[]{}; |
| | | Cache = Code.split('\n'); |
| | | Set <String> Buff = new Set<String>(); |
| | | for(String A : Cache){ |
| | | Buff.add(A); |
| | | } |
| | | List<String> outPut = new List<String>(); |
| | | for(String B :Buff){ |
| | | B = B.trim(); |
| | | outPut.add(B); |
| | | } |
| | | return outPut; |
| | | } |
| | | |
| | | //获取明细 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | barcode = barcode; |
| | | accountName = accountName; |
| | | userWorkLocation = userWorkLocation; |
| | | |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | |
| | | |
| | | notInlist = new list<String>(); |
| | | BarCodeListP = ParseBarCode(barcode); |
| | | Consumable_order_details2__c p = new Consumable_order_details2__c(); |
| | | 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>(); |
| | | saveFLGbln = FALSE; |
| | | alertMessage=''; |
| | | |
| | | //判断barcode是否为空 |
| | | if(barcode == null || barcode ==''){ |
| | | return new ResponseBodyLWC('Error',500, '请输入BarCode号', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。')); |
| | | // return; |
| | | } |
| | | |
| | | // ExistIdMap.clear(); |
| | | // ErrorIdMap.clear(); |
| | | // notInlist.clear(); |
| | | // ConsumableorderdetailsRecordserror.clear(); |
| | | // ConsumableorderdetailsRecordsdummy.clear(); |
| | | |
| | | // 产品类型不同 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c,Product_Type__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | AND (not Product_Type__c like : userPro_Typestr) |
| | | ORDER BY Name ]; |
| | | 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 +'与产品类型'+ agencyProType +'不符,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //没有拆盒 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | //AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,在库,没有拆盒 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品没有拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已出货,未到货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = FALSE |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品还未到货'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒已出货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Shipment__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在出货履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒已销售 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Saled__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在销售履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒返品 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Returned__c = true |
| | | AND Return_date__c != null |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在返品履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //拆盒后盘点过(盘点日期不为空) |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Inventory_date__c != null |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在盘点履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //不同工作地 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c !=: userWorkLocation |
| | | ORDER BY Name ]; |
| | | 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].Arrive_Owner_Work_Location__c + ',不能取消拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet = [SELECT Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__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, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | if(reSet.size()>0){ |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过错误的消耗品明细 |
| | | continue; |
| | | } |
| | | else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } |
| | | else{ |
| | | ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i])); |
| | | ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | AllMap.putAll(ExistIdMap); |
| | | |
| | | //得到不存在的BarCode |
| | | for(Integer i = 0; i < BarCodeListP.size(); i++){ |
| | | if(ExistIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else if(ErrorIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else{ |
| | | notInlist.add(BarCodeListP[i]); |
| | | } |
| | | } |
| | | if(notInlist.size()>0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。')); |
| | | return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在。', ''); |
| | | } |
| | | data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy)); |
| | | data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror)); |
| | | data.put('dataSize',ConsumableorderdetailsRecordsdummy.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | //取消拆盒确认 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC cancelRemoveBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | accountName = accountName; |
| | | userWorkLocation =userWorkLocation; |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class); |
| | | |
| | | |
| | | List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>(); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | if(ConsumableorderdetailsRecordsdummy.size()<1){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在取消拆盒明细')); |
| | | return new ResponseBodyLWC('Error',500, '不存在取消拆盒明细', ''); |
| | | // return null; |
| | | } |
| | | |
| | | List<String> BarCodeList = new List<String>(); |
| | | for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) { |
| | | BarCodeList.add(tmp.esd.Bar_Code__c); |
| | | } |
| | | |
| | | try{ |
| | | //取得通番大于001的在库明细 |
| | | List<Consumable_order_details2__c> orderDetails2del = [SELECT |
| | | Id, |
| | | Box_Piece__c, |
| | | RemoveBox_date__c, |
| | | RemoveBox_No__c, |
| | | Bar_Code__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND RemoveBox_No__c > 1 |
| | | AND Bar_Code__c in :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | |
| | | List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> orderlistupd= new List<Consumable_order_details2__c>(); |
| | | |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2del) { |
| | | Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c(); |
| | | delDetails2.Id = detail2tmp.Id; |
| | | |
| | | //删除通番大于001的明细2 |
| | | //delete delDetails2; |
| | | orderlistdel.add(delDetails2); |
| | | } |
| | | |
| | | //取得通番001的在库明细 |
| | | List<Consumable_order_details2__c> orderDetails2 = [SELECT |
| | | Id, |
| | | Box_Piece__c, |
| | | RemoveBox_date__c, |
| | | RemoveBox_No__c, |
| | | Bar_Code__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rebtx 2020-10-13 end |
| | | // tcm start |
| | | ,Consumable_order_minor__r.ContractNo__c |
| | | // tcm end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c !=null |
| | | AND RemoveBox_No__c = 1 |
| | | AND Bar_Code__c in :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2) { |
| | | Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c(); |
| | | updDetails2.Id = detail2tmp.Id; |
| | | updDetails2.Box_Piece__c = '盒'; |
| | | updDetails2.RemoveBox_date__c = null; |
| | | updDetails2.RemoveBox_No__c = null; |
| | | |
| | | // tcm start |
| | | if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) { |
| | | updDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c; |
| | | }else { |
| | | updDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c; |
| | | } |
| | | // updDetails2.ContractNo_text__c = detail2tmp.ContractNo__c; |
| | | // tcm end |
| | | |
| | | //通番001のデータの管理単位を盒に戻し、通番をクリア |
| | | //update updDetails2; |
| | | orderlistupd.add(updDetails2); |
| | | } |
| | | |
| | | if(orderlistdel.size()>0){ |
| | | delete orderlistdel; |
| | | } |
| | | |
| | | if(orderlistupd.size()>0){ |
| | | update orderlistupd; |
| | | } |
| | | saveFLGbln = true; |
| | | alertMessage = '取消拆盒完成'; |
| | | data.put('saveFLGbln',saveFLGbln); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = alertMessage; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // return null; |
| | | }catch(Exception e){ |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | public Product2__c Prod { get; set; } |
| | | //public String ProductName { get; set; } |
| | | //public Boolean canSELECT { get; set; } |
| | | //public String barCodeNo { get; set; } |
| | | //public Date sterilizationlimitDate { get; set; } |
| | | //public String serialNoorLotNo { get; set; } |
| | | //public String tracingCodeNo { get; set; } |
| | | public String oldConsumableCount { get; set; } |
| | | public String ErrorReason { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | } |
| | | /* |
| | | public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | esd = new Consumable_order_details2__c(); |
| | | ProductName = e.Name__c; |
| | | Prod = e; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | //esd = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | //ProductName = productName; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | */ |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexConInvoiceList { |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String agencyProType { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static String category2 { get; set; } |
| | | //发票开始、结束日期 |
| | | private static Date cate1 { get; set; } |
| | | private static Date cate2 { get; set; } |
| | | // 登录用户 ID |
| | | private static String userinfoId { get; set; } |
| | | private static String invoiceStatus { get; set; } |
| | | //经销商id |
| | | private static String accountid { get; set; } |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | //排序使用 |
| | | private static String[] orderby = new List<String>{ 'Invoice_Date__c', 'Name', 'ShipmentAccount__c' }; |
| | | public static String sortKey { get; set; } |
| | | public static String preSortKey { get; private set; } |
| | | public static Boolean sortOrderAsc { get; private set; } |
| | | public static String[] sortOrder { get; private set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation { get; set; } |
| | | public static Map<String, String> statusMap { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | statusMap = new Map<String, String>(); |
| | | raesList = new List<Consumable_order__c>(); |
| | | coc = new Consumable_order__c(); |
| | | cate1 = coc.Order_date__c; |
| | | cate2 = coc.Deliver_date__c; |
| | | userinfoId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | invoiceStatus = coc.Invoice_status__c; |
| | | String soql = makeSoql(category1, category2, invoiceStatus); |
| | | raesList = Database.query(soql); |
| | | |
| | | statusMap = getPicklistValues('Consumable_order__c', 'Invoice_status__c'); |
| | | |
| | | data.put('userinfoId', userinfoId); |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('raesList', raesList); |
| | | data.put('statusMap', statusMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 发票单检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC invoiceCodeSearch( |
| | | Date orderDateLwc, |
| | | Date deliverDateLwc, |
| | | String invoiceStatusLwc, |
| | | String category1Lwc, |
| | | String category2Lwc, |
| | | String accountidLwc, |
| | | String userWorkLocationLwc, |
| | | String agencyProTypeLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | cate1 = orderDateLwc; |
| | | cate2 = deliverDateLwc; |
| | | invoiceStatus = invoiceStatusLwc; |
| | | category1 = category1Lwc; |
| | | category2 = category2Lwc; |
| | | accountid = accountidLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | // 获得发票一览 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = makeSoql(category1, category2, invoiceStatus); |
| | | raesList = Database.query(soql); |
| | | // if(raesList.size()>0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共检索到' + raesList.size() + '个发票')); |
| | | // }else{ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有搜索到相关发票。')); |
| | | // } |
| | | data.put('raesList', raesList); |
| | | data.put('raesListSize', raesList.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 做成检索SQL文 |
| | | private static String makeSoql(String invoiceCode, String accountName, String invoiceStatus) { |
| | | String soql = 'SELECT Id, Name,Invoice_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Invoice_status__c, '; |
| | | soql += ' InvoicedPro_total_amount__c,InvoiceNotPro_total_amount__c,Invoice_total_amount__c,Invoice_attachment__c,Invoicedet_attachment__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' AND recordtypeid = \'' + System.Label.RT_ConOrder_Invoice + '\''; |
| | | if (cate1 != null) { |
| | | soql += ' AND Invoice_Date__c >= :cate1 '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' AND Invoice_Date__c <= :cate2 '; |
| | | } |
| | | if (!String.isBlank(invoiceCode)) { |
| | | soql += ' AND Name like \'%' + String.escapeSingleQuotes(invoiceCode.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(accountName)) { |
| | | soql += ' AND ShipmentAccount__c like \'%' + String.escapeSingleQuotes(accountName.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(invoiceStatus)) { |
| | | soql += ' AND Invoice_status__c =\'' + invoiceStatus + '\' '; |
| | | } |
| | | System.debug('soql+++++' + soql); |
| | | return soql; |
| | | } |
| | | |
| | | /* |
| | | 通过sObjectName和指定字段获取PickList的value值 |
| | | */ |
| | | public static Map<String, String> getPicklistValues(String sObjectName, String sFieldName) { |
| | | Map<String, String> picValues = new Map<String, String>(); |
| | | picValues.put('-无-', ''); |
| | | Map<String, Schema.SObjectType> sObjectDescribeMap = Schema.getGlobalDescribe(); |
| | | if (sObjectDescribeMap.containsKey(sObjectName)) { |
| | | Map<String, Schema.SobjectField> sObjectFieldsMap = sObjectDescribeMap.get(sObjectName).getDescribe().fields.getMap(); |
| | | if (sObjectFieldsMap.containsKey(sFieldName)) { |
| | | Schema.DescribeFieldResult sObjectFieldDescribe = sObjectFieldsMap.get(sFieldName).getDescribe(); |
| | | List<Schema.PicklistEntry> lPickEntryList = sObjectFieldDescribe.getPicklistValues(); |
| | | //tPicklistEntry.isDefaultValue() |
| | | for (Schema.PicklistEntry tPicklistEntry : lPickEntryList) { |
| | | picValues.put(tPicklistEntry.getLabel(), tPicklistEntry.getValue()); |
| | | } |
| | | } else { |
| | | //TODO 不存在此字段的执行 |
| | | } |
| | | } else { |
| | | // TODO 不存在此sObject的执行 |
| | | } |
| | | return picValues; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConInvoiceViewController { |
| | | public static String agencyProType { get; set; } |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static Consumable_order__c outbound { get; set; } |
| | | public static String invoiceId { get; set; } |
| | | public static String orderRemind { get; set; } |
| | | public static String deliveryId { get; set; } |
| | | public static String reopen { get; set; } |
| | | public static Decimal sumPrice { get; set; } |
| | | public static Boolean isChange { get; set; } |
| | | public static String accountid { get; set; } |
| | | public static String userId { get; set; } |
| | | public static String errorMsg { get; set; } |
| | | |
| | | public static Boolean getdone() { |
| | | return (invoiceOrderdetail1Recoeds.size() > 0); |
| | | } |
| | | |
| | | public static Boolean getExistOutbound() { |
| | | return (coc.Outbound_order__c != null); |
| | | } |
| | | |
| | | public static String getInvoiceName() { |
| | | return (coc.Name); |
| | | } |
| | | public static List<Consumable_Orderdetails__c> conoList { get; set; } |
| | | |
| | | public static String shipmentAccount { |
| | | get { |
| | | return (coc.ShipmentAccount__c); |
| | | } |
| | | } |
| | | public static String statusEdit = ''; |
| | | public static Boolean editAble { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderRecoeds { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderdetail1Recoeds { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderRecoedschange { get; set; } |
| | | public static List<InvoiceOrderInfo> attachmentRecoeds { get; set; } |
| | | public static List<Consumable_order__c> invoiceOrderList { get; set; } |
| | | public static List<Consumable_order__c> invoiceOrderSelectedList { get; set; } |
| | | public static Map<String, Decimal> ordermx1defaultMap { get; set; } |
| | | public static Map<String, Decimal> outorderMoneytMap { get; set; } |
| | | public static Map<String, Consumable_Orderdetails__c> outordercountMap { get; set; } |
| | | public static List<String> outOrderStringList { get; set; } |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | public static Map<String, String> provinceOptsMap { get; set; } |
| | | public static String SecondDealer { get; set; } |
| | | public static String HospitalInfo { get; set; } |
| | | public static String HospitalName { get; set; } |
| | | |
| | | public static Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size(); |
| | | } |
| | | } |
| | | |
| | | public static list<Dealer_elationship__c> Dealerelationship { get; set; } |
| | | public static String[] orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' }; |
| | | public static String sortKey { get; set; } |
| | | public static String preSortKey { get; set; } |
| | | public static Boolean sortOrderAsc { get; set; } |
| | | public static String[] sortOrder { get; set; } |
| | | public static String userWorkLocation { get; set; } |
| | | |
| | | //页面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String invoiceId, String statusEdit, String deliveryId) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | invoiceOrderRecoeds = new List<InvoiceOrderInfo>(); |
| | | attachmentRecoeds = new List<InvoiceOrderInfo>(); |
| | | invoiceOrderdetail1Recoeds = new List<InvoiceOrderInfo>(); |
| | | invoiceOrderRecoedschange = new List<InvoiceOrderInfo>(); |
| | | orderRemind = ''; |
| | | isChange = false; |
| | | conoList = new List<Consumable_Orderdetails__c>(); |
| | | outorderMoneytMap = new Map<String, Decimal>(); |
| | | outOrderStringList = new List<String>(); |
| | | outordercountMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | sumPrice = 0; |
| | | // this.sortKey = '1'; |
| | | // this.preSortKey = '1'; |
| | | // this.sortOrderAsc = false; |
| | | // this.sortOrder = new List<String>(2); |
| | | // this.sortOrder = new List<String>{ ' ', ' ', ' ', ' ' }; |
| | | |
| | | invoiceId = invoiceId; |
| | | statusEdit = statusEdit; |
| | | deliveryId = deliveryId; |
| | | |
| | | if (invoiceId != null && invoiceId != '' && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = false; |
| | | } else if ((invoiceId == null || invoiceId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if (invoiceId != null && invoiceId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | coc = new Consumable_order__c(); |
| | | |
| | | Dealerelationship = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__c = :accountid |
| | | ]; |
| | | List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>(); |
| | | AgencyHospitalLink = [ |
| | | SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId |
| | | ]; |
| | | // 新規 |
| | | if (invoiceId == null || invoiceId == '') { |
| | | if (deliveryId == null || deliveryId == '') { |
| | | String msoql = makeSoql(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | } |
| | | } else { |
| | | if (statusEdit == '' || statusEdit == null) { |
| | | EditAble = false; |
| | | } else if (statusEdit != '' && statusEdit != null) { |
| | | EditAble = true; |
| | | } |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_ForHospital__r.Name, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId |
| | | ]; |
| | | coc.Name = ''; |
| | | if (coc.Order_ForDealer__c != null) { |
| | | SecondDealer = coc.Order_ForDealer__c; |
| | | } |
| | | |
| | | if (coc.Order_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | |
| | | //发票关联出库单取得(出库单) |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | } |
| | | } else { |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_ForHospital__r.Name, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId AND Order_type__c = '发票' |
| | | ]; |
| | | if (coc.Order_ForDealer__c != null) { |
| | | SecondDealer = coc.Order_ForDealer__c; |
| | | } |
| | | if (coc.Order_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | //到链接表中查找关联出库单 |
| | | List<Consumable_order_LinkTable__c> outOrderList = [ |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ]; |
| | | for (Integer i = 0; i < outOrderList.size(); i++) { |
| | | outOrderStringList.add(outOrderList[i].Outboundorder_Code_link__c); |
| | | } |
| | | //取得出库单信息 |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id IN :outOrderStringList AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | outorderMoneytMap.put(invoiceOrderSelectedList[i].id, 0); |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | if (String.isNotBlank(deliveryId)) { |
| | | //发票关联出库单取得(出库单) |
| | | isChange = true; |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | if (!outorderMoneytMap.containsKey(invoiceOrderSelectedList[i].Id)) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | invoiceOrderRecoedschange.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | } |
| | | } |
| | | //发票明细一览 |
| | | List<Consumable_Orderdetails__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_ZS_order__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Invoicedet1_OD_link__c, |
| | | Invoicedet1_OD_link__r.Name, |
| | | Consumable_order__r.Name, |
| | | Product_OutDate__c, |
| | | Asset_Model_No__c, |
| | | Invoice_Unitprice__c, |
| | | Delivery_List_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | InvoicedProCost_RMB__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ORDER BY Invoicedet1_OD_link__c |
| | | ]; |
| | | if (countDel.size() > 0) { |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | outordercountMap.put(countDel[i].Invoicedet1_OD_link__c + countDel[i].Asset_Model_No__c, countDel[i]); |
| | | if (outorderMoneytMap.containsKey(countDel[i].Invoicedet1_OD_link__c)) { |
| | | outorderMoneytMap.put( |
| | | countDel[i].Invoicedet1_OD_link__c, |
| | | outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) + countDel[i].InvoicedProCost_RMB__c |
| | | ); |
| | | } |
| | | invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i])); |
| | | } |
| | | } |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (outorderMoneytMap.containsKey(ass.esd.id)) { |
| | | ass.needInvoiceCount = outorderMoneytMap.get(ass.esd.id); |
| | | } |
| | | ass.check = true; |
| | | } |
| | | } |
| | | |
| | | if (SecondDealer == null || SecondDealer == '') { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } else { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__r.Name == SecondDealer) { |
| | | provinceOpts.add(new SelectOption(Dealerelationship[i].Dealer_subordinate__c, SecondDealer)); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, SecondDealer); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, String> consumableaccessoriesMap = new Map<String, String>(); |
| | | Map<String, String> invorceOrderIdMap = new Map<String, String>(); |
| | | List<Consumable_accessories_invoice__c> consumableaccessories = [ |
| | | SELECT Id, Name, Attachment_ID__c, Accessories_type__c |
| | | FROM Consumable_accessories_invoice__c |
| | | WHERE Invoice_code__c = :invoiceId |
| | | ]; |
| | | System.debug('consumableaccessories = ' + consumableaccessories); |
| | | if (consumableaccessories.size() > 0) { |
| | | for (Integer i = 0; i < consumableaccessories.size(); i++) { |
| | | consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c); |
| | | invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id); |
| | | } |
| | | } |
| | | |
| | | //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) { |
| | | ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id); |
| | | ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id); |
| | | } |
| | | } |
| | | data.put('EditAble', EditAble); |
| | | data.put('isChange', isChange); |
| | | data.put('coc', coc); |
| | | data.put('ExistOutbound', getExistOutbound()); |
| | | data.put('invoiceOrderRecoeds', invoiceOrderRecoeds); |
| | | data.put('provinceOptsMap', provinceOptsMap); |
| | | data.put('HospitalName', HospitalName); |
| | | data.put('HospitalInfo', HospitalInfo); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('done', getdone()); |
| | | data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds); |
| | | data.put('accountid', accountid); |
| | | data.put('invoiceOrderRecoedschange',invoiceOrderRecoedschange); |
| | | data.put('attachmentRecoeds',attachmentRecoeds); |
| | | data.put('outOrderStringList',outOrderStringList); |
| | | data.put('outordercountMap',outordercountMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | //保存 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save( |
| | | Consumable_order__c cocLwc, |
| | | String HospitalNameLwc, |
| | | String HospitalInfoLwc, |
| | | String SecondDealerLwc, |
| | | String invoiceOrderRecoedsLwc, |
| | | String deliveryIdLwc, |
| | | String invoiceIdLwc, |
| | | String accountidLwc, |
| | | String agencyProTypeLwc, |
| | | String reopenLwc, |
| | | String invoiceOrderRecoedschangeLwc |
| | | ) { |
| | | System.debug('enter LexConInvoiceViewController.save success'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalName = HospitalNameLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | System.debug('HospitalInfo = ' + HospitalInfo); |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | deliveryId = deliveryIdLwc; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | reopen = reopenLwc; |
| | | invoiceOrderRecoedschange = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class); |
| | | |
| | | List<String> chukudanID = new List<String>(); |
| | | if (coc.Name == '' || coc.Name == null) { |
| | | // coc.Name.addError('请录入发票号'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票号', ''); |
| | | } |
| | | if (coc.Invoice_Date__c == null) { |
| | | // coc.Invoice_Date__c.addError('请录入发票日期'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票日期', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) { |
| | | // coc.addError('必须输入客户名或者二级经销商'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入客户名或者二级经销商', ''); |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) { |
| | | //coc.addError('请输入客户名、二级经销商只可输入一个'); |
| | | errorMsg += '请输入客户名、二级经销商只可输入一个'; |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (coc.Order_ForCustomerText__c == null) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else { |
| | | if (coc.Order_ForCustomerText__c != null) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | } |
| | | String shipmentAccountString = ''; |
| | | if (HospitalInfo != null) { |
| | | shipmentAccountString = HospitalInfo; |
| | | } else if (String.isNotEmpty(SecondDealer)) { |
| | | shipmentAccountString = SecondDealer; |
| | | } else { |
| | | shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c; |
| | | } |
| | | |
| | | Integer x = 0; |
| | | List<String> invoiceOrderAccountList = new List<String>(); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (String.isBlank(deliveryId)) { |
| | | if (ass.check == true) { |
| | | x++; |
| | | System.debug(shipmentAccountString); |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (ass.esd.Order_ForHospital__c != shipmentAccountString) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | if ( |
| | | ass.esd.Order_ForDealer__c != shipmentAccountString && |
| | | ass.esd.Order_ForDealerText__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) { |
| | | if ( |
| | | (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') && |
| | | ass.esd.ShipmentAccount__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | |
| | | System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + ' ' + shipmentAccountString); |
| | | if (ass.esd.Order_ForHospital__c != shipmentAccountString) { |
| | | System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | //if (String.isNotEmpty(SecondDealer)) { |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | if (ass.esd.Order_ForDealer__c != shipmentAccountString) { |
| | | System.debug('String.isNotEmpty(SecondDealer) ass.esd.Order_ForHospital__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) { |
| | | if ( |
| | | (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') && |
| | | ass.esd.ShipmentAccount__c != shipmentAccountString |
| | | ) { |
| | | System.debug('HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // invoiceOrderAccountList.add('12345'); |
| | | if (invoiceOrderAccountList.size() > 0) { |
| | | orderRemind = invoiceOrderAccountList + '出库单客户名与发票客户名不一致!'; |
| | | // coc.addError(invoiceOrderAccountList + '出库单客户名与发票客户名不一致!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, invoiceOrderAccountList + '出库单客户名与发票客户名不一致!', ''); |
| | | } else { |
| | | orderRemind = ''; |
| | | } |
| | | if (String.isBlank(deliveryId)) { |
| | | if (x < 1) { |
| | | // coc.addError('请选择需要开发票的出库单!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请选择需要开发票的出库单!', ''); |
| | | } |
| | | } |
| | | Consumable_order__c invoiceHead = new Consumable_order__c(); |
| | | List<String> outOrderIdList = new List<String>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Map<String, String> insertDetMap = new Map<String, String>(); |
| | | Map<String, String> deleteDetMap = new Map<String, String>(); |
| | | //新建发票时 |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | if (String.isBlank(invoiceId)) { |
| | | invoiceHead.Name = coc.Name; |
| | | if (coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c)) |
| | | coc.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_type__c = '发票'; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //if (deliveryId != null) { |
| | | if (String.isNotBlank(deliveryId)) { |
| | | invoiceHead.Outbound_order__c = deliveryId; |
| | | } |
| | | invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | // if (SecondDealer == null) { |
| | | if (String.isBlank(SecondDealer)) { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | |
| | | insert invoiceHead; |
| | | |
| | | invoiceId = invoiceHead.Id; |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | invoiceHead = cocinfo[0]; |
| | | } |
| | | if (!String.isBlank(deliveryId)) { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } else { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (!String.isBlank(deliveryId)) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | if (ass.check == true) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | //deleteDetMap.put(ass.esd.Id,invoiceHead.Id); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'deleteDetMap +++++' + deleteDetMap.size())); |
| | | //return null; |
| | | if (insertDetMap.size() > 0) { |
| | | for (String field : insertDetMap.keySet()) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :field AND Invoice_Code_link__c = :insertDetMap.get(field) |
| | | ]; |
| | | if (existLinkinfo.size() < 1) { |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | upsert invoiceLinkList; |
| | | } |
| | | } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) { |
| | | System.debug('进入reopen'); |
| | | invoiceHead.Name = coc.Name; |
| | | invoiceHead.Order_type__c = '发票'; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //if (deliveryId != null) { |
| | | if (String.isNotBlank(deliveryId)) { |
| | | invoiceHead.Outbound_order__c = deliveryId; |
| | | } |
| | | invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | //if (SecondDealer == null) { |
| | | if (String.isBlank(SecondDealer)) { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | insert invoiceHead; |
| | | System.debug('invoiceHead = ' + invoiceHead); |
| | | |
| | | List<String> updateChukudanId = new List<String>(); |
| | | //获取原发票相关联的链接表信息 |
| | | List<Consumable_order_LinkTable__c> tLinkList = [ |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ]; |
| | | |
| | | for (Consumable_order_LinkTable__c colc : tLinkList) { |
| | | colc.Invoice_Code_link__c = invoiceHead.Id; |
| | | updateChukudanId.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | System.debug('tLinkList = ' + tLinkList); |
| | | update tLinkList; |
| | | //更新发票明细信息 |
| | | //获取出库单,设置关联关系 |
| | | //获取出库单明细信息,因为出库单信息和出库单明细信息是关联的,所有只需要回滚出库单明细信息即可 |
| | | |
| | | Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> tempCountList = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoicedet1_OD_link__c, |
| | | InvoicedProduct_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_BoxCount__c, |
| | | Invoice_Unit__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | for (Consumable_Orderdetails__c cocTemp : tempCountList) { |
| | | cocTemp.Consumable_order__c = invoiceHead.Id; |
| | | tempCocMap.put(cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c, cocTemp); |
| | | } |
| | | System.debug('tempCountList = ' + tempCountList); |
| | | update tempCountList; |
| | | List<Consumable_Orderdetails__c> updateFromList = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_order__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoice_Unitprice__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | Consumable_order__r.Invoice_total_amount__c, |
| | | ProductPacking_list_manual__c, |
| | | InvoicedProduct_RMB__c, |
| | | Invoiced_BoxCount__c, |
| | | Shipment_amount__c, |
| | | Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :updateChukudanId |
| | | ]; |
| | | for (Consumable_Orderdetails__c corderc : updateFromList) { |
| | | String tempStr = corderc.Consumable_order__c + corderc.Asset_Model_No__c; |
| | | if (tempCocMap.get(tempStr) != null) { |
| | | //设置已发票金额 出库单的已发票金额 - 发票的发票金额 |
| | | corderc.InvoicedProCost_RMB__c = corderc.InvoicedProCost_RMB__c - tempCocMap.get(tempStr).InvoicedProduct_RMB__c; |
| | | //设置已发票数量 出库单的已发票数量 - 发票的发票数量(盒) |
| | | corderc.Invoiced_Procount__c = corderc.Invoiced_Procount__c - tempCocMap.get(tempStr).Invoiced_BoxCount__c; |
| | | //设置发票单价 |
| | | if (corderc.Box_Piece__c == '盒' && corderc.Invoice_Unit__c == '个') { |
| | | corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c / corderc.ProductPacking_list_manual__c; |
| | | } else { |
| | | corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Consumable_order__c tempcoc = new Consumable_order__c(); |
| | | tempcoc.Id = invoiceId; |
| | | System.debug('tempcoc = ' + tempcoc); |
| | | delete tempcoc; |
| | | invoiceId = invoiceHead.Id; |
| | | System.debug('updateFromList = ' + updateFromList); |
| | | update updateFromList; |
| | | //-------------------------------------------------------------------------- |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | outOrderIdList.add(ass.esd.Id); |
| | | deleteDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } |
| | | if (outOrderIdList.size() > 0) { |
| | | getdefaultMapinfo(outOrderIdList); |
| | | } |
| | | //被选中的出库单集合 |
| | | if (insertDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | //存在没有与发票建立关联关系的出库单 |
| | | List<String> templist2 = new List<String>(); |
| | | for (Consumable_order_LinkTable__c colc : existLinkinfo) { |
| | | templist2.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | //获取该出库单 |
| | | for (String field : insertDetMap.keySet()) { |
| | | if (!templist2.contains(field)) { |
| | | //该出库单不存在与链接表中,新建链接 |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkList = ' + invoiceLinkList); |
| | | upsert invoiceLinkList; |
| | | } |
| | | //删除出库单链接表 |
| | | if (deleteDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>(); |
| | | deleteOutboundorder(deleteDetMap, invoiceHead.Id); |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | for (Consumable_order_LinkTable__c colctemp : existLinkinfo) { |
| | | if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) { |
| | | //存在与该发票关联的出库单 |
| | | invoiceLinkdetList.add(colctemp); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkdetList = ' + invoiceLinkdetList); |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | } else { |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-04 end |
| | | //编辑后保存 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | invoiceHead = cocinfo[0]; |
| | | } |
| | | if (String.isNotBlank(deliveryId)) { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | |
| | | //换货单产品数量 |
| | | Map<String, Decimal> needchangeOrderProcountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> returnProcountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> changeOrderProcountMap = new Map<String, Decimal>(); |
| | | List<Consumable_Orderdetails__c> detaliFromList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Invoice_Cost_RMB__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :deliveryId |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : detaliFromList) { |
| | | needchangeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c); |
| | | } |
| | | //发票返品信息 |
| | | List<Consumable_Orderdetails__c> returnCountList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | |
| | | for (Consumable_Orderdetails__c changeOD : returnCountList) { |
| | | if (changeOD.RrturnPro_count__c > 0) { |
| | | if (returnProcountMap.containsKey(changeOD.Asset_Model_No__c)) { |
| | | returnProcountMap.put( |
| | | changeOD.Asset_Model_No__c, |
| | | returnProcountMap.get(changeOD.Asset_Model_No__c) + changeOD.RrturnPro_count__c |
| | | ); |
| | | } else { |
| | | returnProcountMap.put(changeOD.Asset_Model_No__c, changeOD.RrturnPro_count__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已换货单出库数量信息 |
| | | List<Consumable_Orderdetails__c> returnCount1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | Consumable_order__c IN ( |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ) |
| | | AND Consumable_order__r.Onchange_order__c = TRUE |
| | | AND Consumable_order__c != :deliveryId |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : returnCount1List) { |
| | | changeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c); |
| | | } |
| | | outOrderchange(insertDetMap); |
| | | } else { |
| | | invoiceHead.Name = coc.Name; |
| | | invoiceHead.Invoice_status__c = coc.Invoice_status__c; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'HospitalName +++++' + HospitalName)); |
| | | //return null; |
| | | if (HospitalName != null && HospitalName != '') { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForHospital__c = null; |
| | | } |
| | | invoiceHead.Order_ForDealer__c = SecondDealer == '' ? null : SecondDealer; |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | update invoiceHead; |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | outOrderIdList.add(ass.esd.Id); |
| | | deleteDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } |
| | | if (outOrderIdList.size() > 0) { |
| | | getdefaultMapinfo(outOrderIdList); |
| | | } |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-08 start |
| | | //被选中的出库单集合 |
| | | if (insertDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | //存在没有与发票建立关联关系的出库单 |
| | | List<String> templist2 = new List<String>(); |
| | | for (Consumable_order_LinkTable__c colc : existLinkinfo) { |
| | | templist2.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | //获取该出库单 |
| | | for (String field : insertDetMap.keySet()) { |
| | | if (!templist2.contains(field)) { |
| | | //该出库单不存在与链接表中,新建链接 |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | upsert invoiceLinkList; |
| | | } |
| | | if (deleteDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>(); |
| | | deleteOutboundorder(deleteDetMap, invoiceHead.Id); |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | for (Consumable_order_LinkTable__c colctemp : existLinkinfo) { |
| | | if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) { |
| | | //存在与该发票关联的出库单 |
| | | invoiceLinkdetList.add(colctemp); |
| | | } |
| | | } |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(ex); |
| | | // return null; |
| | | System.debug('Exception ex = ' + ex.getMessage() + ex.getLineNumber()); |
| | | errorMsg += ex.getMessage() + ex.getLineNumber(); |
| | | } |
| | | data.put('invoiceId', invoiceId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void newinvoicedetails1(List<String> chukudanID) { |
| | | //新规发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>(); |
| | | //出库单明细更新 |
| | | List<Consumable_Orderdetails__c> outOrderList1 = new List<Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> detaliFromList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Consumable_Product__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Dealer_Custom_Price__c, |
| | | Sum_of_money__c, |
| | | Box_Piece__c, |
| | | Used_date__c, |
| | | Send_date__c, |
| | | Invoice_Unit__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :chukudanID AND InvoiceProNot_count__c > 0 |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < detaliFromList.size(); i++) { |
| | | Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c(); |
| | | invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c; |
| | | invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c; |
| | | String str = string.valueOf(i + 1); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | invoiceInsert1.Name = |
| | | coc.Name + |
| | | '-' + |
| | | detaliFromList[i].Name.substring(detaliFromList[i].Name.length() - 7, detaliFromList[i].Name.length()); |
| | | invoiceInsert1.Shipment_Count__c = detaliFromList[i].InvoiceProNot_count__c; |
| | | invoiceInsert1.Consumable_Product__c = detaliFromList[i].Consumable_Product__c; |
| | | invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i].Intra_Trade_List_RMB__c; |
| | | invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i].Delivery_List_RMB__c; |
| | | invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i].Dealer_Custom_Price__c; |
| | | invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | |
| | | if (detaliFromList[i].Box_Piece__c == '盒' && detaliFromList[i].Invoice_Unit__c == '个') { |
| | | invoiceInsert1.Invoice_Unitprice__c = |
| | | detaliFromList[i].Delivery_List_RMB__c / detaliFromList[i].ProductPacking_list_manual__c; |
| | | } else { |
| | | invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i].Delivery_List_RMB__c; |
| | | } |
| | | invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c; |
| | | invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c; |
| | | if (detaliFromList[i].Invoiced_Procount__c == null) |
| | | detaliFromList[i].Invoiced_Procount__c = 0; |
| | | if (detaliFromList[i].RrturnPro_count__c == null) |
| | | detaliFromList[i].RrturnPro_count__c = 0; |
| | | invoiceInsert1.Invoiced_Count__c = detaliFromList[i].InvoiceProNot_count__c; |
| | | if (detaliFromList[i].InvoicedProCost_RMB__c == null) |
| | | detaliFromList[i].InvoicedProCost_RMB__c = 0; |
| | | invoiceInsert1.InvoicedProCost_RMB__c = invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c; |
| | | invoiceInsert1.Consumable_order__c = invoiceId; |
| | | invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i].Consumable_order__c; |
| | | invoiceorderList1.add(invoiceInsert1); |
| | | } |
| | | System.debug('invoiceorderList1 +++++' + invoiceorderList1.size()); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | if (invoiceorderList1.size() > 0) { |
| | | try { |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | insert invoiceorderList1; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | //ApexPages.addMessages(ex); |
| | | errorMsg += ex.getMessage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void getdefaultMapinfo(List<String> orderIdList) { |
| | | List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>(); |
| | | existLinkinfo = [ |
| | | SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :orderIdList |
| | | ]; |
| | | // for (Integer i = 0; i < existLinkinfo.size(); i++) { |
| | | // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0); |
| | | // } |
| | | } |
| | | |
| | | public static void deleteOutboundorder(Map<String, String> deleteMap, String value) { |
| | | //删除发票明细1 |
| | | List<Consumable_Orderdetails__c> detInvoicedet1List = [ |
| | | SELECT Id, Consumable_Shipment_order__c, Consumable_Sale_order__c, Consumable_product__c, Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet() |
| | | ]; |
| | | System.debug('detInvoicedet1List = ' + detInvoicedet1List); |
| | | delete detInvoicedet1List; |
| | | } |
| | | |
| | | //换货单链接表 发票明细2做成 |
| | | public static void outOrderchange(Map<String, String> insertDetMap) { |
| | | List<string> chukudanID = new List<string>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | if (insertDetMap.size() > 0) { |
| | | for (String field : insertDetMap.keySet()) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :field |
| | | ]; |
| | | if (existLinkinfo.size() > 0) { |
| | | delete existLinkinfo; |
| | | } |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | p.Id = field; |
| | | p.ConInvoice_Code__c = insertDetMap.get(field); |
| | | p.Onchange_order__c = true; |
| | | update p; |
| | | } |
| | | insert invoiceLinkList; |
| | | } |
| | | //换货出库单明细1更新 |
| | | List<Consumable_Orderdetails__c> detaliFrom1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Consumable_Sale_order__r.Name, |
| | | Consumable_Shipment_order__r.Name |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :chukudanID |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : detaliFrom1List) { |
| | | changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c; |
| | | } |
| | | update detaliFrom1List; |
| | | } |
| | | |
| | | //上传ContentVersion附件 |
| | | @AuraEnabled |
| | | public static String saveFile(Id recordId, String fileName, String base64Data) { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = recordId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | System.debug('cv.Id = ' + cv.Id); |
| | | return cv.Id; |
| | | } |
| | | |
| | | // 保存附件 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC saveAttachment(String attachmentRecoedsLwc,String invoiceId) { |
| | | System.debug('进入 saveAttachment'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | invoiceId = invoiceId; |
| | | attachmentRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(attachmentRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | try { |
| | | Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c(); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (!String.isBlank(ass.mailSelectOptsin)) { |
| | | attachmentdetails.Id = ass.invoiceOrderId; |
| | | attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId; |
| | | attachmentdetails.Accessories_type__c = ass.mailSelectOptsin; |
| | | if (String.isBlank(ass.invoiceOrderId)) { |
| | | attachmentdetails.Invoice_code__c = invoiceId; |
| | | } |
| | | upsert attachmentdetails; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 检索(未开发票出库单) |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC InvoiceorderSearch(Consumable_order__c cocLwc,String invoiceIdLwc,String accountidLwc,String userWorkLocationLwc,String agencyProTypeLwc,String HospitalInfoLwc,String SecondDealerLwc,String invoiceOrderRecoedsLwc) { |
| | | System.debug('进入 InvoiceorderSearch'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | |
| | | Map<String, String> invoiceOrderMap = new Map<String, String>(); |
| | | String msoql = ''; |
| | | List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>(); |
| | | if (String.isBlank(invoiceId)) { |
| | | msoql = makeSoql(); |
| | | } else { |
| | | msoql = makeSoqlInit(); |
| | | } |
| | | invoiceOrderList = new List<Consumable_order__c>(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | invoiceOrderdetailMid.add(ass); |
| | | invoiceOrderMap.put(ass.esd.Name, ass.esd.Name); |
| | | } |
| | | } |
| | | invoiceOrderRecoeds = new List<InvoiceOrderInfo>(); |
| | | invoiceOrderRecoeds.addAll(invoiceOrderdetailMid); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) { |
| | | } else { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name); |
| | | } |
| | | } |
| | | data.put('invoiceOrderRecoeds',invoiceOrderRecoeds); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND Billed_Status__c != \'全部开票\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\''; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | private static String makeSoqlInit() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\' '; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (SecondDealer != null) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | // 删除按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC deleteButton(String invoiceIdLwc,Consumable_order__c cocLwc) { |
| | | System.debug('进入 deleteButton'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | system.debug('====invoiceId==========>' + invoiceId); |
| | | List<Consumable_Orderdetails__c> consList = [ |
| | | SELECT id, Consumable_order__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | try { |
| | | system.debug('====cons==========>' + consList); |
| | | delete consList; |
| | | if (coc.id == invoiceId && coc.Invoice_status__c == '草案中') { |
| | | delete coc; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | // 提交按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC approval(List<String> outOrderStringListLwc,Map<String, Consumable_Orderdetails__c> outordercountMapLwc,String invoiceIdLwc) { |
| | | System.debug('进入 approval'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | outOrderStringList = outOrderStringListLwc; |
| | | outordercountMap = outordercountMapLwc; |
| | | invoiceId= invoiceIdLwc; |
| | | //更新发票明细2链接 |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>(); |
| | | //更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>(); |
| | | //需要更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdet1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_order__r.Name, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :outOrderStringList |
| | | ]; |
| | | for (Integer i = 0; i < outOrderdet1List.size(); i++) { |
| | | if (outordercountMap.containsKey(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)) { |
| | | Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c(); |
| | | invoiceUpdte1.Id = outOrderdet1List[i].Id; |
| | | invoiceUpdte1.Invoice_Unit__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unit__c; |
| | | if ( |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c == |
| | | '盒' && |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c == |
| | | '个' |
| | | ) { |
| | | Decimal OldinvoicedProcount = 0; |
| | | OldinvoicedProcount = (outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c / |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .ProductPacking_list_manual__c) |
| | | .setScale(2); |
| | | invoiceUpdte1.Invoiced_Procount__c = outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount; |
| | | } else { |
| | | invoiceUpdte1.Invoiced_Procount__c = |
| | | outOrderdet1List[i].Invoiced_Procount__c + |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .Invoiced_Count__c; |
| | | } |
| | | invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unitprice__c; |
| | | invoiceUpdte1.InvoicedProCost_RMB__c = invoiceUpdte1.Invoiced_Procount__c * outOrderdet1List[i].Delivery_List_RMB__c; |
| | | |
| | | Decimal invoicedProcount = 0; |
| | | if ( |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c == |
| | | '盒' && |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c == |
| | | '个' |
| | | ) { |
| | | invoicedProcount = (outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c / |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .ProductPacking_list_manual__c) |
| | | .setScale(2); |
| | | } else { |
| | | invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .Invoiced_Count__c; |
| | | } |
| | | |
| | | if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.Error, |
| | | // '出库单' + |
| | | // outOrderdet1List[i].Consumable_order__r.Name + |
| | | // '中,' + |
| | | // outOrderdet1List[i].Asset_Model_No__c + |
| | | // '还没开票数量小于发票数量,请确认是否有返品' |
| | | // ) |
| | | // ); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '出库单' + outOrderdet1List[i].Consumable_order__r.Name + '中,' + outOrderdet1List[i].Asset_Model_No__c + '还没开票数量小于发票数量,请确认是否有返品', ''); |
| | | } |
| | | |
| | | outOrderdetUp1List.add(invoiceUpdte1); |
| | | } |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | //出库单明细1更新 |
| | | if (outOrderdetUp1List.size() > 0) { |
| | | ControllerUtil.updateOrderDetails1Satus(outOrderdetUp1List); |
| | | } |
| | | //发票状态更新 |
| | | cocinfo = [ |
| | | SELECT Id, Name, Invoice_status__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | System.debug('cocinfo = ' + cocinfo); |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | System.debug('p = ' + p); |
| | | p.Invoice_status__c = '提交'; |
| | | update p; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(ex); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, ex.getMessage() + ' ' + ex.getLineNumber(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | class InvoiceOrderInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c esdet { get; set; } |
| | | @AuraEnabled |
| | | public Attachment attach { get; set; } |
| | | @AuraEnabled |
| | | public ContentVersion cvInfo{ get; set; } |
| | | @AuraEnabled |
| | | public String mailSelectOptsin { get; set; } |
| | | public List<SelectOption> mailSelectOpts { get; set; } |
| | | @AuraEnabled |
| | | public Map<String,String> mailSelectOptsMap { get; set; } |
| | | @AuraEnabled |
| | | public String invoiceOrderId { get; set; } |
| | | @AuraEnabled |
| | | public Decimal needInvoiceCount { get; set; } |
| | | |
| | | // 出库订单 |
| | | public InvoiceOrderInfo(Consumable_order__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | esd = e; |
| | | needInvoiceCount = 0; |
| | | } |
| | | // 出库订单明细1 |
| | | public InvoiceOrderInfo(Consumable_Orderdetails__c e) { |
| | | esdet = e; |
| | | } |
| | | //附件 |
| | | public InvoiceOrderInfo(Attachment e) { |
| | | attach = e; |
| | | mailSelectOpts = new List<SelectOption>(); |
| | | mailSelectOpts.add(new SelectOption('发票和明细', '发票和明细')); |
| | | mailSelectOpts.add(new SelectOption('发票', '发票')); |
| | | mailSelectOpts.add(new SelectOption('明细', '明细')); |
| | | } |
| | | //ContentVersion |
| | | public InvoiceOrderInfo(ContentVersion cv) { |
| | | cvInfo = cv; |
| | | mailSelectOptsMap = new Map<String,String>(); |
| | | mailSelectOptsMap.put('发票和明细', '发票和明细'); |
| | | mailSelectOptsMap.put('发票', '发票'); |
| | | mailSelectOptsMap.put('明细', '明细'); |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexConInvoicedetailsController { |
| | | //出库单使用 |
| | | public static Consumable_order__c coc { get; set; } |
| | | |
| | | //发票使用 |
| | | public static Consumable_order__c invoicecode { get; set; } |
| | | |
| | | //价格计算结果 |
| | | public static Decimal sumPrice {get;set;} |
| | | |
| | | //出库单ID |
| | | private static String orderId {get;set;} |
| | | //发票单ID |
| | | private static String invoiceId {get;set;} |
| | | //出库单明细1,画面显示使用 |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; } |
| | | //明细数量 |
| | | public static Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size(); |
| | | } |
| | | } |
| | | |
| | | //页面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String orderIdLwc,String invoiceIdLwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | orderId = orderIdLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | consumableorderdetails1Records = new List<ConsumableorderdetailsInfo>(); |
| | | sumPrice = 0; |
| | | coc = new Consumable_order__c(); |
| | | //出库单信息 |
| | | coc = [SELECT Id, Name, Outbound_Date__c, Order_ForDealerText__c, Dealer_Info__c FROM Consumable_order__c WHERE Id = :orderId]; |
| | | //发票信息 |
| | | invoicecode = [ |
| | | SELECT Id, Name, ShipmentAccount__c, Order_ForCustomerText__c, Order_ForDealerText__c, Dealer_Info__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | //发票明细1 |
| | | Map<String, Consumable_Orderdetails__c> invoiceorderdet1CountMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> invoiceorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Invoicedet1_OD_link__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId |
| | | ]; |
| | | for (Integer i = 0; i < invoiceorderdetails1.size(); i++) { |
| | | invoiceorderdet1CountMap.put(invoiceorderdetails1[i].Asset_Model_No__c, invoiceorderdetails1[i]); |
| | | } |
| | | //出库单明细1,画面显示使用 |
| | | List<Consumable_Orderdetails__c> consumableorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Consumable_Product__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Dealer_Custom_Price__c, |
| | | Sum_of_money__c, |
| | | Used_date__c, |
| | | Send_date__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | Consumable_Product__r.Packing_list_manual__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :orderId |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails1.size(); i++) { |
| | | consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i])); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | if (invoiceorderdet1CountMap.containsKey(ass.esd.Asset_Model_No__c)) { |
| | | ass.check = true; |
| | | if ( |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == null || |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == '' |
| | | ) { |
| | | ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c; |
| | | } else { |
| | | ass.esd.Invoice_Unit__c = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c; |
| | | } |
| | | if ( |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == null || |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == 0 |
| | | ) { |
| | | ass.invoiceCount = ass.esd.Invoiced_Count__c; |
| | | } else { |
| | | ass.invoiceCount = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c; |
| | | } |
| | | |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | Decimal invoiceAllprice = 0.00; |
| | | invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c).setScale(2); |
| | | ass.invoiceAllprice = invoiceAllprice; |
| | | } else { |
| | | ass.invoiceCount = ass.esd.InvoiceProNot_count__c; |
| | | ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c; |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | } |
| | | data.put('invoicecode',invoicecode); |
| | | data.put('coc',coc); |
| | | data.put('consumableorderdetails1Records',consumableorderdetails1Records); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc,String invoiceIdLwc,String orderIdLwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | consumableorderdetails1Records= (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetails1RecordsLwc, List<ConsumableorderdetailsInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | orderId = orderIdLwc; |
| | | System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records); |
| | | System.debug('invoiceId = ' + invoiceId); |
| | | System.debug('orderId = ' + orderId); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | //新规发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>(); |
| | | //更新发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderUpList1 = new List<Consumable_Orderdetails__c>(); |
| | | //删除发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderDeList1 = new List<Consumable_Orderdetails__c>(); |
| | | |
| | | Map<String, Consumable_Orderdetails__c> invoiceordet1Map = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | List<String> consumableorderList = new List<String>(); |
| | | List<String> consumableNameList = new List<String>(); |
| | | try { |
| | | //更新出库单明细1 |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | consumableorderList.add(ass.esd.Asset_Model_No__c); |
| | | } |
| | | |
| | | //发票明细1获取 |
| | | List<Consumable_Orderdetails__c> invoiceorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Invoicedet1_OD_link__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId AND Asset_Model_No__c IN :consumableorderList |
| | | ]; |
| | | for (Integer i = 0; i < invoiceorderdetails1.size(); i++) { |
| | | invoiceordet1Map.put( |
| | | invoiceorderdetails1[i].Invoicedet1_OD_link__c + invoiceorderdetails1[i].Asset_Model_No__c, |
| | | invoiceorderdetails1[i] |
| | | ); |
| | | } |
| | | List<Consumable_Orderdetails__c> invoicedetails1count = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Invoicedet1_OD_link__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Sum_of_money__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Invoice_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | Integer invoiceRecordscon = invoicedetails1count.size() + 1; |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | if (ass.check == true && ass.invoiceCount > 0) { |
| | | if (String.isEmpty(String.valueOf(ass.invoiceCount))) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请输入发票数量!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入发票数量!', ''); |
| | | } |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | if (ass.invoiceCount > (ass.esd.InvoiceProNot_count__c * ass.Packing_list_manual).setScale(0)) { |
| | | // ass.esd.InvoiceProNot_count__c.addError('发票数量不能超过还没发票数量!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量不能超过还没发票数量!', ''); |
| | | } |
| | | } else { |
| | | if (ass.invoiceCount > ass.esd.InvoiceProNot_count__c) { |
| | | // ass.esd.InvoiceProNot_count__c.addError('发票数量不能超过还没发票数量!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量不能超过还没发票数量!', ''); |
| | | } |
| | | } |
| | | |
| | | //if(ass.esd.Invoice_Unit__c =='个'){ |
| | | String invoiceCount = String.valueOf(ass.invoiceCount); |
| | | if (!Pattern.matches('^\\+{0,1}[1-9]\\d*', invoiceCount)) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '发票数量必须是整数')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量必须是整数', ''); |
| | | } |
| | | //} |
| | | |
| | | if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Shipment_Count__c = ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoiced_Count__c = ass.invoiceCount; |
| | | //invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Delivery_List_RMB__c * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c) |
| | | .Invoice_Unit__c = ass.esd.Invoice_Unit__c; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Box_Piece__c = ass.esd.Box_Piece__c; |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = |
| | | (ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual) * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoice_Unitprice__c = |
| | | ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = |
| | | ass.esd.Delivery_List_RMB__c * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c) |
| | | .Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | |
| | | invoiceorderUpList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)); |
| | | invoiceRecordscon++; |
| | | } else { |
| | | String str = string.valueOf(invoiceRecordscon); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c(); |
| | | invoiceInsert1.Used_date__c = ass.esd.Used_date__c; |
| | | invoiceInsert1.Send_date__c = ass.esd.Send_date__c; |
| | | invoiceInsert1.Name = |
| | | invoicecode.Name + |
| | | '-' + |
| | | ass.esd.Name.substring(ass.esd.Name.length() - 7, ass.esd.Name.length()); |
| | | invoiceInsert1.Shipment_Count__c = ass.invoiceCount; |
| | | invoiceInsert1.Consumable_Product__c = ass.esd.Consumable_Product__c; |
| | | invoiceInsert1.Intra_Trade_List_RMB__c = ass.esd.Intra_Trade_List_RMB__c; |
| | | invoiceInsert1.Delivery_List_RMB__c = ass.esd.Delivery_List_RMB__c; |
| | | invoiceInsert1.Dealer_Custom_Price__c = ass.esd.Dealer_Custom_Price__c; |
| | | invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | //invoiceInsert1.Invoice_Unitprice__c = ass.esd.Invoice_Unitprice__c; |
| | | invoiceInsert1.Invoice_Unit__c = ass.esd.Invoice_Unit__c; |
| | | invoiceInsert1.Box_Piece__c = ass.esd.Box_Piece__c; |
| | | if (ass.esd.Invoiced_Procount__c == null) |
| | | ass.esd.Invoiced_Procount__c = 0; |
| | | invoiceInsert1.Invoiced_Count__c = ass.invoiceCount; |
| | | if (ass.esd.InvoicedProCost_RMB__c == null) |
| | | ass.esd.InvoicedProCost_RMB__c = 0; |
| | | invoiceInsert1.InvoicedProCost_RMB__c = ass.invoiceCount * invoiceInsert1.Invoice_Unitprice__c; |
| | | invoiceInsert1.Consumable_order__c = invoiceId; |
| | | invoiceInsert1.Invoicedet1_OD_link__c = orderId; |
| | | invoiceRecordscon++; |
| | | invoiceorderList1.add(invoiceInsert1); |
| | | } |
| | | } else { |
| | | if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) { |
| | | invoiceorderDeList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (invoiceorderList1.size() > 0) { |
| | | insert invoiceorderList1; |
| | | } |
| | | if (invoiceorderUpList1.size() > 0) { |
| | | update invoiceorderUpList1; |
| | | } |
| | | if (invoiceorderDeList1.size() > 0) { |
| | | delete invoiceorderDeList1; |
| | | } |
| | | } catch (Exception e) { |
| | | ApexPages.addmessages(e); |
| | | // Database.rollback(sp); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal invoiceCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal invoiceAllprice { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Packing_list_manual { get; set; } |
| | | public List<SelectOption> Invoice_UnitOpts { get; set; } |
| | | @AuraEnabled |
| | | public Map<String,String> Invoice_UnitOptsMap { get; set; } |
| | | // 消耗品产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | invoiceAllprice = 0; |
| | | |
| | | Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c; |
| | | |
| | | Invoice_UnitOpts = new List<SelectOption>(); |
| | | Invoice_UnitOpts.add(new SelectOption('盒', '盒')); |
| | | Invoice_UnitOpts.add(new SelectOption('个', '个')); |
| | | |
| | | Invoice_UnitOptsMap = new Map<String,String>(); |
| | | Invoice_UnitOptsMap.put('盒', '盒'); |
| | | Invoice_UnitOptsMap.put('个', '个'); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConsumableAccountController { |
| | | //经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType { get; set; } |
| | | public static String agencyProTypestr { get; set; } |
| | | //选项卡名称 |
| | | public static String filterName { get; set; } |
| | | //选项卡类型 |
| | | public static String hosptialType { get; set; } |
| | | public static ApexPages.StandardSetController setCon { get; set; } |
| | | //画面显示数量 |
| | | public static Integer size { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | //显示集合 |
| | | public static List<Account> pageRecords { get; set; } |
| | | //经销商信息 |
| | | private static String accountName { get; set; } |
| | | private static String accountId { get; set; } |
| | | //排序使用 |
| | | // public static String sortKey { get; set; } |
| | | // public static String preSortKey { get; private set; } |
| | | // public static Boolean sortOrderAsc { get; private set; } |
| | | // public static String[] sortOrder { get; private set; } |
| | | // //排序使用 |
| | | // private static String[] orderby = new String[]{ 'Name','State_Master__c','Salesdepartment_HP__c','CreatedDate','Is_Active__c','RecordType.Name','Grade__c','OCM_Category__c','City_Master__c','Town__c','Phone'}; |
| | | //上周开始、结束日期 |
| | | private static Datetime lastweekstart { get; set; } |
| | | private static Datetime lastweekend { get; set; } |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String fiscalYear) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | |
| | | User Useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid].id; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | agencyProTypestr = '%' + agencyProType + '%'; |
| | | System.debug('accountId = ' + accountId); |
| | | System.debug('agencyProTypestr = ' + agencyProTypestr); |
| | | List<Account> allSelectAccount = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | ]; |
| | | totalCount = allSelectAccount.size(); |
| | | |
| | | List<Account> selectAccList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | LIMIT :pageSize |
| | | ]; |
| | | System.debug('selectAccList = ' + selectAccList); |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | //销量前十的客户 |
| | | // List<Account> acList = [ |
| | | // SELECT |
| | | // id, |
| | | // Name, |
| | | // State_Master__c, |
| | | // State_Master__r.Name, |
| | | // Salesdepartment_HP__c, |
| | | // CreatedDate, |
| | | // Is_Active__c, |
| | | // RecordType.Name, |
| | | // Grade__c, |
| | | // OCM_Category__c, |
| | | // City_Master__c, |
| | | // City_Master__r.Name, |
| | | // Town__c, |
| | | // Phone |
| | | // FROM Account |
| | | // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '有効' AND RecordType.Name = '病院' |
| | | // LIMIT 10 |
| | | // ]; |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | if (fiscalYear == 'thisYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime); |
| | | } else if (fiscalYear == 'lastYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2); |
| | | } else { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime); |
| | | } |
| | | |
| | | //查询客户信息(名称,省,县) |
| | | List<String> accountList = new List<String>(); |
| | | for (AggregateResult ar : arList) { |
| | | System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount'))); |
| | | if(String.valueOf(ar.get('thisAmount')) != '0.0'){ |
| | | accountList.add(String.valueOf(ar.get('hospitalName'))); |
| | | topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount')))); |
| | | } |
| | | } |
| | | |
| | | System.debug('accountList = ' + accountList); |
| | | System.debug('topInfo = ' + topInfo); |
| | | |
| | | List<Account> acList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE Name = :accountList |
| | | ]; |
| | | |
| | | List<Account> acListTemp = new List<Account>(); |
| | | |
| | | for (String s : accountList) { |
| | | for (Account a : acList) { |
| | | if (s == a.Name) { |
| | | acListTemp.add(a); |
| | | } |
| | | } |
| | | } |
| | | |
| | | topInfo.acList = acListTemp; |
| | | |
| | | data.put('topInfo', topInfo); |
| | | data.put('pageRecords', selectAccList); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('accountId', accountId); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('agencyProTypestr', agencyProTypestr); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | try { |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | if (fiscalYear == 'thisYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime); |
| | | } else if (fiscalYear == 'lastYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2); |
| | | } else { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime); |
| | | } |
| | | //查询客户信息(名称,省,县) |
| | | List<String> accountList = new List<String>(); |
| | | for (AggregateResult ar : arList) { |
| | | System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount'))); |
| | | if(String.valueOf(ar.get('thisAmount')) != '0.0'){ |
| | | accountList.add(String.valueOf(ar.get('hospitalName'))); |
| | | topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount')))); |
| | | } |
| | | |
| | | } |
| | | System.debug('accountList = ' + accountList); |
| | | System.debug('topInfo = ' + topInfo); |
| | | List<Account> acList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE Name = :accountList |
| | | ]; |
| | | List<Account> acListTemp = new List<Account>(); |
| | | for (String s : accountList) { |
| | | for (Account a : acList) { |
| | | if (s == a.Name) { |
| | | acListTemp.add(a); |
| | | } |
| | | } |
| | | } |
| | | topInfo.acList = acListTemp; |
| | | data.put('topInfo', topInfo); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC changelistView( |
| | | String filterNameLwc, |
| | | String accountIdLwc, |
| | | String agencyProTypeLwc, |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC, |
| | | String sortFieldLWC, |
| | | String sortOrderLWC |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | filterName = filterNameLwc; |
| | | accountId = accountIdLwc; |
| | | agencyProTypestr = agencyProTypeLwc; |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | String soql = makeSoql(filterName, accountId); |
| | | System.debug('soql1+++++++ ' + soql); |
| | | List<Account> allSelectAccount = Database.query(soql); |
| | | |
| | | totalCount = allSelectAccount.size(); |
| | | if (String.isNotBlank(sortField)) { |
| | | soql += ' order by ' + sortField + ' ' + sortOrder; |
| | | } |
| | | soql += ' limit ' + pagesize + ' offset ' + pageToken; |
| | | System.debug('soql2+++++++ ' + soql); |
| | | List<Account> selectAccList = Database.query(soql); |
| | | System.debug('selectAccList = ' + selectAccList); |
| | | |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | data.put('pageRecords', selectAccList); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | //sql文作成 |
| | | private static String makeSoql(String viewName, String accountId) { |
| | | Date st = Date.today().addDays(-7).toStartOfWeek(); |
| | | lastweekstart = Datetime.newInstance(st.year(), st.month(), st.day(), 8, 0, 0); |
| | | lastweekend = lastweekstart.addDays(7); |
| | | String soql = 'SELECT id,Name,State_Master__c,Salesdepartment_HP__c,CreatedDate,Is_Active__c,RecordType.Name,State_Master__r.Name,City_Master__r.Name'; |
| | | soql += ' ,Grade__c,OCM_Category__c,City_Master__c,Town__c,Phone FROM Account'; |
| | | soql += |
| | | ' WHERE id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c =:accountId AND Hosptial_Type__c like \'%' + |
| | | String.escapeSingleQuotes(agencyProTypestr.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | if (viewName == '61. 医院_Hospital草案中的医院') { |
| | | soql += ' AND Is_Active__c = \'' + '草案中' + '\''; |
| | | } |
| | | if (viewName == '62. 医院_Hospital申请中的医院') { |
| | | soql += ' AND Is_Active__c = \'' + '申请中' + '\''; |
| | | } |
| | | if (viewName == '63. 医院_Hospital上周创建的医院') { |
| | | soql += ' AND Is_Active__c = \'' + '有效' + '\''; |
| | | soql += ' AND CreatedDate >= :lastweekstart '; |
| | | soql += ' AND CreatedDate < :lastweekend '; |
| | | } |
| | | System.debug('soql +++++' + soql); |
| | | return soql; |
| | | } |
| | | |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | //top10 Account |
| | | public class TopInfo { |
| | | @AuraEnabled |
| | | public Decimal saleAmount { get; set; } |
| | | @AuraEnabled |
| | | public List<Account> acList { get; set; } |
| | | @AuraEnabled |
| | | public List<Decimal> deList { get; set; } |
| | | |
| | | public TopInfo() { |
| | | acList = new List<Account>(); |
| | | deList = new List<Decimal>(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConsumableAccountInfoController { |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String accId) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | Account obj = new Account(); |
| | | if (accId != null) { |
| | | List<Account> accList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Owner.Name, |
| | | Site, |
| | | Alias_Name2__c, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | Is_Active__c, |
| | | Ban_On_Use_Reason__c, |
| | | Attribute_Type__c, |
| | | Speciality_Type__c, |
| | | State_Master__r.Name, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Street__c, |
| | | Address_Together__c, |
| | | Phone, |
| | | PhoneCall__c, |
| | | Fax, |
| | | Postal_Code__c, |
| | | Parent.Name, |
| | | Address__c |
| | | FROM Account |
| | | WHERE Id = :accId |
| | | ]; |
| | | if (accList != null && accList.size() > 0) { |
| | | obj = accList.get(0); |
| | | } |
| | | }else { |
| | | return new ResponseBodyLWC('Error', 500, 'accId为空', ''); |
| | | } |
| | | data.put('obj', obj); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexConsumableAccountSOQL { |
| | | public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){ |
| | | AggregateResult[] arList = new List<AggregateResult>([ |
| | | SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | CreatedDate >= :thisDatetime |
| | | AND CreatedDate < :nextDatetime |
| | | AND Consumable_order__r.Order_ForHospital__r.name != '' |
| | | GROUP BY Consumable_order__r.Order_ForHospital__r.Name |
| | | ORDER BY sum(Sale_amount__c) DESC |
| | | LIMIT 10 |
| | | ]); |
| | | return arList; |
| | | } |
| | | |
| | | public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime ,Datetime nextDatetime){ |
| | | AggregateResult[] saleAmountList = [ |
| | | SELECT sum(Sale_amount__c) saleAmount |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE CreatedDate >= :thisDatetime AND CreatedDate < :nextDatetime |
| | | ]; |
| | | return saleAmountList; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConsumableController { |
| | | /*****************検索用******************/ |
| | | public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c のインスタンス、sql多すぎ |
| | | public static String category1 { get; set; } |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static String category_Goods { get; set; } |
| | | public static Boolean specialCampaign { get; set; } |
| | | public static Boolean cansee { get; set; } |
| | | //经销商合同名称 |
| | | public static String contractName { get; set; } |
| | | //经销商合同ID |
| | | public static String contractId { get; set; } |
| | | //经销商定价查看权限 |
| | | public static Boolean dealerPricesee { get; set; } |
| | | /*****************画面初始化用********************************/ |
| | | /******20160313_add**************/ |
| | | //public String idCheck {get;set;} |
| | | public static Boolean editAble { get; set; } |
| | | public static Boolean edoffersPrice { get; set; } |
| | | public static String statusEdit { get; set; } |
| | | public static Boolean returnOrder { get; set; } |
| | | public static String searchDone { get; set; } |
| | | //暂用20160323 |
| | | public static Decimal disCount = 0; |
| | | //总价格计算结果 |
| | | public static Decimal sumPrice { get; set; } |
| | | //自定义特价金额 |
| | | public static Decimal bargainPrice { get; set; } |
| | | //产品上下限 |
| | | public static String[] proLimitAndDate = new List<String>{}; |
| | | /*****************画面表示Bean******************/ |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; } |
| | | public static Integer ConsumableorderdetailsCount { |
| | | get { |
| | | return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size(); |
| | | } |
| | | } |
| | | public static Integer ConsumableorderdetailsviewCount { |
| | | get { |
| | | return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size(); |
| | | } |
| | | } |
| | | public static List<String> lower = new List<String>(); |
| | | //附件 |
| | | public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; } |
| | | public static List<String> DealerProductId { get; set; } |
| | | public static Boolean editDelCommitBtnDisabled { get; private set; } |
| | | public static Boolean saveBtnDisabled { get; private set; } |
| | | public static Boolean sorderBtnDisabled { get; private set; } |
| | | public static String decisionCode { get; set; } |
| | | // 保存后动作: 1.检索 2.排序 |
| | | public static String baseUrl { get; private set; } |
| | | public static String sortKey { get; set; } |
| | | public static String preSortKey { get; private set; } |
| | | public static Boolean sortOrderAsc { get; private set; } |
| | | public static String[] sortOrder { get; private set; } |
| | | private static List<String> contactDealer = new List<String>(); |
| | | private static String[] columus = new List<String>{ |
| | | 'Consumable_Product__r.Name', |
| | | 'Consumable_Product__r.Asset_Model_No__c', |
| | | 'Consumable_Product__r.Intra_Trade_List_RMB__c', |
| | | '', |
| | | '', |
| | | 'Consumable_Product__r.Category3__c', |
| | | 'Consumable_Product__r.Category4__c', |
| | | 'Consumable_Product__r.Category5__c' |
| | | }; |
| | | private static String[] columus_no = new List<String>{ |
| | | 'Product2__c.Name', |
| | | 'Product2__c.Asset_Model_No__c', |
| | | 'Product2__c.Intra_Trade_List_RMB__c', |
| | | '', |
| | | '', |
| | | 'Category3__c', |
| | | 'Category4__c', |
| | | 'Category5__c' |
| | | }; |
| | | // 已选择产品明细 |
| | | private static List<Attachment> attachmentinfo = new List<Attachment>(); |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | private static String cate1ForSort = null; |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | // 产品 ID |
| | | public static String ESetId { get; set; } |
| | | private static String userId = ''; |
| | | //private String[] ProidListAll = new String[]{}; |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | public static List<CusOption> category3Option { get; set; } |
| | | public static List<CusOption> category4Option { get; set; } |
| | | public static List<CusOption> category5Option { get; set; } |
| | | private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>(); |
| | | public static List<String> orderzaikuId = new List<String>(); |
| | | //分页功能 |
| | | public static Integer size { get; set; } |
| | | public static Integer pageLimit { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | public static ApexPages.StandardSetController con { get; set; } |
| | | public static String soql { get; set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | public static String agencyProType { get; set; } |
| | | public static String agencyProType1 {get;set;} //lt 20230526 安徽两票制 add |
| | | private static Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | public static String methodType { get; set; } |
| | | public static String hospitalName { get; set; } |
| | | public static String hospitalId { get; set; } |
| | | public static String tempidHp { get; set; } |
| | | public static String tempidPp { get; set; } |
| | | private static List<String> hpids = new List<String>(); |
| | | private static Boolean isfirst = false; |
| | | //报错和警告信息 |
| | | public static List<String> errorMsgList = new List<String>(); |
| | | public static List<String> warningMsgList = new List<String>(); |
| | | //构造方法 |
| | | public LexConsumableController() { |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | DealerProductId = new List<String>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | editAble = false; |
| | | edoffersPrice = false; |
| | | returnOrder = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | } |
| | | |
| | | private static void initStandardController() { |
| | | con = new ApexPages.StandardSetController(Database.getQueryLocator(soql)); |
| | | con.setPageSize(size); |
| | | noOfRecords = con.getResultSize(); |
| | | } |
| | | |
| | | public static List<Product2__c> product2s() { |
| | | return (List<Product2__c>) con.getRecords(); |
| | | } |
| | | |
| | | private static List<ConsumableorderdetailsInfo> getPageInfo() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | selectedIdMap.put(ass.Prod.id, ass.Prod.id); |
| | | reSet.add(ass); |
| | | } |
| | | } |
| | | |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble) { |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | | //consumableorderdetailsRecords[i].esd.Dealer_Custom_Price__c = consumableorderdetailsRecords[i].Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | // if (addNo >= size) |
| | | // break; |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init(String type, String esetId, String keywordStr) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | DealerProductId = new List<String>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | editAble = false; |
| | | edoffersPrice = false; |
| | | returnOrder = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | ESetId = esetId; |
| | | methodType = type; |
| | | if(String.isBlank(methodType) && String.isNotBlank(ESetId)){ |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | methodType = oclist.get(0).orderPattern__c; |
| | | } |
| | | statusEdit = keywordStr; |
| | | System.debug('Param:'+ESetId+'---'+methodType+'---'+statusEdit); |
| | | try { |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[8]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | cate1ForSort = ''; |
| | | decisionCode = ''; |
| | | sumPrice = 0; |
| | | specialCampaign = false; |
| | | if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) { |
| | | editAble = false; |
| | | } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 安徽两票制 add |
| | | //lt 20230526 安徽两票制 start |
| | | OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add |
| | | if(OSHFLG){ |
| | | agencyProType1 = 'OSH'; |
| | | } |
| | | else if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType1 = 'ET'; |
| | | } |
| | | //lt 20230526 安徽两票制 end |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | //错误信息提示 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您没有订货医院特价产品的权限!')); |
| | | errorMsgList.add('您没有订货医院特价产品的权限!'); |
| | | } |
| | | contactDealer = new List<String>(); |
| | | Date dateToday = Date.today(); |
| | | //查该经销商下所有有效合同 |
| | | List<Account> contractList = [ |
| | | SELECT Id, Name, RecordType.DeveloperName |
| | | FROM Account |
| | | WHERE |
| | | RecordType.DeveloperName = 'AgencyContract' |
| | | AND Contract_Decide_Start_Date__c <= :dateToday |
| | | AND Contract_Decide_End_Date__c >= :dateToday |
| | | and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | for (Account contract : contractList) { |
| | | contactDealer.add(contract.Id); |
| | | } |
| | | DealerProductMap = new Map<Id, Dealer_Product__c>(); |
| | | DealerProductId = getDealerProductId(); |
| | | Account accountInfo = [ |
| | | SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c |
| | | FROM account |
| | | WHERE id = :accountid |
| | | ]; |
| | | accountName = accountInfo.Name; |
| | | String product_Limit; |
| | | if (agencyProType == 'ET') { |
| | | product_Limit = accountInfo.Product_Limit_Date__c; |
| | | } else { |
| | | product_Limit = accountInfo.Product_Limit_DateENG__c; |
| | | } |
| | | if (product_Limit != null && product_Limit != '') { |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | saveBtnDisabled = false; |
| | | sorderBtnDisabled = false; |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | if (String.isBlank(agencyProType)) { |
| | | //return ; |
| | | } |
| | | List<Product2__c> Product2Selected = new List<Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //经销商在库数据 |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | if (ESetId == null || ESetId == '') { |
| | | //获取经销商默认的一个合同 |
| | | List<Account> contract = [ |
| | | SELECT id, Name, State_Master__c, State_Master__r.Name |
| | | FROM Account |
| | | WHERE |
| | | ParentId = :accountid |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() == 1) { |
| | | contractName = contract[0].Name; |
| | | contractId = contract[0].Id; |
| | | } |
| | | editDelCommitBtnDisabled = true; |
| | | List<String> DealerProductId = new List<String>(); |
| | | soql = makeSoql('', '', '', '', '', false, DealerProductId); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //只有在协议订货时会走这个for循环 其他两种订货模式都走的searchorderdetails方法 |
| | | if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //经销商定价 计算 |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) { |
| | | searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble); |
| | | isfirst = true; |
| | | } |
| | | getPageInfo(); |
| | | } else { |
| | | if (methodType != null && methodType.equals('hospitalorder')) { |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | | if (oclist.get(0).orderPattern__c.equals('hospitalorder')) { |
| | | hospitalName = oclist.get(0).Order_ForHospital__r.Name; |
| | | hospitalId = oclist.get(0).Order_ForHospital__c; |
| | | } |
| | | } |
| | | List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>(); |
| | | //修改 |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | qs = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Order_status__c, |
| | | Consumable_pdf_insert_day__c, |
| | | Dealer_Info__c, |
| | | Deliver_date__c, |
| | | Order_Reason__c, |
| | | Order_date__c, |
| | | Contract_application_decision__c, |
| | | Total_amount__c, |
| | | Offers_Price__c, |
| | | Order_effective_contact__c, |
| | | Order_effective_contact__r.Name |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | coc = qs[0]; |
| | | decisionCode = coc.Contract_application_decision__c; |
| | | contractName = coc.Order_effective_contact__r.Name; |
| | | contractId = coc.Order_effective_contact__r.Id; |
| | | } |
| | | if (qs[0].Order_status__c == '已提交' || qs[0].Order_status__c == '批准' || qs[0].Order_status__c == '附件上传完成') { |
| | | saveBtnDisabled = true; |
| | | sorderBtnDisabled = true; |
| | | editDelCommitBtnDisabled = false; |
| | | } |
| | | // 選択済みの明细を取得 |
| | | ConsumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Count__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Sum_of_money__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Product2__r.Packing_list_manual__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | recordtypeid = :System.Label.RT_ConOrderDetail1_Order |
| | | AND Consumable_order__c = :ESetId |
| | | AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | if(cdc1.Consumable_Product__c != null){ |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | } |
| | | } |
| | | soql = makeSoqlorderdet(); |
| | | System.debug('soql:'+soql); |
| | | size = orderzaikuId.size(); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //add by rentx 2020-12-09 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder')) |
| | | ) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Sum_of_money__c; |
| | | if (ass.prod.Id == cdc1.Consumable_Product__c) { |
| | | ass.check = true; |
| | | ass.esd = cdc1; |
| | | } |
| | | } |
| | | } |
| | | //附件 |
| | | // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | // |
| | | consumableorderdetailsRecords.sort(); |
| | | getPageInfo(); |
| | | } |
| | | //计算库存上、下限 |
| | | productLimtAndDate(); |
| | | lowerRecord(); |
| | | //明细排序 |
| | | List<String> upper = new List<String>(); |
| | | if (String.isNotBlank(ESetid)) { |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if(bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null){ |
| | | if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) { |
| | | upper.add(bss.esd.Consumable_Product__r.Name__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (upper.size() > 0) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '存在以下产品订货数量超出库存上限!')); |
| | | warningMsgList.add('存在以下产品订货数量超出库存上限!'); |
| | | for (Integer i = 0; i < upper.size(); i++) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, upper[i])); |
| | | warningMsgList.add(upper[i]); |
| | | } |
| | | } |
| | | if (lower.size() > 0) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '存在以下产品订货数量低于库存下限!')); |
| | | warningMsgList.add('存在以下产品订货数量低于库存下限!'); |
| | | for (Integer i = 0; i < lower.size(); i++) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, lower[i])); |
| | | warningMsgList.add(lower[i]); |
| | | } |
| | | } |
| | | //价格查看权限 |
| | | Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe(); |
| | | cansee = dfr.isAccessible(); |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | //categoty3 |
| | | // categoryOptionList = new List<SelectOption>(); |
| | | category3Option = new List<CusOption>(); |
| | | // categoryOptionList.add(new SelectOption('', '-无-')); |
| | | category3Option.add(new CusOption('-无-','')); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | category3Option.add(new CusOption(deliverycnt,deliverycnt)); |
| | | } |
| | | //categoty4 |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-','')); |
| | | //categoty5 |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-','')); |
| | | //return msg |
| | | consumableorderdetailsRecordsview = consumableorderdetailsRecords; |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.coc = coc; |
| | | results.editAble = editAble; |
| | | results.edoffersPrice = edoffersPrice; |
| | | results.editDelCommitBtnDisabled = EditDelCommitBtnDisabled; |
| | | results.category3Option = category3Option; |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.hospitalName = hospitalName; |
| | | results.contractName = contractName; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.attachmentRecoeds = attachmentRecoeds; |
| | | results.cansee = cansee; |
| | | results.agencyProType = agencyProType; |
| | | results.agencyProType1 = agencyProType1; |
| | | results.OSHFLG = OSHFLG; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.accountName = accountName; |
| | | results.category_Goods = category_Goods; |
| | | results.specialCampaign = specialCampaign; |
| | | results.dealerProductId = DealerProductId; |
| | | results.accountid = accountid; |
| | | results.hospitalId = hospitalId; |
| | | results.contractId = contractId; |
| | | results.contactDealer = contactDealer; |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | results.methodType = methodType; |
| | | results.proLimitAndDate = proLimitAndDate; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryAllload(String agencyProTypeStr, String category3Str){ |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | | try { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4Option.add(new CusOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5Option.add(new CusOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str){ |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | | category4 = category4Str; |
| | | try { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4Option.add(new CusOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c = :category4 |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5Option.add(new CusOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | public static void lowerRecord() { |
| | | List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>(); |
| | | //库存明细取得 |
| | | Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>(); |
| | | List<Product2__c> product2Selected = [ |
| | | SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c |
| | | FROM Product2__c |
| | | WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '○' |
| | | ]; |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | //先把ConsumableorderdetailsRecords 做成map |
| | | midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | //AND Consumable_order_minor__r.Dealer_Info__c = :accountid |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //add by rentx 2020-12-09 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | lowerRecord = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : midMaprecord.values()) { |
| | | lowerRecord.add(bss); |
| | | } |
| | | allProductLimt(lowerRecord); |
| | | for (ConsumableorderdetailsInfo bss : lowerRecord) { |
| | | if (bss.allnumber < bss.lowerlimit) { |
| | | lower.add(bss.Prod.Name__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //库存上下限 |
| | | public static void productLimtAndDate() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //全部库存上下限 |
| | | private static void allProductLimt(List<ConsumableorderdetailsInfo> lowerRecord) { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : lowerRecord) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails( |
| | | String userWorkLocationStr, |
| | | String agencyProTypeStr, |
| | | String accountNameStr, |
| | | String accountIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String category1Str, |
| | | String category3Str, |
| | | String category4Str, |
| | | String category5Str, |
| | | String category_GoodStr, |
| | | Boolean specialCampaignStr, |
| | | String dealerProductIdStr, |
| | | String methodTypeStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | Boolean editAbleStr, |
| | | List<String> proLimitAndDateList |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | userWorkLocation = userWorkLocationStr; |
| | | agencyProType = agencyProTypeStr; |
| | | accountName = accountNameStr; |
| | | accountid = accountIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | category1 = category1Str; |
| | | category3 = category3Str; |
| | | category4 = category4Str; |
| | | category5 = category5Str; |
| | | category_Goods = category_GoodStr; |
| | | specialCampaign = specialCampaignStr; |
| | | methodType = methodTypeStr; |
| | | editAble = editAbleStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | try { |
| | | searchDone = 'searchDone'; |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | //add by rentx 2020-12-09 |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | //add by rentx 2020-12-09 |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | System.debug('soql:'+soql); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecordsa0l0l0000000byXAAQ |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | productLimtAndDate(); |
| | | getPageInfo(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', '', '', '', '', '' }; |
| | | cate1ForSort = category1; |
| | | // 显示数据条数信息 |
| | | // makeMessage(); |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | if(consumableorderdetailsRecords.size() > 0){ |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品'; |
| | | }else { |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Fail'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //医院--检索 |
| | | @AuraEnabled |
| | | public static Results searchorderdetails( |
| | | String methodTypeStr, |
| | | String accountIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String userWorkLocationStr, |
| | | String accountNameStr, |
| | | List<String> proLimitAndDateList, |
| | | Boolean editAbleStr |
| | | ){ |
| | | Results results = new Results(); |
| | | methodType = methodTypeStr; |
| | | accountId = accountIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | accountName = accountNameStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | editAble = editAbleStr; |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | try { |
| | | soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | if (methodType.equals('hospitalorder')) { |
| | | //医院id 有值 |
| | | List<hospitalprice__c> hplist = [ |
| | | SELECT id, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid AND hospital__c = :hospitalId |
| | | ]; |
| | | if (hplist != null && hplist.size() > 0) { |
| | | List<String> hpids = new List<String>(); |
| | | for (hospitalprice__c hc : hplist) { |
| | | hpids.add(hc.product__c); |
| | | } |
| | | |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该医院下没有符合医院特价的产品 |
| | | soql += ' AND Id = null '; |
| | | } |
| | | } else if (methodType.equals('promotionorder')) { |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | | String ids = '('; |
| | | for (Dealer_Product__c hc : dpclist) { |
| | | hpids.add(hc.Dealer_Product2__c); |
| | | ids += '\'' + hc.Dealer_Product2__c + '\','; |
| | | } |
| | | ids = ids.substring(0, ids.length() - 1) + ')'; |
| | | if (hpids != null && hpids.size() > 0) { |
| | | // soql += ' AND Id in : hpids '; |
| | | soql += ' AND Id in ' + ids; |
| | | } |
| | | } else { |
| | | //该经销商下没有促销价格的产品 |
| | | soql += ' AND Id = null '; |
| | | } |
| | | } |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | //AND Consumable_order_minor__r.Dealer_Info__c = :accountid |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecordsa0l0l0000000byXAAQ |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | productLimtAndDate(); |
| | | getPageInfoForHos(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', '', '', '', '', '' }; |
| | | cate1ForSort = category1; |
| | | // 显示数据条数信息 |
| | | noOfRecords = consumableorderdetailsRecords.size(); |
| | | getConsumableShowTableFieldValue(); |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | if(consumableorderdetailsRecordsview.size() > 0){ |
| | | results.result = 'Success'; |
| | | results.errorMsg = '共搜索到'+consumableorderdetailsRecordsview.size()+'条数据'; |
| | | }else { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //用户切换医院时取消选中的产品 |
| | | private static List<ConsumableorderdetailsInfo> getPageInfoForHos() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble) { |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | // if (addNo >= size){ |
| | | // break; |
| | | // } |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | | //add by rentx 2020-12-03 end ===================================================================================================================== |
| | | //特价 |
| | | public static void OffersPrice() { |
| | | edoffersPrice = true; |
| | | } |
| | | |
| | | //得到促销产品Id |
| | | private static List<String> getDealerProductId() { |
| | | List<String> ProductId = new List<String>(); |
| | | Map<String, String> DealerProductIdMap = new Map<String, String>(); |
| | | Date dateToday = Date.today(); |
| | | List<Dealer_Product__c> DealerProductList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | OrderGoods_Limit__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c IN :contactDealer |
| | | AND Campaign_StartDate__c <= :dateToday |
| | | AND Campaign_EndDate__c >= :dateToday |
| | | AND Special_Campaign_Price__c != NULL |
| | | ]; |
| | | for (Dealer_Product__c dealerProduct : DealerProductList) { |
| | | if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) { |
| | | continue; |
| | | } else { |
| | | ProductId.add(dealerProduct.Dealer_Product2__c); |
| | | DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | return ProductId; |
| | | } |
| | | |
| | | private static String makeSoql( |
| | | String CateName, |
| | | String CateCode, |
| | | String Category3, |
| | | String Category4, |
| | | String Category5, |
| | | Boolean specialCampaign, |
| | | List<String> DealerProductId |
| | | ) { |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | // add begin ================================================================================================ |
| | | if (methodType != null && methodType.equals('hospitalorder')) { |
| | | //如果是医院特价 |
| | | //1.判断 医院id是否有值 如果有值 则根据医院id去 医院特价表中获取产品id |
| | | //医院id 有值 |
| | | if (hospitalId == null || hospitalId == '') { |
| | | soql += ' and id = null '; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '请选择医院')); |
| | | warningMsgList.add('请选择医院'); |
| | | } else { |
| | | List<hospitalprice__c> hplist = [ |
| | | SELECT id, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid AND hospital__c = :hospitalId |
| | | ]; |
| | | if (hplist != null && hplist.size() > 0) { |
| | | hpids = new List<String>(); |
| | | for (hospitalprice__c hc : hplist) { |
| | | hpids.add(hc.product__c); |
| | | } |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该医院下没有符合医院特价的产品 |
| | | soql += ' AND Id = null '; |
| | | return soql; |
| | | } |
| | | } |
| | | } |
| | | //促销订货 |
| | | if (methodType != null && methodType.equals('promotionorder')) { |
| | | if (contractId == null || contractId == '') { |
| | | soql += ' and id = null '; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '请选择合同')); |
| | | warningMsgList.add('请选择合同'); |
| | | } else { |
| | | //1.查询所有经销商产品 |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | | hpids = new List<String>(); |
| | | for (Dealer_Product__c hc : dpclist) { |
| | | hpids.add(hc.Dealer_Product2__c); |
| | | } |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该经销商下没有促销价格的产品 |
| | | soql += ' AND Id = null '; |
| | | return soql; |
| | | } |
| | | } |
| | | } |
| | | //add end =================================================================================================== |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | if (agencyProType == 'ET') { |
| | | soql += ' AND Pro2_Dealer_Object__c = true'; |
| | | } |
| | | if (agencyProType == 'ENG') { |
| | | soql += ' AND Pro2_Dealer_ENG__c = true'; |
| | | } |
| | | soql += ' AND Intra_Trade_List_RMB__c > 0 '; |
| | | System.debug('soql +++++++++++ ' + soql); |
| | | return soql; |
| | | } |
| | | |
| | | private static String makeSoqlorderdet() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderzaikuId.size(); i++) { |
| | | if (i < orderzaikuId.size() - 1) { |
| | | sqlTail += orderzaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderzaikuId[i] + '\')'; |
| | | } |
| | | } |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | System.debug('sqlTail:'+sqlTail); |
| | | System.debug('orderzaikuId:'+orderzaikuId); |
| | | if (orderzaikuId.size() > 0) { |
| | | soql += ' AND Id in' + sqlTail; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | // 编辑按钮 |
| | | @AuraEnabled |
| | | public static Results setEditAble(String eSetidStr){ |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 再申请 |
| | | @AuraEnabled |
| | | public static Results backOrder(String eSetidStr) { |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | statusEdit = 'Redirect'; |
| | | returnOrder = true; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //上传附件 |
| | | @AuraEnabled |
| | | public static Results filesUpload(String pId, String fileName, String base64Data) { |
| | | Results results = new Results(); |
| | | try { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = pId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId]; |
| | | c.Consumable_pdf_insert_day__c = Date.today(); |
| | | update c; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //删除按钮 |
| | | @AuraEnabled |
| | | public static Results delConsumable(String eSetidStr){ |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | try { |
| | | Consumable_order__c cord = new Consumable_order__c(Id = ESetId); |
| | | List<Consumable_Orderdetails__c> orderdetails1 = [ |
| | | SELECT Id |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :EsetId |
| | | ]; |
| | | delete orderdetails1; |
| | | delete cord; |
| | | results.result = 'Success'; |
| | | results.url = '/lexconsumableordermanage'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 提交按钮 |
| | | @AuraEnabled |
| | | public static Results sorder(String eSetidStr,String accountidStr){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | ESetId = eSetidStr; |
| | | accountid = accountidStr; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | Map<Id, String> prodMap = new Map<Id, String>(); |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | P = new Consumable_order__c(); |
| | | p.Id = ESetId; |
| | | p.Order_date__c = Date.today(); |
| | | p.Order_status__c = '附件上传完成'; |
| | | for (Consumable_Orderdetails__c cod1 : [ |
| | | SELECT Consumable_product__r.Product2__c, Consumable_product__r.Name__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]) { |
| | | prodMap.put(cod1.Consumable_product__r.Product2__c, cod1.Consumable_product__r.Name__c); |
| | | } |
| | | // GZW 提交产品无效 出错误消息 |
| | | System.debug(prodMap); |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, ''); |
| | | System.debug(chkMap); |
| | | if (chkMap.size() > 0) { |
| | | if (chkMap.containsKey('agency')) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '第一经销商没有有效的医疗器械经营许可证。')); |
| | | errorMsgList.add('第一经销商没有有效的医疗器械经营许可证。'); |
| | | } |
| | | for (String proId : prodMap.keySet()) { |
| | | if (chkMap.containsKey(proId)) { |
| | | if (chkMap.get(proId) == '1') { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 没有有效的注册证。') |
| | | // ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 没有有效的注册证。'); |
| | | } else if (chkMap.get(proId) == '2') { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。') |
| | | // ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。'); |
| | | } |
| | | } |
| | | } |
| | | results.result = 'Fail'; |
| | | results.errorMsg = ''; |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | return results; |
| | | } |
| | | update p; |
| | | Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); |
| | | psr.setObjectId(ESetId); |
| | | Approval.ProcessResult submitResult = Approval.process(psr); |
| | | results.result = 'Success'; |
| | | results.url = '/lexconsumableordermanage'; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 驳回订单copy |
| | | @AuraEnabled |
| | | public static Results ordrCopy( |
| | | String contractNameStr, |
| | | String cocStr, |
| | | String agencyProTypeStr, |
| | | String accountidStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ) { |
| | | ESetId = ''; |
| | | return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr); |
| | | } |
| | | |
| | | //保存按钮 |
| | | @AuraEnabled |
| | | public static Results save( |
| | | String contractNameStr, |
| | | String cocStr, |
| | | String agencyProTypeStr, |
| | | String accountidStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String eSetIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | contractName = contractNameStr; |
| | | agencyProType = agencyProTypeStr; |
| | | accountid = accountidStr; |
| | | methodType = methodTypeStr; |
| | | ESetId = eSetIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | agencyProType1 = agencyProType1Str; |
| | | OSHFLG = OSHFLGStr; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | if(coc.Offers_Price__c != null){ |
| | | String offerStr = String.valueOf(coc.Offers_Price__c); |
| | | bargainPrice = Decimal.valueOf(offerStr.replace(',','')); |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | if (String.isEmpty(contractName)) { |
| | | // coc.Order_effective_contact__c.addError('请选择合同'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请选择合同'; |
| | | return results; |
| | | } |
| | | List<Account> contract = [ |
| | | SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c |
| | | FROM account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Agent_Ref__c =:accountid |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() <= 0) { |
| | | // coc.Order_effective_contact__c.addError('不存在的合同,请重新确认。'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '不存在的合同,请重新确认。'; |
| | | return results; |
| | | } else { |
| | | if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) { |
| | | // coc.Order_effective_contact__c.addError('合同无效,请重新确认。'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '合同无效,请重新确认。'; |
| | | return results; |
| | | } |
| | | } |
| | | Integer FLG = 0; |
| | | Integer Count = 0; |
| | | //add by rentx 2020-11-25 |
| | | List<String> tpids = new List<String>(); |
| | | //add by rentx 2020-11-25 |
| | | for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) { |
| | | FLG = FLG + 1; |
| | | if (CheckCount.check == false) { |
| | | Count = Count + 1; |
| | | } |
| | | if (CheckCount.check == true) { |
| | | //add by rentx 2020-11-25 |
| | | tpids.add(CheckCount.Prod.Id); |
| | | //add by rentx 2020-11-25 |
| | | if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } |
| | | if ( |
| | | CheckCount.orderGoods_Limit > 0 && |
| | | math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0 |
| | | ) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入促销数量的倍数'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入促销数量的倍数'; |
| | | return results; |
| | | } |
| | | } |
| | | } |
| | | if (Count == FLG) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请选择所需消耗品'; |
| | | return results; |
| | | } |
| | | //=======================================医院特价,有金额的话取金额 |
| | | Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>(); |
| | | List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c |
| | | from hospitalprice__c |
| | | where product__c in :tpids and mPrice__c <> null and account__c=:accountid |
| | | ]; |
| | | for (hospitalprice__c dealerProduct : hplist) { |
| | | if (dealerProduct.mPrice__c != null) { |
| | | dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c); |
| | | } |
| | | } |
| | | //促销订货 根据经销商产品中的数据计算金额 |
| | | //=======================================产品特殊折扣 |
| | | Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>(); |
| | | //1.获取有开始结束日的产品 |
| | | Date dateToday = Date.today(); |
| | | List<Dealer_Product__c> haveDateList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | OrderGoods_Limit__c, |
| | | Special_Discount__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c IN :contactDealer |
| | | AND Campaign_StartDate__c <= :dateToday |
| | | AND Campaign_EndDate__c >= :dateToday |
| | | AND (Special_Discount__c != NULL |
| | | OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | //2.获取没有开始结束日的产品 |
| | | List<Dealer_Product__c> DealerProductList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | Special_Discount__c, |
| | | OrderGoods_Limit__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | for (Dealer_Product__c dealerProduct : DealerProductList) { |
| | | //如果促销价格为null 则设置特殊折扣(百分比)到集合 |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | } |
| | | } |
| | | //这样做是为了计算促销价格时 优先计算促销开始结束日不为空的产品 |
| | | //如果该集合有值 则说明需要根据当前的金额或者折扣来计算 |
| | | if (haveDateList != null && haveDateList.size() > 0) { |
| | | for (Dealer_Product__c dealerProduct : haveDateList) { |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | } |
| | | //=======================================经销商合同折扣 |
| | | List<Account> at = [ |
| | | SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c |
| | | FROM Account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (at.size() > 0 && at[0].Dealer_discount__c != null) { |
| | | disCount = at[0].Dealer_discount__c; |
| | | } else { |
| | | disCount = 100; |
| | | } |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_Orderdetails__c> Ins = new List<Consumable_Orderdetails__c>(); |
| | | //新建订单时 |
| | | if (String.isBlank(ESetId)) { |
| | | Integer i = 1; |
| | | Integer Roll = 0; |
| | | p.Name = '*'; |
| | | p.Order_status__c = '草案中'; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | p.Offers_Price__c = coc.Offers_Price__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.Order_effective_contact__c = contract[0].Id; |
| | | p.Order_Reason__c = coc.Order_Reason__c; |
| | | p.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | p.Overrule_order__c = coc.Id; |
| | | if (String.isNotBlank(methodType)) { |
| | | p.orderPattern__c = methodType; |
| | | } |
| | | insert p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | Roll = Roll + 1; |
| | | if (ass.check == true) { |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } else { |
| | | Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c(); |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = Consumable_order[0].Name + '-' + str; |
| | | InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c; |
| | | InsAfterDel.Consumable_order__c = p.id; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Box_Piece__c = '盒'; |
| | | //协议订货 |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | //=====================================================================================update by rentx 2020-11-25 |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | //如果促销价格不为null 则直接使用促销价格来计算金额 |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | | 100; |
| | | system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | } |
| | | //=====================================================================================update by rentx 2020-11-25 |
| | | } else if (methodType.equals('hospitalorder')) { |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | ESetId = p.id; |
| | | if (Consumable_order.size() > 0) { |
| | | update Consumable_order; |
| | | } |
| | | } |
| | | //修改之后 保存订单 |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } else { |
| | | //修改,获取消耗品订单 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT Id, Name, Order_status__c, Dealer_Info__c, Deliver_date__c, Order_Reason__c, Offers_Price__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.Name = coc.Name; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.Order_effective_contact__c = contract[0].Id; |
| | | p.Order_Reason__c = coc.Order_Reason__c; |
| | | if (bargainPrice != null) { |
| | | p.Offers_Price__c = bargainPrice; |
| | | } |
| | | update p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>(); |
| | | qs = [ |
| | | SELECT Id |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c(); |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } else { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = Consumable_order[0].Name + '-' + str; |
| | | InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c; |
| | | InsAfterDel.Consumable_order__c = ESetId; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Box_Piece__c = '盒'; |
| | | //协议订货 |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | | 100; |
| | | } |
| | | } else if (methodType.equals('hospitalorder')) { |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | // ==================================================之前的促销订货的逻辑 |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | } |
| | | results.result = 'Success'; |
| | | results.eSetId = ESetId; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //删除附件 |
| | | @AuraEnabled |
| | | public static Results deleteAtt(String contentVersionId){ |
| | | Results results = new Results(); |
| | | try { |
| | | ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId]; |
| | | String contentDocumentId = conVersion.ContentDocumentId; |
| | | ContentDocument conDocument = [SELECT Id FROM ContentDocument where Id = :contentDocumentId]; |
| | | delete conDocument; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public static void getConsumableShowTableFieldValue(){ |
| | | for(ConsumableorderdetailsInfo con :consumableorderdetailsRecordsview){ |
| | | if(con.Prod != null){ |
| | | con.recordId = con.Prod.Id; |
| | | if(!con.oldCheck){ |
| | | con.prodName = con.Prod.Name__c; |
| | | // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c); |
| | | } |
| | | con.prodSFDAStatus = con.Prod.SFDA_Status__c; |
| | | con.prodCategory3 = con.Prod.Category3__c; |
| | | con.prodCategory4 = con.Prod.Category4__c; |
| | | con.prodCategory5 = con.Prod.Category5__c; |
| | | con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c; |
| | | } |
| | | if(con.esd != null){ |
| | | // if(con.oldCheck){ |
| | | // con.prodName = con.esd.Consumable_Product__r.Name__c; |
| | | // } |
| | | con.consumableCount = con.esd.Consumable_count__c; |
| | | } |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber_piece { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public ContentVersion Concc { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal SpecialCampaignPrice { get; set; } |
| | | @AuraEnabled |
| | | public Decimal orderGoods_Limit { get; set; } |
| | | @AuraEnabled |
| | | public Date Campaign_EndDate { get; set; } |
| | | @AuraEnabled |
| | | public String recordId { get; set; } |
| | | @AuraEnabled |
| | | public String prodName { get; set; } |
| | | @AuraEnabled |
| | | public String prodSFDAStatus { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory3 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory4 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory5 { get; set; } |
| | | @AuraEnabled |
| | | public Decimal prodIntraTradeList { get; set; } |
| | | @AuraEnabled |
| | | public Decimal consumableCount { get; set; } |
| | | |
| | | |
| | | // 已存产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.Consumable_Count__c; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | allnumber_piece = 0; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | esd = new Consumable_Orderdetails__c(); |
| | | Prod = e; |
| | | oldConsumableCount = null; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | allnumber_piece = 0; |
| | | } |
| | | //附件 |
| | | public ConsumableorderdetailsInfo(ContentVersion e) { |
| | | Concc = e; |
| | | } |
| | | // 排序Consumable_order__c |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (check == true) { |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } else { |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String eSetId; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public String accountName; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public String hospitalId; |
| | | @AuraEnabled |
| | | public String contractId; |
| | | @AuraEnabled |
| | | public String category_Goods; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public Boolean edoffersPrice; |
| | | @AuraEnabled |
| | | public Boolean editDelCommitBtnDisabled; |
| | | @AuraEnabled |
| | | public Boolean editAble; |
| | | @AuraEnabled |
| | | public String hospitalName; |
| | | @AuraEnabled |
| | | public String contractName; |
| | | @AuraEnabled |
| | | public List<CusOption> category3Option; |
| | | @AuraEnabled |
| | | public List<CusOption> category4Option; |
| | | @AuraEnabled |
| | | public List<CusOption> category5Option; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> attachmentRecoeds; |
| | | @AuraEnabled |
| | | public Boolean cansee; |
| | | @AuraEnabled |
| | | public List<String> errorMsgList; |
| | | @AuraEnabled |
| | | public List<String> warningMsgList; |
| | | @AuraEnabled |
| | | public Boolean hasWarning; |
| | | @AuraEnabled |
| | | public Boolean hasError; |
| | | @AuraEnabled |
| | | public Boolean specialCampaign; |
| | | @AuraEnabled |
| | | public List<String> dealerProductId; |
| | | @AuraEnabled |
| | | public List<String> contactDealer; |
| | | @AuraEnabled |
| | | public String url; |
| | | @AuraEnabled |
| | | public String methodType; |
| | | @AuraEnabled |
| | | public List<String> proLimitAndDate; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | @AuraEnabled |
| | | public Boolean OSHFLG; |
| | | @AuraEnabled |
| | | public String agencyProType1; |
| | | } |
| | | |
| | | public class CusOption { |
| | | CusOption(String label, String value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConsumableGoodsInfo { |
| | | |
| | | //所有产品一览 |
| | | @AuraEnabled |
| | | public static Results initTotalNum(String ordId, String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allOtherDetIifo = new List<ShowRecords>(); |
| | | Set<String> orderId = new Set<String>(); |
| | | if(ordId != '1'){ |
| | | orderId.add(ordId); |
| | | } |
| | | try { |
| | | if(!(orderId.size() > 0)){ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | String temp = (String)conorder.Id; |
| | | orderId.add(temp); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | } |
| | | List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c]; |
| | | }else{ |
| | | conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =:orderId]; |
| | | } |
| | | |
| | | Map<String,Decimal> allConOrderMap = new Map<String,Decimal>(); |
| | | for(Consumable_Orderdetails__c con : conOrderList1){ |
| | | if(con.Consumable_count__c == null){ |
| | | con.Consumable_count__c = 0; |
| | | } |
| | | if(allConOrderMap.containsKey(con.Asset_Model_No__c)){ |
| | | allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c); |
| | | }else{ |
| | | allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c); |
| | | } |
| | | } |
| | | for(String pmodel : allConOrderMap.keySet()){ |
| | | if(allConOrderMap.get(pmodel) > 0){ |
| | | ShowRecords showrecord2 = new ShowRecords(); |
| | | showrecord2.recordCount = allConOrderMap.get(pmodel); |
| | | showrecord2.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord2); |
| | | } |
| | | } |
| | | results.result = 'Success'; |
| | | results.recordList = allOtherDetIifo; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //已到货产品一览 |
| | | @AuraEnabled |
| | | public static Results initArrDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> arrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | arrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = arrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //已到货产品一览All |
| | | @AuraEnabled |
| | | public static Results initArrDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str |
| | | GROUP BY Asset_Model_No__c]; |
| | | // List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | allArrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = allArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //未到货产品一览 |
| | | @AuraEnabled |
| | | public static Results initDeliveryDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> notArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = false |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< notArrDetList.size();i++){ |
| | | notArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | } |
| | | results.recordList = notArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //未到货产品一览All |
| | | @AuraEnabled |
| | | public static Results initDeliveryDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allNotArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | GROUP BY Asset_Model_No__c]; |
| | | // List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | allNotArrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = allNotArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //还没发货数量 |
| | | @AuraEnabled |
| | | public static Results initNotArrDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<Consumable_Orderdetails__c> otherArrDetIifo = new List<Consumable_Orderdetails__c>(); |
| | | List<ShowRecords> otherArrList = new List<ShowRecords>(); |
| | | try{ |
| | | List<showRecords> arrDetIifo = new List<showRecords>(); |
| | | List<showRecords> notArrDetIifo = new List<showRecords>(); |
| | | List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId]; |
| | | List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str AND Dealer_Arrive__c = true |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | arrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | |
| | | List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = false |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< notArrDetList.size();i++){ |
| | | notArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | } |
| | | |
| | | // List<AggregateResult> allArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | // WHERE Id =: str |
| | | // GROUP BY Asset_Model_No__c]; |
| | | List<Consumable_Orderdetails__c> allArrDetList = [SELECT Asset_Model_No__c,Consumable_count__c FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c =: orderId]; |
| | | // for(Integer i = 0 ; i< allArrDetList.size();i++){ |
| | | // allArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | // } |
| | | Map<String,Decimal> arrDetMap = new Map<String,Decimal>(); |
| | | for(showRecords arr : arrDetIifo){ |
| | | arrDetMap.put(arr.prodModel, arr.recordCount); |
| | | } |
| | | for(showRecords notarr : notArrDetIifo){ |
| | | if(arrDetMap.containsKey(notarr.prodModel)){ |
| | | arrDetMap.put(notarr.prodModel, arrDetMap.get(notarr.prodModel)+notarr.recordCount); |
| | | }else{ |
| | | arrDetMap.put(notarr.prodModel, notarr.recordCount); |
| | | } |
| | | } |
| | | List<String> AssetModelNoEdList = new List<String>();//20200904 ljh add |
| | | for(Consumable_Orderdetails__c allarr : allArrDetList){ |
| | | for(String promodel : arrDetMap.keySet()){ |
| | | if(allarr.Asset_Model_No__c == promodel){ |
| | | if((allarr.Consumable_count__c - arrDetMap.get(promodel)) > 0){ |
| | | allarr.Consumable_count__c = (allarr.Consumable_count__c - arrDetMap.get(promodel)); |
| | | otherArrDetIifo.add(allarr); |
| | | } |
| | | AssetModelNoEdList.add(promodel);//20200904 ljh add |
| | | } |
| | | } |
| | | } |
| | | //20200904 ljh add start |
| | | for(Consumable_Orderdetails__c allarr1 : allArrDetList){ |
| | | if(!AssetModelNoEdList.contains(allarr1.Asset_Model_No__c)){ |
| | | otherArrDetIifo.add(allarr1); |
| | | } |
| | | } |
| | | for(Consumable_Orderdetails__c conOrderDetail : otherArrDetIifo){ |
| | | ShowRecords record = new ShowRecords(); |
| | | record.prodModel = conOrderDetail.Asset_Model_No__c; |
| | | record.recordCount = conOrderDetail.Consumable_count__c; |
| | | otherArrList.add(record); |
| | | } |
| | | results.recordList = otherArrList; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //还没发货数量All |
| | | @AuraEnabled |
| | | public static Results initNotArrDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allOtherDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | GROUP BY Asset_Model_No__c]; |
| | | Map<String,Decimal> conOrderMap = new Map<String,Decimal>(); |
| | | for(AggregateResult agg : arrDetList){ |
| | | conOrderMap.put(String.valueOf(agg.get('prodModel')), Integer.valueOf(agg.get('recordCount'))); |
| | | } |
| | | |
| | | List<Consumable_Orderdetails__c> conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =: orderId ]; |
| | | Map<String,Decimal> allConOrderMap = new Map<String,Decimal>(); |
| | | for(Consumable_Orderdetails__c con : conOrderList1){ |
| | | if(con.Consumable_count__c == null){ |
| | | con.Consumable_count__c = 0; |
| | | } |
| | | if(allConOrderMap.containsKey(con.Asset_Model_No__c)){ |
| | | allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c); |
| | | }else{ |
| | | allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c); |
| | | } |
| | | } |
| | | for(String pmodel : allConOrderMap.keySet()){ |
| | | if(conOrderMap.containsKey(pmodel)){ |
| | | if(allConOrderMap.get(pmodel) - conOrderMap.get(pmodel) > 0){ |
| | | showRecords showrecord1 = new showRecords(); |
| | | showrecord1.recordCount = allConOrderMap.get(pmodel) - conOrderMap.get(pmodel); |
| | | showrecord1.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord1); |
| | | } |
| | | }else{ |
| | | showRecords showrecord2 = new showRecords(); |
| | | showrecord2.recordCount = allConOrderMap.get(pmodel); |
| | | showrecord2.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord2); |
| | | } |
| | | } |
| | | results.recordList = allOtherDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //发货七天还未到货数 |
| | | @AuraEnabled |
| | | public static Results initMoreThan7(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Consumable_order_minor__c != null |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Arrive__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Consumable_order_minor__r.showFalseNotshowTrue__c = false |
| | | AND Deliver_date__c < LAST_N_DAYS:7 |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | |
| | | for(Integer i = 0 ; i< morethan7daysList.size() ; i++){ |
| | | morethansevendaysIifo.add(new showRecords(morethan7daysList[i])); |
| | | } |
| | | results.recordList = morethansevendaysIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //发货七天还未到货数All |
| | | @AuraEnabled |
| | | public static Results initMoreThan7All(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | system.debug('==============>conorderlist'+conorderlist); |
| | | system.debug('==============>conorderlist'+conorderlist.size()); |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | system.debug('all============'); |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | system.debug('allconList==========='+conList.size()); |
| | | }else{ |
| | | system.debug('notall============='); |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | system.debug('notallconList==========='+conList.size()); |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | AND Consumable_order_minor__c != null |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Arrive__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Consumable_order_minor__r.showFalseNotshowTrue__c = false |
| | | AND Deliver_date__c < LAST_N_DAYS:7 |
| | | GROUP BY Asset_Model_No__c]; |
| | | system.debug('Morethan7daysList================>'+morethan7daysList.size()); |
| | | for(Integer i = 0 ; i< morethan7daysList.size() ; i++){ |
| | | morethansevendaysIifo.add(new showRecords(morethan7daysList[i])); |
| | | system.debug('MorethansevendaysIifo+++++++'+morethansevendaysIifo); |
| | | } |
| | | results.recordList = morethansevendaysIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<ShowRecords> recordList; |
| | | } |
| | | |
| | | |
| | | public class ShowRecords implements Comparable { |
| | | @AuraEnabled |
| | | public Decimal recordCount { get; set; } |
| | | @AuraEnabled |
| | | public String prodModel { get; set; } |
| | | |
| | | public ShowRecords() {} |
| | | |
| | | public ShowRecords(AggregateResult e) { |
| | | recordCount =Integer.valueOf(e.get('recordCount')); |
| | | prodModel = String.valueOf(e.get('prodModel')); |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | /*** |
| | | * |
| | | * |
| | | * |
| | | * |
| | | */ |
| | | public without sharing class LexConsumableOrderManageController { |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String agencyProType { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static String baseUrl { get; private set; } |
| | | private static String[] columus = new List<String>{ 'Product2__c.Name' }; |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | public static List<CusOption> provinceCusOpts; |
| | | private static String accountid = null; |
| | | public static List<String> title { get; private set; } |
| | | public static List<String> column; |
| | | public static List<List<String>> columns { get; private set; } |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | private static String userWorkLocation; |
| | | public static Boolean hasHop { get; set; } |
| | | public static Boolean hasSpecial { get; set; } |
| | | public LexConsumableOrderManageController() { |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init1() { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | String userId = UserInfo.getUserId(); |
| | | // String userId = '0050l000007CAieAAG'; |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [ |
| | | SELECT accountid, Work_Location__c, UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId |
| | | ]; |
| | | accountid = Useracc[0].accountid; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | coc = new Consumable_order__c(); |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('order_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | List<CusCol> cols = new List<CusCol>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | //add by Link |
| | | CusCol col = new CusCol(); |
| | | col.label = fsm.getLabel(); |
| | | col.fieldName = fsm.getFieldPath(); |
| | | col.hideDefaultActions = true; |
| | | // col.sortable = true; |
| | | col.wrapText = true; |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c') { |
| | | col.type = 'url'; |
| | | col.fieldName = 'hosUrl'; |
| | | TypeAttr typeAttributes1 = new TypeAttr(); |
| | | CusLable cusLabel = new CusLable(); |
| | | cusLabel.fieldName = 'hosName'; |
| | | typeAttributes1.label = cusLabel; |
| | | typeAttributes1.target = '_blank'; |
| | | col.typeAttributes = typeAttributes1; |
| | | } |
| | | if (fsm.getFieldPath() == 'Name') { |
| | | col.type = 'url'; |
| | | col.fieldName = 'nameUrl'; |
| | | TypeAttr typeAttributes1 = new TypeAttr(); |
| | | CusLable cusLabel = new CusLable(); |
| | | cusLabel.fieldName = 'Name'; |
| | | typeAttributes1.label = cusLabel; |
| | | typeAttributes1.target = '_blank'; |
| | | col.typeAttributes = typeAttributes1; |
| | | } |
| | | cols.add(col); |
| | | //update by rentx 2020-12-22 start |
| | | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | title.add(fsm.getLabel()); |
| | | } |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | } |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOpts.add(new SelectOption('草案中', '草案中')); |
| | | provinceOpts.add(new SelectOption('已提交', '已提交')); |
| | | provinceOpts.add(new SelectOption('批准', '批准')); |
| | | provinceOpts.add(new SelectOption('驳回', '驳回')); |
| | | //针对lwc的自定义option |
| | | provinceCusOpts = new List<CusOption>(); |
| | | provinceCusOpts.add(new CusOption('-无-', '')); |
| | | provinceCusOpts.add(new CusOption('草案中', '草案中')); |
| | | provinceCusOpts.add(new CusOption('已提交', '已提交')); |
| | | provinceCusOpts.add(new CusOption('批准', '批准')); |
| | | provinceCusOpts.add(new CusOption('驳回', '驳回')); |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '订单' + '\''; |
| | | soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\''; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\''; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c '; |
| | | System.debug('====soql====' + soql); |
| | | raesList = Database.query(soql); |
| | | //add by rentx 2021-3-10 start |
| | | //为 hasHop 赋值 判断当前经销商下是否有特价医院 |
| | | List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hopList == null || hopList.size() == 0) { |
| | | hasHop = false; |
| | | } else { |
| | | hasHop = true; |
| | | } |
| | | //为 hasSpecial 赋值 判断当前经销商下是否有促销商品 |
| | | //查询当前经销商下的有效合同 |
| | | List<Account> contractList = [ |
| | | SELECT Id, Name, RecordType.DeveloperName |
| | | FROM Account |
| | | WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid |
| | | ]; |
| | | List<Id> dealIds = new List<Id>(); |
| | | if (contractList != null && contractList.size() > 0) { |
| | | for (Account acc : contractList) { |
| | | dealIds.add(acc.Id); |
| | | } |
| | | List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds]; |
| | | if (deList == null || deList.size() == 0) { |
| | | hasSpecial = false; |
| | | } else { |
| | | hasSpecial = true; |
| | | } |
| | | } else { |
| | | hasSpecial = false; |
| | | } |
| | | results.result = 'Success'; |
| | | results.provinceOpts = provinceCusOpts; |
| | | results.raesList = raesList; |
| | | results.agencyProType = agencyProType; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.accountid = accountid; |
| | | results.hasHop = hasHop; |
| | | results.hasSpecial = hasSpecial; |
| | | results.title = title; |
| | | results.cols = cols; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails( |
| | | String categoryStr, |
| | | Date orderDate, |
| | | String orderStatus, |
| | | String accountidStr, |
| | | String agencyProTypeStr, |
| | | String userWorkLocationStr |
| | | ) { |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | accountid = accountidStr; |
| | | if (String.isBlank(categoryStr)) { |
| | | category1 = null; |
| | | } else { |
| | | category1 = categoryStr; |
| | | } |
| | | coc = new Consumable_order__c(); |
| | | if (String.isBlank(orderStatus)) { |
| | | coc.Order_status__c = null; |
| | | } else { |
| | | coc.Order_status__c = orderStatus; |
| | | } |
| | | coc.Order_date__c = orderDate; |
| | | try { |
| | | Date cate2 = coc.Order_date__c; |
| | | String cate3 = coc.Order_status__c; |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('order_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | //update by rentx 2020-12-22 start |
| | | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | title.add(fsm.getLabel()); |
| | | } |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += |
| | | ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + |
| | | '订单' + |
| | | '\' and RecordtypeId = \'' + |
| | | System.Label.RT_ConOrder_Order + |
| | | '\' and Dealer_Info__c =\'' + |
| | | accountid + |
| | | '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Order_date__c = :cate2'; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Order_status__c = :cate3 '; |
| | | } |
| | | soql += ' order by Order_status__c '; |
| | | system.debug('====soql:' + soql); |
| | | raesList = Database.query(soql); |
| | | system.debug('====raesList:' + raesList); |
| | | if (raesList.size() > 0) { |
| | | results.result = 'Success'; |
| | | results.raesList = raesList; |
| | | results.errorMsg = '共有' + raesList.size() + '个订单'; |
| | | } else { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = '没有搜索到相关订单'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<CusOption> provinceOpts; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public Boolean hasHop; |
| | | @AuraEnabled |
| | | public Boolean hasSpecial; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public List<CusCol> cols; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | |
| | | public class CusOption { |
| | | CusOption(String label, String value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | |
| | | public class CusCol { |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String fieldName; |
| | | @AuraEnabled |
| | | public String type; |
| | | @AuraEnabled |
| | | public Boolean sortable; |
| | | @AuraEnabled |
| | | public Boolean wrapText; |
| | | @AuraEnabled |
| | | public Boolean hideDefaultActions; |
| | | @AuraEnabled |
| | | public TypeAttr typeAttributes; |
| | | } |
| | | |
| | | public class TypeAttr { |
| | | @AuraEnabled |
| | | public CusLable label; |
| | | @AuraEnabled |
| | | public String target; |
| | | } |
| | | |
| | | public class CusLable { |
| | | @AuraEnabled |
| | | public String fieldName; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexDealerInquiryModifyStateController { |
| | | public static List<OpportunityInfo> oppRecords { get; set; } |
| | | // ページレイアウトの情報を取得 |
| | | private static Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>(); |
| | | // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null; |
| | | public static List<OpportunityInfo> OPPORTList { get; set; } |
| | | /*****************検索用******************/ |
| | | |
| | | /*******************检索属性值*******************/ |
| | | |
| | | public static String accSearch { get; set; }//经销商医院 |
| | | public static String aooSearch { get; set; }//担当人 |
| | | public static String numtext1 { get; set; } //数据字段01 |
| | | public static String numtext { get; set; }//数据字段03 |
| | | public static String numtext2 { get; set; } //数据字段02 |
| | | public static String timetext1 { get; set; } //日期01 |
| | | public static String timetext2 { get; set; } //日期02 |
| | | public static Agency_Opportunity__c tmpAO { get; set; } //检索日期用 |
| | | public static Agency_Opportunity__c tmpBO { get; set; } //检索日期用 |
| | | public static String limits { get; set; }//日期03 |
| | | |
| | | public static List<SelectOption> dateOpts { get; private set; } |
| | | public static List<CusOption> textCusOpts; |
| | | public static List<SelectOption> textOpts { get; private set; } |
| | | |
| | | public static List<CusOption> timeCusOpts; |
| | | public static List<SelectOption> timeOpts { get; private set; } |
| | | |
| | | public static List<CusOption> equalCusOpts; |
| | | public static List<SelectOption> equalOpts { get; private set; } |
| | | public static List<SelectOption> timeequalOpts { get; private set; } |
| | | public static List<CusOption> limitCusOpts; |
| | | public static List<SelectOption> limitOpts { get; private set; } |
| | | |
| | | /*****************画面表示Bean******************/ |
| | | public static Integer oppCount { get; set; } |
| | | public static String saveType { get; set; } |
| | | |
| | | public static String sortKey { get; set; } |
| | | public static String preSortKey { get; set; } |
| | | public static Boolean sortOrderAsc { get; set; } |
| | | public static String[] sortOrder { get; set; } |
| | | public static String[] columus = new String[] {'Id'}; |
| | | public static String[] selColumus = null; |
| | | public static Set<String> columusSet = new Set<String> {'Id'}; |
| | | |
| | | // 项目set 字段标签 |
| | | public static List<String> titleLeft { get; private set; } |
| | | public static List<String> titleRight { get; private set; } |
| | | // 项目set 字段名 |
| | | public static List<List<String>> columnsLeftApi { get; private set; } // 参照項目用 |
| | | public static List<List<String>> columnsRightApi { get; private set; } // 参照項目用 |
| | | public static List<String> columnLeftCss { get; private set; } // css 用 |
| | | public static List<String> columnRightCss { get; private set; } // css 用 |
| | | public static Map<String, String> columnLeftRW { get; private set; } // r,w,wm用 |
| | | public static Map<String, String> columnRightRW { get; private set; } // r,w,wm用 |
| | | private static String strColumus; |
| | | private static String strRtColumus; |
| | | |
| | | @TestVisible private static String accTypeForSort = null; |
| | | private static Integer oppLimit = 500; |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | // public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | |
| | | public LexDealerInquiryModifyStateController() { |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init(Integer pageSizeLWC,Integer pageTokenLWC) { |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | Results results = new Results(); |
| | | oppRecords = new List<OpportunityInfo>(); |
| | | |
| | | //dateOpts = new List<SelectOption>(); |
| | | //dateOpts.add(new SelectOption('', '--无--')); |
| | | //dateOpts.add(new SelectOption('Registration_Day__c', '登录日')); |
| | | //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '禁用日期')); |
| | | |
| | | //数据字段下拉列表 |
| | | // textOpts = new List<SelectOption>(); |
| | | // textOpts.add(new SelectOption('', '--无--')); |
| | | // textOpts.add(new SelectOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | // textOpts.add(new SelectOption('Agency__r.Name', '经销商')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | // textOpts.add(new SelectOption('Department_Cateogy__c', '科室分类')); |
| | | // textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | // // textOpts.add(new SelectOption('Name', '询价名称')); |
| | | // textOpts.add(new SelectOption('StageName__c', '询价阶段')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | // //精琢科技 zxk 2021-08-25 start |
| | | // // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '状态2')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | // //精琢科技 zxk 2021-08-25 end |
| | | // textOpts.add(new SelectOption('Hospital_City_Master__c', '市')); |
| | | |
| | | //custom option |
| | | textCusOpts = new List<CusOption>(); |
| | | textCusOpts.add(new CusOption('', '--无--')); |
| | | textCusOpts.add(new CusOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | textCusOpts.add(new CusOption('Agency__r.Name', '经销商')); |
| | | textCusOpts.add(new CusOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | textCusOpts.add(new CusOption('Department_Cateogy__c', '科室分类')); |
| | | textCusOpts.add(new CusOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | textCusOpts.add(new CusOption('StageName__c', '询价阶段')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | textCusOpts.add(new CusOption('Hospital_City_Master__c', '市')); |
| | | |
| | | |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '销售本部')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '省')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '市')); |
| | | //日期字段下拉列表 |
| | | // timeOpts = new List<SelectOption>(); |
| | | // timeOpts.add(new SelectOption('', '--无--')); |
| | | // timeOpts.add(new SelectOption('Created_Day__c', '创建日')); |
| | | // timeOpts.add(new SelectOption('Bid_Planned_Date__c', '预测招标日')); |
| | | // timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | // timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | // timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | // timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | timeCusOpts = new List<CusOption>(); |
| | | timeCusOpts.add(new CusOption('', '--无--')); |
| | | timeCusOpts.add(new CusOption('Created_Day__c', '创建日')); |
| | | timeCusOpts.add(new CusOption('Bid_Planned_Date__c', '预测招标日')); |
| | | timeCusOpts.add(new CusOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | timeCusOpts.add(new CusOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | timeCusOpts.add(new CusOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | timeCusOpts.add(new CusOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | |
| | | |
| | | //数据字段中间连接符号 |
| | | // equalOpts = new List<SelectOption>(); |
| | | // equalOpts.add(new SelectOption('=', '等于')); |
| | | // equalOpts.add(new SelectOption('<>', '不等于')); |
| | | // equalOpts.add(new SelectOption('<', '<')); |
| | | // equalOpts.add(new SelectOption('>', '>')); |
| | | // equalOpts.add(new SelectOption('<=', '<=')); |
| | | // equalOpts.add(new SelectOption('>=', '>=')); |
| | | // equalOpts.add(new SelectOption('contains', '包含')); |
| | | // equalOpts.add(new SelectOption('notcontains', '不包含')); |
| | | // equalOpts.add(new SelectOption('starts with', '起始字符')); |
| | | |
| | | equalCusOpts = new List<CusOption>(); |
| | | equalCusOpts.add(new CusOption('=', '等于')); |
| | | equalCusOpts.add(new CusOption('<>', '不等于')); |
| | | equalCusOpts.add(new CusOption('<', '<')); |
| | | equalCusOpts.add(new CusOption('>', '>')); |
| | | equalCusOpts.add(new CusOption('<=', '<=')); |
| | | equalCusOpts.add(new CusOption('>=', '>=')); |
| | | equalCusOpts.add(new CusOption('contains', '包含')); |
| | | equalCusOpts.add(new CusOption('notcontains', '不包含')); |
| | | equalCusOpts.add(new CusOption('starts with', '起始字符')); |
| | | |
| | | //日期字段连接符号 |
| | | //timeequalOpts = new List<SelectOption>(); |
| | | //timeequalOpts.add(new SelectOption('=', '等于')); |
| | | //timeequalOpts.add(new SelectOption('<>', '不等于')); |
| | | //timeequalOpts.add(new SelectOption('<', '<')); |
| | | //timeequalOpts.add(new SelectOption('>', '>')); |
| | | //timeequalOpts.add(new SelectOption('<=', '<=')); |
| | | //timeequalOpts.add(new SelectOption('>=', '>=')); |
| | | //数据显示条数 |
| | | // limitOpts = new List<SelectOption>(); |
| | | // limitOpts.add(new SelectOption('10', '10')); |
| | | // limitOpts.add(new SelectOption('20', '20')); |
| | | // limitOpts.add(new SelectOption('50', '50')); |
| | | // limitOpts.add(new SelectOption('100', '100')); |
| | | // limitOpts.add(new SelectOption('200', '200')); |
| | | // limitOpts.add(new SelectOption('1000', '全部')); |
| | | //数据显示默认条数 |
| | | limits = '20'; |
| | | |
| | | limitCusOpts = new List<CusOption>(); |
| | | limitCusOpts.add(new CusOption('10', '10')); |
| | | limitCusOpts.add(new CusOption('20', '20')); |
| | | limitCusOpts.add(new CusOption('50', '50')); |
| | | limitCusOpts.add(new CusOption('100', '100')); |
| | | limitCusOpts.add(new CusOption('200', '200')); |
| | | limitCusOpts.add(new CusOption('1000', '全部')); |
| | | try{ |
| | | PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap(); |
| | | soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element(); |
| | | soap.SessionHeader.sessionId = UserInfo.getSessionId(); |
| | | soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/partner/services/Soap/u/33.0'; |
| | | // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0'; |
| | | |
| | | PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult(); |
| | | if (System.Test.isRunningTest()) { |
| | | // UnitTest 用 |
| | | // PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult(); |
| | | PartnerSoapSforceCom.RecordTypeMapping rtMap = new PartnerSoapSforceCom.RecordTypeMapping(); |
| | | PartnerSoapSforceCom.DescribeLayout editLayout = new PartnerSoapSforceCom.DescribeLayout(); |
| | | PartnerSoapSforceCom.DescribeLayoutSection editLayoutSection = new PartnerSoapSforceCom.DescribeLayoutSection(); |
| | | PartnerSoapSforceCom.DescribeLayoutRow layoutRow = new PartnerSoapSforceCom.DescribeLayoutRow(); |
| | | PartnerSoapSforceCom.DescribeLayoutItem layoutItem = new PartnerSoapSforceCom.DescribeLayoutItem(); |
| | | PartnerSoapSforceCom.DescribeLayoutComponent layoutComponent = new PartnerSoapSforceCom.DescribeLayoutComponent(); |
| | | dlr.recordTypeMappings = new List<PartnerSoapSforceCom.RecordTypeMapping>(); |
| | | dlr.recordTypeMappings.add(rtMap); |
| | | rtMap.recordTypeId = 'recordTypeId'; |
| | | dlr.layouts = new List<PartnerSoapSforceCom.DescribeLayout>(); |
| | | dlr.layouts.add(editLayout); |
| | | editLayout.editLayoutSections = new List<PartnerSoapSforceCom.DescribeLayoutSection>(); |
| | | editLayout.editLayoutSections.add(editLayoutSection); |
| | | editLayoutSection.layoutRows = new List<PartnerSoapSforceCom.DescribeLayoutRow>(); |
| | | editLayoutSection.layoutRows.add(layoutRow); |
| | | layoutRow.layoutItems = new List<PartnerSoapSforceCom.DescribeLayoutItem>(); |
| | | layoutRow.layoutItems.add(layoutItem); |
| | | layoutItem.layoutComponents = new List<PartnerSoapSforceCom.DescribeLayoutComponent>(); |
| | | layoutItem.layoutComponents.add(layoutComponent); |
| | | // return dlr; |
| | | } else { |
| | | dlr = soap.describeLayout('Agency_Opportunity__c', null, null); |
| | | // dlr = soap.describeLayout('asdas', null, null); |
| | | } |
| | | |
| | | // PartnerSoapSforceCom.DescribeLayoutResult dlr = soap.describeLayout('Agency_Opportunity__c', null, null); |
| | | Map<String, PartnerSoapSforceCom.DescribeLayout> layputMap = new Map<String, PartnerSoapSforceCom.DescribeLayout>(); |
| | | for (PartnerSoapSforceCom.DescribeLayout layout : dlr.layouts) { |
| | | layputMap.put(layout.id, layout); |
| | | } |
| | | for (Integer lidx = 0; lidx < dlr.recordTypeMappings.size(); lidx++) { |
| | | String recordTypeId = dlr.recordTypeMappings[lidx].recordTypeId; |
| | | Map<String, String> rtnInner = new Map<String, String>(); |
| | | editLayoutItemRWMap.put(recordTypeId, rtnInner); |
| | | System.debug('recordTypeId=' + recordTypeId); |
| | | PartnerSoapSforceCom.DescribeLayout layout = layputMap.get(dlr.recordTypeMappings[lidx].layoutId); |
| | | for (PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections) { |
| | | for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) { |
| | | for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) { |
| | | if (item.layoutComponents != null && item.layoutComponents.size() > 0 |
| | | && String.isBlank(item.layoutComponents[0].value) == false) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'r'); |
| | | if (item.editableForUpdate) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'w'); |
| | | } |
| | | if (item.required) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'wm'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // editLayoutItemRWMap = SoapApi.getEditRWByRecordType('Agency_Opportunity__c', null); |
| | | tmpAO = new Agency_Opportunity__c(); |
| | | tmpBO = new Agency_Opportunity__c(); |
| | | setLayoutRWInfo(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('limitCusOpts==>'+limitCusOpts); |
| | | System.debug('searchOppInner==>'+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey)); |
| | | LexDealerInquiryModifyStateController.Results returnList = searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('returnList==>'+ returnList); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = oppRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > oppRecords.size()) { |
| | | endIdx = oppRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageoppRecords.add(oppRecords.get(i)); |
| | | } |
| | | //end |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | results.timeCusOpts = timeCusOpts; |
| | | results.equalCusOpts = equalCusOpts; |
| | | results.limitCusOpts = limitCusOpts; |
| | | results.textCusOpts = textCusOpts; |
| | | results.limits = limits; |
| | | results.strColumus = strColumus; |
| | | results.strRtColumus = strRtColumus; |
| | | results.paginatedAccounts = paginatedAccounts; |
| | | results.pageoppRecords = pageoppRecords; |
| | | results.Msg = returnList.Msg; |
| | | |
| | | |
| | | System.debug('results==>'+results); |
| | | |
| | | }catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.Msg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | |
| | | // return null; |
| | | return results; |
| | | } |
| | | //用于获取经销商询价字段集和询价字段集以及相应的读写权限 |
| | | @TestVisible private static void setLayoutRWInfo() { |
| | | // if (this.sortOrder == null) { |
| | | if (sortOrder == null) { |
| | | selColumus = new String[] {}; |
| | | strColumus = ''; |
| | | ID accRecordTypeId = accTypeForSort; |
| | | |
| | | Map<String, String> DESC_RW = editLayoutItemRWMap.get('012100000006KW7AAM'); |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Agency_Opportunity__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('DealerInquiryModifyState'); |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | titleLeft = new List<String>(); |
| | | List<String> columnLeft = new List<String>(); |
| | | columnLeftCss = new List<String>(); |
| | | columnsLeftApi = new List<List<String>>(); |
| | | columnLeftRW = new Map<String, String>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | titleLeft.add(fsm.getLabel()); |
| | | columnLeft.add(fsm.getFieldPath()); |
| | | List<String> splitFieldPath = fsm.getFieldPath().split('\\.'); |
| | | columnsLeftApi.add(splitFieldPath); |
| | | if (DESC_RW == null) { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } else if (splitFieldPath.size() == 1) { |
| | | String rw = DESC_RW.get(fsm.getFieldPath()); |
| | | if (rw != null) { |
| | | columnLeftRW.put(fsm.getFieldPath(), rw); |
| | | } else { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } else { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } |
| | | for (String str : columnLeftRW.keySet()) { |
| | | System.debug(str + '=+=+=+=+=' + columnLeftRW.get(str)); |
| | | } |
| | | for (String s : columnLeft) { |
| | | if (columusSet.contains(s) == false) { |
| | | columus.add(s); |
| | | columusSet.add(s); |
| | | } |
| | | if (selColumus.contains(s) == false) { |
| | | selColumus.add(s); |
| | | } |
| | | columnLeftCss.add(s.replace('.', '_')); |
| | | } |
| | | strRtColumus = ''; |
| | | Schema.FieldSet fsRt = fsMap.get('DealerOpportunity'); |
| | | List<FieldSetMember> fsmListRt = fsRt.getFields(); |
| | | titleRight = new List<String>(); |
| | | List<String> columnRight = new List<String>(); |
| | | columnRightCss = new List<String>(); |
| | | columnsRightApi = new List<List<String>>(); |
| | | columnRightRW = new Map<String, String>(); |
| | | |
| | | for (FieldSetMember fsm : fsmListRt) { |
| | | titleRight.add(fsm.getLabel()); |
| | | columnRight.add(fsm.getFieldPath()); |
| | | List<String> splitFieldPath = fsm.getFieldPath().split('\\.'); |
| | | columnsRightApi.add(splitFieldPath); |
| | | if (DESC_RW == null) { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } else if (splitFieldPath.size() == 1) { |
| | | String rw = DESC_RW.get(fsm.getFieldPath()); |
| | | if (rw != null) { |
| | | columnRightRW.put(fsm.getFieldPath(), rw); |
| | | } else { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } else { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } |
| | | for (String s : columnRight) { |
| | | selColumus.add(s); |
| | | if (strRtColumus == '') { |
| | | strRtColumus = s; |
| | | } else { |
| | | strRtColumus = strRtColumus + ',' + s; |
| | | } |
| | | columnRightCss.add(s.replace('.', '_')); |
| | | |
| | | } |
| | | strColumus = String.join(columus, ','); |
| | | System.debug('======-======-======strColumus' + strColumus); |
| | | System.debug('======-======-======strRtColumus' + strRtColumus); |
| | | sortOrderAsc = true; |
| | | sortOrder = new String[selColumus.size()]; |
| | | for (Integer i = 0; i < selColumus.size(); i++) sortOrder[i] = ' '; |
| | | } |
| | | } |
| | | //用于拼接SOQL语句 根据不同检索条件拼接不同SOQL语句。 |
| | | @AuraEnabled |
| | | public static Results searchOppInner(String strColumus,String strRtColumus,String accSearch,String aooSearch,String numtext,String numtext1,String numtext2,String sortKeyLWC) { |
| | | Results results = new Results(); |
| | | sortKey = sortKeyLWC; |
| | | |
| | | //SOQL:拼接检索条件以及经销商询价的SOQL语句 |
| | | // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)]; |
| | | // String querySoql = ''; |
| | | // Integer queryint = 0; |
| | | // for(User user : userlist2){ |
| | | // if(queryint == 0){ |
| | | // querySoql += '\''+user.Id+'\''; |
| | | // queryint++; |
| | | // }else{ |
| | | // querySoql += ',\''+user.Id+'\''; |
| | | // } |
| | | |
| | | // } |
| | | // System.debug('pppqqq222'+userlist2); |
| | | // System.debug('pppqqq333'+querySoql); |
| | | // AND Ownerid in ( '+querySoql+')' |
| | | |
| | | String soql = 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' + |
| | | strColumus + ',' + strRtColumus + |
| | | ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' '; |
| | | //数据字段:经销商医院 +SOQL |
| | | if (!String.isBlank(accSearch)) { |
| | | accSearch = accSearch.trim(); |
| | | // soql += 'AND Agency__r.Name ' + ' LIKE \'%' + accSearch + '%\' '; |
| | | soql += 'AND Agency_Hospital__r.Name ' + ' LIKE \'%' + accSearch + '%\' '; |
| | | } |
| | | //数据字段:担当人 +SOQL |
| | | if (!String.isBlank(aooSearch)) { |
| | | String newAooSearch = aooSearch.trim(); |
| | | // soql += 'AND Change_To_Opportunity__r.Owner.Alias = ' + '\'' + newAooSearch + '\'';//Name |
| | | soql += 'AND Agency_PersonName__c ' + ' LIKE \'%' + newAooSearch + '%\' '; |
| | | } |
| | | //数据字段:03 手动填写项 准备调用makeTextSql; |
| | | if (!String.isBlank(numtext)) { |
| | | String newNumtext = numtext.trim(); |
| | | String str = makeTextSql(numtext1, numtext2, newNumtext); |
| | | soql += str; |
| | | System.debug('+++++++++++++=============++++++++++++++++++' + soql); |
| | | } |
| | | //点击排序 |
| | | // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7); |
| | | //start注释 by WangXueqin |
| | | // if (String.isBlank(this.sortKey)) { |
| | | // soql += ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits); |
| | | // } else { |
| | | // if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) { |
| | | // soql += ' order by ' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits); |
| | | // } else { |
| | | // soql += ' order by Change_To_Opportunity__r.' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits); |
| | | // } |
| | | // } |
| | | // system.debug(soql); |
| | | //end |
| | | |
| | | |
| | | |
| | | // List<User> userlist1 = [select id,name from user ]; |
| | | // System.debug('pppqqq111'+userlist1); |
| | | |
| | | List<Agency_Opportunity__c> InfoList = Database.query(soql); |
| | | System.debug('+++++++-------------------'+InfoList); |
| | | |
| | | // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql); |
| | | // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c); |
| | | for (Agency_Opportunity__c apt : InfoList) { |
| | | System.debug('pppqqq' + apt.Agency_PersonName__c + '====' + apt.Name); |
| | | } |
| | | |
| | | List<OpportunityInfo> oppinfoList = new List<OpportunityInfo>(); |
| | | if (InfoList != null && InfoList.size() > 0) { |
| | | String str = ''; |
| | | for (Agency_Opportunity__c agc : InfoList) { |
| | | if (str == '' && agc.Change_To_Opportunity__r.Id != null) { |
| | | str = '\'' + agc.Change_To_Opportunity__r.Id + '\''; |
| | | } else if (agc.Change_To_Opportunity__r.Id != null) { |
| | | str += ',\'' + agc.Change_To_Opportunity__r.Id + '\''; |
| | | |
| | | } |
| | | } |
| | | for (Agency_Opportunity__c info : InfoList) { |
| | | oppinfoList.add(new OpportunityInfo(info, info)); |
| | | oppinfoList[oppinfoList.size() - 1].lineNo = oppinfoList.size() - 1; |
| | | } |
| | | } |
| | | oppRecords = oppinfoList.clone(); |
| | | oppCount = oppRecords.size(); |
| | | //显示提示操作信息 |
| | | if (String.isBlank(saveType) && String.isBlank(sortKey)) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '取得最近的 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '取得最近的 ' + oppCount + ' 条数据'; |
| | | return results; |
| | | } else if (!String.isBlank(sortKey)) { |
| | | if (oppCount > oppLimit) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件')); |
| | | results.result = 'Success'; |
| | | results.Msg = '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件'; |
| | | |
| | | } else { |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | } |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | } |
| | | // //分页 |
| | | // PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | // totalCount = oppRecords.size(); |
| | | // paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | // paginatedAccounts.recordStart = pageToken + 1; |
| | | // paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | // Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | // paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | // paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | // Integer startIdx; |
| | | // Integer endIdx; |
| | | // List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | // startIdx = pageToken; |
| | | // endIdx = startIdx + pageSize; |
| | | // if (endIdx > oppRecords.size()) { |
| | | // endIdx = oppRecords.size(); |
| | | // } |
| | | // for (Integer i = startIdx; i < endIdx; i++) { |
| | | // pageoppRecords.add(oppRecords.get(i)); |
| | | // } |
| | | // //end |
| | | |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | return results; |
| | | |
| | | } |
| | | //检索条件:数据字段1,数据字段2,数据字段3均满足进入此方法 判断多种情况 |
| | | private static String makeTextSql(String textOpts, String equalOpts, String numtext) { |
| | | String soql = ''; |
| | | if (!String.isBlank(textOpts)) { |
| | | //寻找检索条件包含‘ ’ 空格的多重检索条件 |
| | | //system.debug('314-textOpts:'+textOpts); |
| | | if ((equalOpts == 'contains' || equalOpts == 'notcontains') && numtext.contains(',')) { |
| | | //system.debug('316-equalOpts:'+equalOpts); |
| | | //system.debug('316-numtext:'+numtext); |
| | | String[] vals = numtext.split(','); |
| | | String cSql = ''; |
| | | soql += ' AND ('; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | |
| | | //精琢科技 zxk 2021-08-25 start |
| | | String val = vals[icount]; |
| | | if (equalOpts == 'contains') { |
| | | cSql = makeTextSqlStr(textOpts, equalOpts, val); |
| | | soql += cSql; |
| | | |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | } |
| | | } else if (equalOpts == 'notcontains') { |
| | | cSql = makeTextSqlStr(textOpts, equalOpts, val); |
| | | soql += cSql; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' AND '; |
| | | } |
| | | } |
| | | |
| | | } |
| | | //精琢科技 zxk 2021-08-25 end |
| | | |
| | | |
| | | // String val = vals[icount]; |
| | | // cSql = this.makeTextSqlStr(textOpts, equalOpts, val); |
| | | // system.debug(cSql); |
| | | // soql += cSql; |
| | | // if (icount < vals.size() - 1) { |
| | | // soql += ' OR '; |
| | | // } |
| | | // } |
| | | soql += ')'; |
| | | } |
| | | //寻找检索条件包含‘,’ 逗号的多重检索条件 |
| | | else if ((equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')) { |
| | | String[] vals = numtext.split(','); |
| | | soql += ' AND ( '; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | String val = vals[icount]; |
| | | if (equalOpts == '=') { |
| | | soql += textOpts + ' = \'' + val + '\''; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | } |
| | | } else if (equalOpts == '<>') { |
| | | soql += textOpts + ' <> \'' + val + '\''; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' AND '; |
| | | } |
| | | } |
| | | } |
| | | soql += ')'; |
| | | } |
| | | //检索连接符为包含以及不包含 |
| | | else if (equalOpts.equals('contains') || equalOpts.equals('notcontains')) { |
| | | if (equalOpts.equals('contains')) { |
| | | soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\''; |
| | | } else if (equalOpts.equals('notcontains')) { |
| | | soql += ' AND ( NOT ' + textOpts + ' LIKE \'%' + numtext + '%\' ) '; |
| | | } |
| | | } |
| | | //检索连接符为等于以及不等于 |
| | | else if (equalOpts == '=' || equalOpts == '<>') { |
| | | soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\''; |
| | | } |
| | | |
| | | //精琢科技 zxk 2021-08-25 start |
| | | //起始字符 |
| | | else if (equalOpts == 'starts with' && numtext.contains(' ')) { |
| | | String[] vals = numtext.split(' '); |
| | | soql += ' AND ( '; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | String val = vals[icount]; |
| | | if (equalOpts == 'starts with') { |
| | | soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | |
| | | } |
| | | } |
| | | } |
| | | soql += ')'; |
| | | |
| | | } |
| | | //精琢科技 zxk 2021-08-25 end |
| | | |
| | | // //起始字符 |
| | | // else if (equalOpts == 'starts with'){ |
| | | // soql += 'AND ' + textOpts + ' LIKE \'' + numtext + '%\''; |
| | | // } |
| | | //检索连接符的其他情况 |
| | | else { |
| | | String cSql = makeTextSqlStr(textOpts, equalOpts, numtext); |
| | | if (equalOpts != '<>') { |
| | | soql += cSql; |
| | | } else { |
| | | soql += ' and (NOT ' + cSql + ') '; |
| | | } |
| | | } |
| | | } |
| | | return soql; |
| | | } |
| | | //检索条件:数据字段1,数据字段2,数据字段3均满足,并且进入makeTextSql()之后,内含数据字段包含多种时进入此方法。 |
| | | @TestVisible private static String makeTextSqlStr(String textOpts, String equalOpts, String val) { |
| | | String soql = ''; |
| | | if (!String.isBlank(textOpts)) { |
| | | String tmpVal = val; |
| | | if (!String.isBlank(tmpVal)) { |
| | | if (equalOpts == 'contains' || equalOpts == 'notcontains') { |
| | | if (equalOpts == 'contains') { |
| | | soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ; |
| | | } else if (equalOpts == 'notcontains') { |
| | | soql += ' ( NOT ' + textOpts + ' LIKE \'%' + val + '%\' ) ' ; |
| | | } |
| | | } else if (equalOpts == '=' || equalOpts == '<>') { |
| | | if (equalOpts == '=') { |
| | | soql += ' AND ' + textOpts + ' = ' + val ; |
| | | } else if (equalOpts == '<>') { |
| | | soql += ' AND ' + textOpts + ' <> ' + val ; |
| | | } |
| | | } |
| | | } else { |
| | | soql = ' AND ' + textOpts; |
| | | if (equalOpts == '=') { |
| | | soql += ' = ' + tmpVal; |
| | | } else if (equalOpts == '<>') { |
| | | soql += ' <> ' + tmpVal; |
| | | } else if (equalOpts == 'contains') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else if (equalOpts == 'notcontains') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else if (equalOpts == 'starts with') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else { |
| | | soql += ' ' + equalOpts + ' ' + tmpVal; |
| | | } |
| | | } |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | //检索按钮:点击检索按钮触发此方法; |
| | | // public static PageReference chick() { |
| | | // setLayoutRWInfo(); |
| | | // searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey,pageSizeLWC,pageTokenLWC); |
| | | // return null; |
| | | // } |
| | | //页面内容有修改时,页面判断后传值给changeFlg以及changeFlgRt属性,点击保存时调用此方法,进行保存。 |
| | | @AuraEnabled |
| | | public static Results save(List<OpportunityInfo> oppRecordsLWC) { |
| | | //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp ); |
| | | Results results = new Results(); |
| | | oppRecords = oppRecordsLWC; |
| | | try { |
| | | List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>(); |
| | | // List<Opportunity> updOpps = new List<Opportunity>(); |
| | | for (OpportunityInfo oi : oppRecords) { |
| | | if (oi.changeFlg == '1') { |
| | | oi.changeFlg = '0'; |
| | | updTarget.add(oi.AgcOpp); |
| | | |
| | | } |
| | | // if (oi.changeFlgRt == '1' && oi.opp.id != null) { |
| | | // oi.changeFlgRt = '0'; |
| | | // updOpps.add(oi.opp); |
| | | // } |
| | | } |
| | | if (updTarget.size() > 0) { |
| | | system.debug('updTarget.size:' + updTarget.size() ); |
| | | update updTarget; |
| | | } |
| | | // if (updOpps.size() > 0) { |
| | | // update updOpps; |
| | | // } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了')); |
| | | results.result = 'Success'; |
| | | results.Msg = '保存完了'; |
| | | return results; |
| | | } catch (Exception e) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请确定科室分类和产品区分的关系')); |
| | | } |
| | | if(saveType == '1') { |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | saveType = ''; |
| | | } else if (saveType == '2') { |
| | | sortTable(); |
| | | saveType = ''; |
| | | } else { |
| | | } |
| | | return null; |
| | | } |
| | | //全部展开调用此方法 |
| | | public static PageReference sortTable() { |
| | | oppRecords = new List<OpportunityInfo>(); |
| | | if (sortKey == preSortKey) { |
| | | if (String.isBlank(sortKey) == false) { |
| | | // 方向が変わるのみ |
| | | sortOrderAsc = !sortOrderAsc; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } |
| | | } else { |
| | | sortOrderAsc = true; |
| | | if (String.isBlank(preSortKey) == false) { |
| | | sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | } |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } |
| | | preSortKey = sortKey; |
| | | |
| | | setLayoutRWInfo(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | return null; |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | //自定义类OpportunityInfo,用于创建虚拟字段,合并输出。 |
| | | class OpportunityInfo { |
| | | // public Opportunity opp { get; set; } |
| | | @AuraEnabled |
| | | public Agency_Opportunity__c opp { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canEdit { get; private set; } |
| | | @AuraEnabled |
| | | public Boolean hasError { get; private set; } |
| | | @AuraEnabled |
| | | public Boolean hasFieldError { get; private set; } |
| | | @AuraEnabled |
| | | public Integer lineNo { get; private set; } |
| | | @AuraEnabled |
| | | public String changeFlg { get; set; } |
| | | @AuraEnabled |
| | | public String changeFlgRt { get; set; } |
| | | @AuraEnabled |
| | | public Boolean ifLock { get; set; } |
| | | //public String accType { get; private set; } |
| | | @AuraEnabled |
| | | public Agency_Opportunity__c AgcOpp { get; set; } |
| | | public OpportunityInfo(Agency_Opportunity__c record, Agency_Opportunity__c oppo) { |
| | | opp = oppo; |
| | | canEdit = true; |
| | | hasError = false; |
| | | hasFieldError = false; |
| | | lineNo = 0; |
| | | changeFlg = '0'; |
| | | changeFlgRt = '0'; |
| | | ifLock = Approval.isLocked(record); |
| | | AgcOpp = record; |
| | | } |
| | | } |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String Msg; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> oppRecords; |
| | | @AuraEnabled |
| | | public Integer oppCount ; |
| | | @AuraEnabled |
| | | public List<CusOption> timeCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> textCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> equalCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> limitCusOpts; |
| | | @AuraEnabled |
| | | public String limits; |
| | | @AuraEnabled |
| | | public String strColumus; |
| | | @AuraEnabled |
| | | public String strRtColumus; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> pageoppRecords; |
| | | @AuraEnabled |
| | | public PaginatedAccounts paginatedAccounts; |
| | | @AuraEnabled |
| | | public Boolean canEdit; |
| | | @AuraEnabled |
| | | public String changeFlg; |
| | | } |
| | | public class CusOption { |
| | | CusOption(String value,String label) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexInventoryController { |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | //分页使用数据 |
| | | public static String fileName { get; set; } |
| | | public static Integer size{get;set;} |
| | | public static Integer noOfRecords{get; set;} |
| | | public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 丢失和巡回的,画面显示用 |
| | | public static ApexPages.StandardSetController setCon { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_order_details2__c> setConDetails2 { get; set; } |
| | | public static Map<Id,String> pandiandetailsMap = new Map<Id,String>(); |
| | | /*****************検索用******************/ |
| | | public static String barcode { get; set; } |
| | | public static Boolean done { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | //页面主数据显示用 |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords; |
| | | //盘点到的产品 |
| | | public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>(); |
| | | public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>(); |
| | | |
| | | //public List<Consumable_order_details2__c> pandiandetailsList { get; set; } |
| | | public static List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; } |
| | | //寻回明细 |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 丢失和巡回的,实际炒作用 |
| | | @AuraEnabled |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 产品单位的List |
| | | public static List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>(); |
| | | |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords; |
| | | |
| | | public static Integer consumableorderdetailsCount { |
| | | get { |
| | | return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size(); |
| | | } |
| | | } |
| | | //list<String> notexitlist = new list<String>(); |
| | | public static Map<String,String> reFindProduct = new Map<String,String>(); |
| | | //排序用 |
| | | // public static String sortKey; |
| | | // public static String preSortKey; |
| | | // public static Boolean sortOrderAsc; |
| | | // public static String[] sortOrder; |
| | | //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 有,BarCodeListP 没有 |
| | | /*****************经销商ID******************/ |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | // 盘点 ID |
| | | private static String eSetId = ''; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | //经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType {get;set;} |
| | | public static String sqlagencyProType; |
| | | //判断操作人员是否盘点 |
| | | public static Boolean iSinventory = false; |
| | | |
| | | public LexInventoryController(){ |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | done = false; |
| | | |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //codPageRecordsShow = new List<ConsumableorderdetailsInfo>(); |
| | | } |
| | | |
| | | private static void initStandardController(){ |
| | | // init standard controller |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name desc]; |
| | | setConDetails2 = showcod2; |
| | | System.debug('setConDetails2===>'+setConDetails2); |
| | | // setCon = new ApexPages.StandardSetController(showcod2); |
| | | // // sets the number of records in each page set |
| | | // setCon.setPageSize(size); |
| | | // noOfRecords = setCon.getResultSize(); |
| | | } |
| | | |
| | | public static List<Consumable_order_details2__c> cod2s() { |
| | | return setConDetails2; |
| | | } |
| | | //Changes the size of pagination |
| | | public static PageReference refreshPageSize() { |
| | | setCon.setPageSize(size); |
| | | //showcod2nid = cod2s(); |
| | | makepagerecords(); |
| | | return null; |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecords() { |
| | | showcod2nid = cod2s(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | System.debug('===>codPageRecords1'+codPageRecords); |
| | | return codPageRecords; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | setConDetails2 = new List<Consumable_order_details2__c>(); |
| | | String url = '在库调整一览'; |
| | | fileName = EncodingUtil.urlEncode(url, 'UTF-8'); |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | System.debug('pandiandetailsMap====>'+pandiandetailsMap); |
| | | initStandardController(); |
| | | makepagerecords(); |
| | | // sortKey = '1'; |
| | | // preSortKey = '1'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new String[1]; |
| | | // sortOrder = new String[]{' ',' ','↓'}; |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | //String userId = '00510000006k82X'; |
| | | //String userId = '00510000005QO75'; |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId]; |
| | | accountid = Useracc.Accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | Account accountInfo = [SELECT Name,Dealer_discount__c FROM account WHERE id =:accountid]; |
| | | accountName = accountInfo.Name; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,Product2__c> midMap = new Map<String,Product2__c>(); |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start |
| | | //开始制作表头数据 |
| | | // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | // SFDA_Status__c,Packing_list_manual__c, |
| | | // Asset_Model_No__c |
| | | // from Product2__c |
| | | // //where Estimation_Entry_Possibility__c = '○' |
| | | // where Product_Type__c like : sqlagencyProType |
| | | // ]; |
| | | // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | // } |
| | | //查询库存 追加返品库存 |
| | | List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName]; |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start |
| | | //开始制作表头数据 |
| | | Set<Id> Product2cIdSet = new Set<Id>(); |
| | | for(Consumable_order_details2__c con_or_d2item: ProductCount_Res){ |
| | | Product2cIdSet.add(con_or_d2item.Consumable_Product__c); |
| | | } |
| | | List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | SFDA_Status__c,Packing_list_manual__c, |
| | | Asset_Model_No__c |
| | | from Product2__c |
| | | //where Estimation_Entry_Possibility__c = '○' |
| | | where Id in:Product2cIdSet |
| | | and Product_Type__c like : sqlagencyProType |
| | | ]; |
| | | for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | } |
| | | system.debug('productCount_Unfull_bak'+productCount_Unfull_bak.size()); |
| | | // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size(); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro)); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy end |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size())); |
| | | for(Integer i = 0 ; i< ProductCount_Res.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '盒'){ |
| | | |
| | | if(newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone(); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c)); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | } |
| | | }else if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '个'){ |
| | | if(newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone(); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c)); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | //newMidPieceMap移除已经添加的Piece |
| | | newMidPieceMap.remove(bss.Prod.Id + '个'); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | } |
| | | //consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | listCut(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('accountName',accountName); |
| | | data.put('accountid',accountid); |
| | | |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static void listCut(){ |
| | | //拆分暂用list |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsInfo c = null; |
| | | ConsumableorderdetailsRecordsbreak.clear(); |
| | | ConsumableorderdetailsRecordsbreakover.clear(); |
| | | consumableorderdetailsRecordsview.clear(); |
| | | //选择产品view |
| | | ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>(); |
| | | if(consumableorderdetailsRecords.size() > 1000){ |
| | | for(Integer i = 0; i < consumableorderdetailsRecords.size(); i++){ |
| | | if(i < 1000){ |
| | | c = consumableorderdetailsRecords.get(i); |
| | | ConsumableorderdetailsRecordsbreak.add(c); |
| | | }else{ |
| | | c = consumableorderdetailsRecords.get(i); |
| | | ConsumableorderdetailsRecordsbreakover.add(c); |
| | | } |
| | | } |
| | | consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak); |
| | | consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover); |
| | | }else{ |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords); |
| | | } |
| | | } |
| | | //========20160311======ADD_Start================================ |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | //========20160311======ADD_Start================================ |
| | | public static List<String> ParseBarCode(String Code){ |
| | | Map<String,Integer> barcodeCountMap = new Map<String,Integer>(); |
| | | String[] Cache = new String[]{}; |
| | | Cache = Code.split('\n'); |
| | | List <String> Buff = new List<String>(); |
| | | for(String A : Cache){ |
| | | A = A.trim().toUpperCase(); |
| | | if(barcodeCountMap.containsKey(A)){ |
| | | barcodeCountMap.put(A,barcodeCountMap.get(A) + 1); |
| | | }else{ |
| | | barcodeCountMap.put(A,1); |
| | | } |
| | | Buff.add(A + barcodeCountMap.get(A)); |
| | | } |
| | | return Buff; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //test |
| | | |
| | | // @AuraEnabled |
| | | // public static ResponseBodyLWC searchConsumableorderdetails(String sqlagencyProType,String userWorkLocation,String accountName,String barcode,List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsLWC){ |
| | | // return new ResponseBodyLWC('Error',500, 'test', ''); |
| | | // } |
| | | //========20160311======ADD_End================================== |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){ |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC); |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | system.debug('=====>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | |
| | | |
| | | |
| | | |
| | | /* BarCodelist做成 */ |
| | | //FIXME barcodeSet 做成,ProductCount_ResSet 做成 |
| | | List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>(); |
| | | pandiandetailsListShow = new List<List<Consumable_order_details2__c>>(); |
| | | done = false; |
| | | List<String> BarCodeListP = ParseBarCode( barcode ); |
| | | //查询库存 追加返品库存 |
| | | List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName ]; |
| | | reFindProduct.clear(); |
| | | Map<String,ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | //barCodeListLoseMap.clear(); |
| | | Set<String> carCodeListLose = new Set<String>(); |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,String> proIdNotinpage = new Map<String,String>(); |
| | | List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> reFindProductaddtopage = new List<ConsumableorderdetailsInfo>(); |
| | | pandiandetailsMap.clear(); |
| | | reSet = new List<Consumable_order_details2__c>(); |
| | | /* 判断BarCode是否为空 */ |
| | | if (barcode == null || barcode == ''){ |
| | | //先取出所有丢失产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | // 20200509 gzw add 盘点数量初始化 |
| | | ass.Pandian = 0; |
| | | // 20200509 gzw add 盘点数量初始化 |
| | | if(ass.check==true){ |
| | | //ass.Diff = ass.countid - ass.Pandian; |
| | | for(integer i = 0 ; i < ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){ |
| | | continue; |
| | | }else{ |
| | | |
| | | //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i])); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已经出库的产品 |
| | | List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND (Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c in :carCodeListLose |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | needreturnMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | |
| | | // 经销商之间或者同一经销商不同工作地调货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c in :carCodeListLose |
| | | AND (Dealer_Info_text__c != :accountName |
| | | OR (Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | ) |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | carCodeListLose.clear(); |
| | | |
| | | |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check==true){ |
| | | ass.Diff = ass.countid - ass.Pandian; |
| | | for(integer i = 0 ; i < ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)){ |
| | | continue; |
| | | }else{ |
| | | if(needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品未返品')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品未返品'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | continue; |
| | | |
| | | } |
| | | if(otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | continue; |
| | | |
| | | } |
| | | if (ProductCount_Res[i].Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | ass.Diff--; |
| | | continue; |
| | | } |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | ass.Pandian = 0; |
| | | ass.Diff = 0; |
| | | } |
| | | } |
| | | List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>(); |
| | | if (pandiandetailsMap.keySet().size() > 0) { |
| | | showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | } |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | |
| | | iSinventory = true; |
| | | if(codPageRecords.size() > 0) done = true; |
| | | consumableorderdetailsRecordserrordummy.clear(); |
| | | |
| | | //pandiandetailsList = new list<Consumable_order_details2__c>(); |
| | | pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Lose_reason__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c codDet : pandiandetailsList){ |
| | | codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id); |
| | | } |
| | | List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 : pandiandetailsList){ |
| | | pandiandetailsListMid.add(cod2); |
| | | if(pandiandetailsListMid.size() == 1000){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | } |
| | | } |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | System.debug('codPageRecords===>'+codPageRecords); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | data.put('reSet1',reSet1); |
| | | System.debug('reSet1===>'+reSet1); |
| | | res.code = 200; |
| | | res.status = 'Success1'; |
| | | |
| | | return res; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //CHAN-B7J4NB 只有一个时,盘点不到 |
| | | //init(); |
| | | //CHAN-B7J4NB |
| | | Map<String,String> showproductIdMap = new Map<String,String>(); |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece); |
| | | } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP)); |
| | | /***************************************************************************/ |
| | | // BarCode的检索 所有在库 |
| | | reSet = [select Id,Consumable_Product__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Bar_Code_search__c,Isoverdue__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Date__c = null |
| | | and Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | order by Name]; |
| | | System.debug('reSet===>'+reSet); |
| | | Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | | // 20200509 add gzw 记录需要销存数量 |
| | | Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | | // 20200509 add gzw 记录需要销存数量 |
| | | Map<String,ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String,ConsumableorderdetailsInfo>(); // 明細バーコード 単位 |
| | | //盘点到的明细 |
| | | for(Consumable_order_details2__c rs : reSet){ |
| | | //BarCodeListPandian.add(rs.Bar_Code_search__c); |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | |
| | | barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs)); |
| | | if (rs.Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(rs.Id, '该产品已经过有效期,请销存。'); |
| | | if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) { |
| | | pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1); |
| | | } else { |
| | | pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1); |
| | | } |
| | | continue; |
| | | } |
| | | if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) { |
| | | pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1); |
| | | } else { |
| | | pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1); |
| | | } |
| | | } |
| | | |
| | | // 经销商之间或者同一经销商不同工作地调货 |
| | | List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE (Dealer_Arrive__c = TRUE |
| | | or Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code_search__c in :BarCodeListP |
| | | AND (Dealer_Info_text__c != :accountName |
| | | OR (Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | ) |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | // 需要入库的产品 |
| | | for(Consumable_order_details2__c cod2 : reSet1){ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | if(!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)){ |
| | | reFindProductList.add(cod2); |
| | | proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c); |
| | | } |
| | | if(!barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) |
| | | && otherAgProMap.containsKey(cod2.Bar_Code__c) |
| | | && (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true |
| | | || otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true) ){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'无此产品的库存,请入库。')); |
| | | pandiandetailsMap.put(cod2.Id, '无此产品的库存,请入库。'); |
| | | } |
| | | } |
| | | //寻回明细 |
| | | List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>(); |
| | | productAdjust = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Lose_reason__c, |
| | | Asset_Model_No__c,Box_Piece__c,Bar_Code_search__c,Isoverdue__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | and Bar_Code__c !=null |
| | | and Lose_Flag__c = true |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | order by Name]; |
| | | |
| | | |
| | | for (Consumable_order_details2__c rs : productAdjust){ |
| | | // 过期库存销存 20200427 gzw add srart |
| | | if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '过期库存销存' ) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'过期或者销存产品,无法寻回入库')); |
| | | pandiandetailsMap.put(rs.Id, '过期或者销存产品,无法寻回入库'); |
| | | carCodeListLose.add(rs.Bar_Code_search__c); |
| | | continue; |
| | | } |
| | | // 过期库存销存 20200427 gzw add end |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | if(!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)){ |
| | | reFindProductList.add(rs); |
| | | proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c); |
| | | } |
| | | if(barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)){ |
| | | continue; |
| | | }else{ |
| | | barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs)); |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'寻回')); |
| | | pandiandetailsMap.put(rs.Id, '寻回'); |
| | | consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs)); |
| | | } |
| | | } |
| | | if(reFindProductList.size() > 0){ |
| | | Map<String,Product2__c> midMap = new Map<String,Product2__c>(); |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | List<Product2__c> product_Refind = [select Id, Name,Name__c,SFDA_Status__c,Packing_list_manual__c,Asset_Model_No__c |
| | | from Product2__c |
| | | WHERE Id in :proIdNotinpage.keySet()]; |
| | | for(Product2__c pro : product_Refind){ |
| | | midMap.put(pro.Id, pro); |
| | | } |
| | | for(Integer i = 0 ; i< reFindProductList.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '盒'){ |
| | | |
| | | if(newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c).clone(); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c)); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | } |
| | | }else if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '个'){ |
| | | if(newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(reFindProductList[i].Consumable_product__c+reFindProductList[i].Box_Piece__c).clone(); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c)); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | bss.check = true; |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | bss.check = true; |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | //newMidPieceMap移除已经添加的Piece |
| | | newMidPieceMap.remove(bss.Prod.Id + '个'); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | } |
| | | } |
| | | |
| | | //先取出未盘点到的产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | for(integer i = 0 ; i<ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null){ |
| | | continue; |
| | | }else{ |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code__c); |
| | | ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i])); |
| | | //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //已经出库的产品 |
| | | List<Consumable_order_details2__c> reSet2 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND (Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet2){ |
| | | needreturnMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | //// 经销商之间或者同一经销商不同工作地调货 |
| | | //List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | // Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c, |
| | | // Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c, |
| | | // Bar_Code_search__c,Dealer_Info_text__c |
| | | // FROM Consumable_order_details2__c |
| | | // WHERE (Dealer_Arrive__c = TRUE |
| | | // or Dealer_Shipment__c= TRUE |
| | | // or Dealer_Saled__c = TRUE) |
| | | // AND Dealer_Returned__c = FALSE |
| | | // AND Cancellation_Flag__c = FALSE |
| | | // AND Bar_Code_search__c in :BarCodeListP |
| | | // AND (Dealer_Info_text__c != :accountName |
| | | // OR (Dealer_Info_text__c = :accountName |
| | | // AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | // ) |
| | | // ORDER BY Name ]; |
| | | //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | //for(Consumable_order_details2__c cod2 :reSet1){ |
| | | // otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | //} |
| | | carCodeListLose.clear(); |
| | | //未盘点到的产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | for(integer i = 0 ; i<ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)){ |
| | | continue; |
| | | } |
| | | if (ProductCount_Res[i].Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。'); |
| | | if (pandianoverdueCountMap.containsKey(ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c) == false) { |
| | | pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1); |
| | | } else { |
| | | pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, pandianoverdueCountMap.get(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c) + 1); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | } |
| | | } |
| | | // 同时存在其他经销商库存产品 |
| | | for(Consumable_order_details2__c cod2 : reSet1){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){ |
| | | if(barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) |
| | | && otherAgProMap.containsKey(cod2.Bar_Code__c) |
| | | && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false |
| | | && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false ){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。')); |
| | | pandiandetailsMap.put(cod2.Id, '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | // 需要返品的产品 |
| | | for(Consumable_order_details2__c cod2 : reSet2){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){ |
| | | if(needreturnMap.containsKey(cod2.Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品目前出库状态,请返品。')); |
| | | pandiandetailsMap.put(cod2.Id, '该产品目前出库状态,请返品。'); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //更新主明细单 |
| | | if(barCodeListPandianMap.size() > 0){ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | integer countSum = 0; |
| | | if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | integer overdueSum = 0; |
| | | if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | ass.Pandian = countSum; |
| | | ass.Diff = ass.countid - countSum - overdueSum; |
| | | ass.refind = 0; |
| | | } |
| | | } |
| | | }else{ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | integer overdueSum = 0; |
| | | if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | ass.Diff = ass.countid - ass.Pandian - overdueSum; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //寻回做成 |
| | | for(ConsumableorderdetailsInfo ass :consumableorderdetailsRecords){ |
| | | for(ConsumableorderdetailsInfo adjust :consumableorderdetailsRecordsAdjust){ |
| | | if(ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c){ |
| | | if(reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)){ |
| | | continue; |
| | | }else { |
| | | ass.Pandian ++; |
| | | ass.refind ++; |
| | | reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c,adjust.orderdetails2.Bar_Code_search__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (pandiandetailsMap.keySet().size() > 0) { |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | } |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | if(codPageRecords.size() > 0) done = true; |
| | | iSinventory = true; |
| | | consumableorderdetailsRecordserrordummy.clear(); |
| | | pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Lose_reason__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c codDet : pandiandetailsList){ |
| | | codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id); |
| | | } |
| | | List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 : pandiandetailsList){ |
| | | pandiandetailsListMid.add(cod2); |
| | | if(pandiandetailsListMid.size() == 1000){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | } |
| | | } |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | |
| | | System.debug('=====>codPageRecords2'+codPageRecords); |
| | | System.debug('=====>consumableorderdetailsRecords'+consumableorderdetailsRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | data.put('reSet',reSet); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | System.debug('=====>consumableorderdetailsRecordsview'+consumableorderdetailsRecordsview); |
| | | res.code = 200; |
| | | res.status = 'Sucess'; |
| | | return res; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) { |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | agencyProType = agencyProType; |
| | | accountid =accountid; |
| | | pandiandetailsMap = pandiandetailsMap; |
| | | reSet =reSet; |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | // return null; |
| | | } |
| | | integer Lo = 0; |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | Lo++; |
| | | } |
| | | } |
| | | if(Lo == 0){ |
| | | iSinventory = false; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要盘点的明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error',500, '请选择要盘点的明细', ''); |
| | | } |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + ' '+header.prod.Name__c)); |
| | | //return null; |
| | | if((header.DiffReason == ''||header.DiffReason ==null)&&header.Diff>0){ |
| | | return new ResponseBodyLWC('Error',500, header.prod.Name__c + '请输入差异原因', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '请输入差异原因')); |
| | | // return null; |
| | | }else if ((header.DiffReason != ''&&header.DiffReason !=null)&&header.Diff==0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无丢失产品,不需要填写差异原因')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error',500, header.prod.Name__c + '无丢失产品,不需要填写差异原因', ''); |
| | | } |
| | | } |
| | | } |
| | | Integer orderDetNo = 1; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Consumable_order__c Po = new Consumable_order__c(); |
| | | Po.Name ='*'; |
| | | Po.Order_status__c = '批准'; |
| | | Po.Inventory_date__c = Date.today(); |
| | | Po.Order_type__c = '盘点'; |
| | | Po.Dealer_Info__c = accountid; |
| | | Po.Order_ProType__c = agencyProType; |
| | | Po.RecordTypeid = System.Label.RT_ConOrder_Inventory; |
| | | try{ |
| | | insert Po; |
| | | eSetId = Po.id; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:Po.id]; |
| | | List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>(); |
| | | List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> updListAdjust = New List<Consumable_order_details2__c>(); |
| | | Map<String,String> ErrorName = new Map<String,String>(); |
| | | Map<String,Boolean> CheckTF = new Map<String,Boolean>(); |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | Consumable_orderdetails__c insPan = new Consumable_orderdetails__c(); |
| | | insPan = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(orderDetNo); |
| | | if(str.length() == 1){ |
| | | str = '0' + str; |
| | | } |
| | | insPan.Name = Consumable_order[0].Name + '-'+ str; |
| | | insPan.Consumable_Product__c = header.ProdId; |
| | | ErrorName.put(insPan.Consumable_Product__c,header.DiffReason); |
| | | CheckTF.put(insPan.Consumable_product__c,true); |
| | | insPan.Consumable_order__c = Po.Id; |
| | | insPan.Lose_reason__c = header.DiffReason; |
| | | insPan.Diff__c = header.Diff; |
| | | insPan.Product_Refind__c = header.refind; |
| | | insPan.inventory_sum__c = header.Pandian; |
| | | insPan.Count_Sum__c = header.countid; |
| | | insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory; |
| | | orderDetNo ++; |
| | | InsList.add(insPan); |
| | | } |
| | | } |
| | | if(InsList.size()>0){ |
| | | insert InsList; |
| | | } |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c cod : showcod2){ |
| | | Consumable_order_details2__c InsDetail = new Consumable_order_details2__c(); |
| | | InsDetail.Id =cod.Id; |
| | | InsDetail.Consumable_Inventory_order__c = po.Id; |
| | | InsDetail.Inventory_date__c = Date.today(); |
| | | // 20210224 gzw CHAN-BXF3PG start |
| | | // if(pandiandetailsMap.get(cod.Id) == '丢失' ){ |
| | | if(pandiandetailsMap.get(cod.Id) == '丢失' && CheckTF.containsKey(cod.Consumable_product__c)){ |
| | | // 20210224 gzw CHAN-BXF3PG end |
| | | InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c); |
| | | InsDetail.Lose_Flag__c = true; |
| | | }else if(pandiandetailsMap.get(cod.Id) == '寻回' ){ |
| | | InsDetail.Lose_reason__c = ''; |
| | | InsDetail.Lose_Flag__c = false; |
| | | }else{ |
| | | continue; |
| | | } |
| | | InsListUp.add(InsDetail); |
| | | } |
| | | for(Consumable_order_details2__c rs : reSet){ |
| | | rs.Inventory_date__c = Date.today(); |
| | | } |
| | | if(reSet.size() > 0){ |
| | | update reSet; |
| | | } |
| | | if(InsListUp.size()>0){ |
| | | ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407 |
| | | } |
| | | |
| | | }catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(ex); |
| | | return new ResponseBodyLWC('Error',500, e.getMessage()+e.getLineNumber(), ''); |
| | | // return null; |
| | | } |
| | | // FIXME impliment BarCodeListAdjust |
| | | /************************************************************************************************/ |
| | | // return ProS(); |
| | | data.put('eSetId',eSetId); |
| | | data.put('InsListUp',InsListUp); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //盘点一览 |
| | | public PageReference ProS() { |
| | | // 返回盘点一览 |
| | | PageReference ref = new Pagereference('/apex/InventoryList?eSetId=' + eSetId); |
| | | ref.setRedirect(true); |
| | | return ref; |
| | | } |
| | | //CSV出力 |
| | | public PageReference doClick() { |
| | | Pagereference pr = page.InventoryCSV; |
| | | return pr; |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal countid { get; set; } |
| | | @AuraEnabled |
| | | public String ProdId{get;set;} |
| | | @AuraEnabled |
| | | public Decimal Pandian { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Diff { get; set; } |
| | | @AuraEnabled |
| | | public Decimal refind { get; set; } |
| | | @AuraEnabled |
| | | public String DiffReason { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public String boxPiece { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { |
| | | |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | //e.Lose_reason__c = str; |
| | | DiffReason = str; |
| | | } |
| | | |
| | | // 已存在消耗品明细用 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | check = false; |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | canSelect = true; |
| | | } |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | //orderdetails1 = new Consumable_orderdetails__c(); |
| | | Prod = e; |
| | | canSelect = true; |
| | | ProdId = string.valueOf(e.id); |
| | | countid =0; |
| | | Pandian = 0; |
| | | refind = 0; |
| | | Diff = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo; |
| | | Integer returnValue = 0; |
| | | if (countid > compareToesd.countid ) { |
| | | returnValue = -1; |
| | | } else if (countid < compareToesd.countid ) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexInventoryListController { |
| | | /*****************検索用******************/ |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String baseUrl {get;private set;} |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError { get; set; } |
| | | // 盘点明细1 |
| | | private static List<Consumable_orderdetails__c> consumableorderdetails1 = new List<Consumable_orderdetails__c>(); |
| | | // 盘点明细2 |
| | | private static List<Consumable_order_details2__c> consumableorderdetailsSelected = new List<Consumable_order_details2__c>(); |
| | | |
| | | // 盘点单号 ID |
| | | private static String ESetId = ''; |
| | | public LexInventoryListController() { |
| | | //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8'); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | ESetId = ApexPages.currentPage().getParameters().get('esetId'); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>(); |
| | | } |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String eSetId) { |
| | | system.debug('eSetId====>'+eSetId); |
| | | ESetId = eSetId; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order__c> qs = New List<Consumable_order__c>(); |
| | | qs = [select Name,Inventory_date__c,Order_date__c From Consumable_order__c Where Id =:ESetId]; |
| | | System.debug('qs===>'+qs); |
| | | if (qs.size()>0){ |
| | | coc = qs[0]; |
| | | } |
| | | // 選択済みの明细を取得 |
| | | consumableorderdetailsSelected = [ |
| | | select Id, Name, Consumable_Product__c, |
| | | Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c,Bar_Code__c, |
| | | Consumable_Product__r.Asset_Model_No__c,Lose_Flag__c, |
| | | recordtypeid,Lose_reason__c |
| | | from Consumable_order_details2__c |
| | | where Consumable_Inventory_order__c = :ESetId |
| | | order by Name ]; |
| | | System.debug('consumableorderdetailsSelected==>'+consumableorderdetailsSelected); |
| | | |
| | | for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) { |
| | | consumableorderdetailsRecordsError.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i])); |
| | | } |
| | | consumableorderdetails1 = [ |
| | | select Id, Name,Diff__c,inventory_sum__c, |
| | | Count_Sum__c,Consumable_order__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name,Consumable_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c,Consumable_Product__r.Name__c, |
| | | Sum_of_money__c,recordtypeid,Lose_reason__c,Product_Refind__c |
| | | from Consumable_orderdetails__c |
| | | where Consumable_order__c = :ESetId |
| | | order by Name ]; |
| | | for (Integer i = 0; i < consumableorderdetails1.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i])); |
| | | } |
| | | data.put('qs',qs); |
| | | System.debug('consumableorderdetailsRecords====>'+consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError)); |
| | | // if(ConsumableorderdetailsRecordsError.size()!=null){ |
| | | // data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError)); |
| | | // } |
| | | System.debug('ConsumableorderdetailsRecordsError====>'+ConsumableorderdetailsRecordsError); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | public Product2__c Prod { get; set; } |
| | | // 明细1 |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 明细2 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexInventoryViewController { |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | // public static Integer pagecount { get; set; } |
| | | // public static Integer currentpage { get; set; } |
| | | // public static Boolean hasPrevious { get; set; } |
| | | // public static Boolean hasNext { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> pageRecords { get; set; } |
| | | public static String soql { get; set; } |
| | | |
| | | // public static String sortKey { get; set; } |
| | | // public static String preSortKey { get; private set; } |
| | | // public static Boolean sortOrderAsc { get; private set; } |
| | | // public static String[] sortOrder { get; private set; } |
| | | // private static String[] columus = new List<String>{ |
| | | // 'Product2__c.Name__c', |
| | | // 'Asset_Model_No__c', |
| | | // '', |
| | | // 'Category3__c', |
| | | // 'Category4__c', |
| | | // 'Category5__c', |
| | | // '' |
| | | // }; |
| | | |
| | | public static String[] proLimitAndDate = new List<String>{}; |
| | | private static Map<String, Date> productkucun = new Map<String, Date>(); |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> categoryOptionMap { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category4OptionMap { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category5OptionMap { get; set; } |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static String category_Goods { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static Boolean editAble { get; set; } |
| | | // 经销商在库产品ID |
| | | public static List<String> orderDetZaikuList = new List<String>(); |
| | | // 产品 ID |
| | | public static String ESetId { get; set; } |
| | | public static String idCheck { get; set; } |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | private static String accountid = null; |
| | | public static String accountName { get; set; } |
| | | // 查看产品 |
| | | // private String[] ProidListAll = new String[]{}; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType { get; set; } |
| | | public static String sqlagencyProType; |
| | | |
| | | // add by rentx 2021-3-10 |
| | | public static Boolean hasHos { get; set; } |
| | | // add by rentx 2021-3-10 |
| | | |
| | | public LexInventoryViewController() { |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | editAble = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | // page |
| | | // pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // currentpage = 0; |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC) { |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | |
| | | // 取用户ID |
| | | String userId = UserInfo.getUserId(); |
| | | User useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | accountid = useracc.accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Account accountInfo = [SELECT Name, Dealer_discount__c, Product_Limit_Date__c FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.Name; |
| | | // 经销商查看产品 |
| | | String product_Limit = accountInfo.Product_Limit_Date__c; |
| | | |
| | | if (product_Limit != null && product_Limit != '') { |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, Product2__c> MidMap = new Map<String, Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // 库存明细取得 |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | orderDetZaikuList = new List<String>(); |
| | | System.debug('sqlagencyProType = ' + sqlagencyProType); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | List<AggregateResult> orderDetZaiku = [ |
| | | SELECT count(Id), Consumable_Product__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | GROUP BY Consumable_Product__c |
| | | ]; |
| | | |
| | | for (AggregateResult zaikuId : orderDetZaiku) { |
| | | orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c'))); |
| | | } |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ]; |
| | | System.debug('MidMap = ' + MidMap); |
| | | System.debug('CountDel111 = ' + CountDel); |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | List<Product2__c> product2Selected = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Name__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Category3__c, |
| | | Category4__c, |
| | | Category5__c, |
| | | SFDA_Status__c, |
| | | Product2__r.SFDA_Approbation_No__c, |
| | | Product2__r.SFDA_Expiration_Date__c, |
| | | Product2__r.Packing_list_manual__c |
| | | FROM Product2__c |
| | | WHERE Id IN :orderDetZaikuList |
| | | ]; |
| | | System.debug('product2Selected = ' + product2Selected); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, product2Selected[i]); |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | /////////////////////====================================update by rentx |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // update by rentx 2021-01-27 start |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | // 然后循环CountDel做Box和piece2个map |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | // 把Boxmap里的值从新赋给boxRecords |
| | | System.debug('newMidBoxMap = ' + newMidBoxMap); |
| | | for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.sortBy = false; |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | |
| | | boxRecords.sort(); |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : boxRecords) { |
| | | consumableorderdetailsRecords.add(bss); |
| | | // 该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id + '个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个A'); |
| | | // } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | Integer hosnum = 0; |
| | | // add by rentx 2021-3-10 end |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if (productkucun.get(bss.Prod.Id) != null) { |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | if (bss.hospitalSpecialOffer) { |
| | | hosnum = hosnum + 1; |
| | | } |
| | | } |
| | | if (hosnum > 0) { |
| | | hasHos = true; |
| | | } else { |
| | | hasHos = false; |
| | | } |
| | | // add by rentx 2021-3-10 end |
| | | // listCut(); |
| | | |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | |
| | | categoryOptionList = new List<SelectOption>(); |
| | | categoryOptionList.add(new SelectOption('', '-无-')); |
| | | categoryOptionMap.put('', '-无-'); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | categoryOptionMap.put(deliverycnt, deliverycnt); |
| | | } |
| | | |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap.put('', '-无-'); |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap.put('', '-无-'); |
| | | System.debug('categoryOptionList===>' + category4OptionList); |
| | | System.debug('category4OptionList===>' + category4OptionList); |
| | | System.debug('category5OptionList===>' + category4OptionList); |
| | | |
| | | //// 总件数 |
| | | totalcount = consumableorderdetailsRecords.size(); |
| | | //// 页数 |
| | | // pagecount = (totalcount + pagesize - 1) / pagesize; |
| | | |
| | | //// 显示第一页 |
| | | |
| | | // moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | // data.put('categoryOptionList',categoryOptionList); |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | |
| | | data.put('categoryOptionMap', categoryOptionMap); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('orderDetZaikuList', orderDetZaikuList); |
| | | data.put('accountid', accountid); |
| | | data.put('accountName', accountName); |
| | | data.put('sqlagencyProType', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('pageRecords', pageRecords); |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('hasHos', hasHos); |
| | | data.put('productLimtAndDate',proLimitAndDate); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryAllload(String category3LWC,String agencyProTypeLWC) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | category3 = category3LWC; |
| | | agencyProType = '%' + agencyProTypeLWC + '%'; |
| | | |
| | | System.debug('category3LWC===>'+category3LWC); |
| | | System.debug('agencyProType===>'+agencyProType); |
| | | |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | System.debug('类别4'+category4OptionList); |
| | | System.debug('类别5'+category5OptionList); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void categoryload() { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c = :category4 |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | } |
| | | // 检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String category1, |
| | | String Category3, |
| | | String Category4, |
| | | String Category5, |
| | | List<String> orderDetZaikuListLWC, |
| | | String accountName, |
| | | string agencyProType, |
| | | string userWorkLocation, |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC, |
| | | String sortFieldLWC, |
| | | String sortOrderLWC |
| | | ) { |
| | | try { |
| | | System.debug('orderDetZaikuListLWC===>'+orderDetZaikuListLWC); |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | orderDetZaikuList = new List<String>(); |
| | | |
| | | orderDetZaikuList = orderDetZaikuListLWC; |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | System.debug('====>accountName' + accountName); |
| | | System.debug('====>sqlagencyProType' + sqlagencyProType); |
| | | System.debug('====>userWorkLocation' + userWorkLocation); |
| | | System.debug('====>category1' + category1); |
| | | System.debug('====>Category3' + Category3); |
| | | System.debug('====>Category4' + Category4); |
| | | System.debug('====>Category5' + Category5); |
| | | // sortKey = '2'; |
| | | // preSortKey = '2'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '↓' }; |
| | | |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ]; |
| | | System.debug('CountDel = ' + CountDel); |
| | | |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, Product2__c> MidMap = new Map<String, Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | |
| | | // 所有产品取得 |
| | | String soql = makeSoql(category1, category_Goods, category3, category4, category5); |
| | | //orderDetZaikuList |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('soql====>' + soql); |
| | | //排序 |
| | | // if (String.isNotBlank(sortField) && String.isNotBlank(sortOrder)) { |
| | | // if(sortFieldLWC != 'limitCount'){ |
| | | // soql += ' ORDER BY ' + sortField + ' ' + sortOrder; |
| | | |
| | | // } |
| | | // } |
| | | System.debug('soql = ' + soql); |
| | | //soql += ' ORDER BY ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | List<Product2__c> queryList = Database.query(soql); |
| | | System.debug('queryList = ' + queryList); |
| | | |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | MidMap.put(queryList[i].Id, queryList[i]); |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | System.debug('CountDel = ' + CountDel); |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | //然后循环CountDel做Box和piece2个map |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('newMidBoxMap = ' + newMidBoxMap); |
| | | //把Boxmap里的值从新赋给boxRecords |
| | | for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.sortBy = false; |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | |
| | | boxRecords.sort(); |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | System.debug('boxRecords = ' + boxRecords); |
| | | for (ConsumableorderdetailsInfo bss : boxRecords) { |
| | | consumableorderdetailsRecords.add(bss); |
| | | //该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id + '个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个A'); |
| | | // } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | System.debug('consumableorderdetailsRecords zzz = ' + consumableorderdetailsRecords); |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if (productkucun.get(bss.Prod.Id) != null) { |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | } |
| | | //listCut(); |
| | | |
| | | // sortKey = '2'; |
| | | // preSortKey = '2'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '↓' }; |
| | | |
| | | // //总件数 |
| | | totalcount = consumableorderdetailsRecords.size(); |
| | | // //页数 |
| | | // pagecount=(totalcount + pagesize - 1) / pagesize; |
| | | |
| | | //显示第一页 |
| | | //currentpage = 0; |
| | | //moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | List<ConsumableorderdetailsInfo> pageRecordsCompare = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('queryList = ' + JSON.serialize(queryList)); |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | for(ConsumableorderdetailsInfo ci : pageRecords){ |
| | | if(queryList[i].Id == ci.Prod.Id){ |
| | | System.debug('queryList[i].Id =' + queryList[i].Id); |
| | | System.debug('ci.Prod.Id =' + queryList[i].Id); |
| | | pageRecordsCompare.add(ci); |
| | | } |
| | | } |
| | | } |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('pageRecords', pageRecordsCompare); |
| | | data.put('hasHos', hasHos); |
| | | system.debug('===========>pageRecords' + pageRecordsCompare); |
| | | system.debug('===========>data' + data); |
| | | if (pageRecords.isEmpty()) { |
| | | res.msg = '未搜索到相关消耗品订单!'; |
| | | res.status = 'fail'; |
| | | res.code = 500; |
| | | } else { |
| | | res.status = 'Success'; |
| | | res.msg = '共有' + pageRecords.size() + '条数据'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | } |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getStackTraceString(), ''); |
| | | } |
| | | } |
| | | |
| | | public static void productLimtAndDate() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void datelimitSearch() { |
| | | List<String> barcodekucun = new List<String>(); |
| | | List<Consumable_order_details2__c> orderkucun = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Recordtypeid, Guarantee_period_for_products__c, Sterilization_limit__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Consumable_Product__c, Sterilization_limit__c ASC |
| | | ]; |
| | | for (Integer i = 0; i < orderkucun.size(); i++) { |
| | | if (productkucun.containsKey(orderkucun[i].Consumable_Product__c)) { |
| | | continue; |
| | | } else { |
| | | productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //名称排序 |
| | | // public static void SortLimited() { |
| | | // Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // Map<String, ConsumableorderdetailsInfo> newMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // if (sortKey == preSortKey) { |
| | | // // 方向が変わるのみ |
| | | // sortOrderAsc = !sortOrderAsc; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } else { |
| | | // sortOrderAsc = true; |
| | | // sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } |
| | | |
| | | // preSortKey = sortKey; |
| | | // // 所有产品取得 |
| | | // String soql = makeSoql(null, null, null, null, null); |
| | | // soql += ' ORDER BY ' + columus[Integer.valueOf(sortKey)] + ' ' + (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | // List<Product2__c> queryList = Database.query(soql); |
| | | // for (Integer i = 0; i < queryList.size(); i++) { |
| | | // MidMap.put(queryList[i].Id + '盒', null); |
| | | // MidMap.put(queryList[i].Id + '个', null); |
| | | // } |
| | | |
| | | // //update by rentx 2020-12-29 |
| | | // for (Integer i = 0; i < pageRecords.size(); i++) { |
| | | // if (MidMap.containsKey(pageRecords[i].prod.Id + pageRecords[i].BoxPiece)) { |
| | | // ConsumableorderdetailsInfo Jstage = pageRecords[i].clone(); |
| | | // if (Jstage.hospitalSpecialOffer == true) { |
| | | // newMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage); |
| | | // } else { |
| | | // MidMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | // //update byr entx 2020-12-29 |
| | | // //再把map里的值从新赋给CpageRecords |
| | | // for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | // if (bss != null) { |
| | | // pageRecords.add(bss); |
| | | // if (newMap.get(bss.Prod.Id + bss.BoxPiece) != null) { |
| | | // pageRecords.add(newMap.get(bss.Prod.Id + bss.BoxPiece)); |
| | | // newMap.remove(bss.Prod.Id + bss.BoxPiece); |
| | | // } |
| | | // } |
| | | // } |
| | | // for (ConsumableorderdetailsInfo bss : newMap.values()) { |
| | | // if (bss != null) { |
| | | // pageRecords.add(bss); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //库存排序 |
| | | // public static void SortStore() { |
| | | // if (sortKey == preSortKey) { |
| | | // // 方向が変わるのみ |
| | | // sortOrder = !sortOrder; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } else { |
| | | // sortOrderAsc = true; |
| | | // sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } |
| | | // preSortKey = sortKey; |
| | | |
| | | // for (ConsumableorderdetailsInfo ass : pageRecords) { |
| | | // ass.sortBy = sortOrderAsc; |
| | | // } |
| | | // pageRecords.sort(); |
| | | // } |
| | | |
| | | |
| | | //检索sql文做成 |
| | | private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) { |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderDetZaikuList.size(); i++) { |
| | | if (i < orderDetZaikuList.size() - 1) { |
| | | sqlTail += orderDetZaikuList[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderDetZaikuList[i] + '\')'; |
| | | } |
| | | } |
| | | String soql = 'select Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Category3__c,Category4__c,Category5__c,'; |
| | | soql += ' SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c FROM Product2__c '; |
| | | soql += ' WHERE Id in' + sqlTail; |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | return soql; |
| | | } |
| | | //首页 |
| | | // public static void moveToFirst() { |
| | | // if (currentpage == 1) |
| | | // return; |
| | | // currentpage = 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //尾页 |
| | | // public static void moveToLast() { |
| | | // if (currentpage >= pagecount) |
| | | // return; |
| | | // currentpage = pagecount; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //上一页 |
| | | // public static void moveToPrevious() { |
| | | // if (currentpage == 1) |
| | | // return; |
| | | // currentpage = currentpage - 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //下一页 |
| | | // public static void moveToNext() { |
| | | // if (currentpage >= pagecount) |
| | | // return; |
| | | |
| | | // currentpage = currentpage + 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //判断是否可翻页 |
| | | // public static void canMove() { |
| | | // hasPrevious = false; |
| | | // hasNext = false; |
| | | // if (pagecount > 1 && currentpage > 1) |
| | | // hasPrevious = true; |
| | | // if (pagecount > 1 && currentpage < pagecount) |
| | | // hasNext = true; |
| | | // } |
| | | |
| | | //刷新当前页 |
| | | // public static PageReference refreshPageSize() { |
| | | // makeCurrentPageRecords(); |
| | | // return null; |
| | | // } |
| | | |
| | | //编辑当前页内容 |
| | | public static void makeCurrentPageRecords() { |
| | | // pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | // System.debug('consumableorderdetailsRecords =' + consumableorderdetailsRecords); |
| | | // for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) { |
| | | // pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | // } |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | if (endIdx > consumableorderdetailsRecords.size()) { |
| | | endIdx = consumableorderdetailsRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | } |
| | | } |
| | | |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order__c Concc { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Date guaranteeperiod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | esd = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | allnumber = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexLicenceReminderController { |
| | | |
| | | @AuraEnabled |
| | | public static Results initReminder(){ |
| | | Results results = new Results(); |
| | | try { |
| | | User useracc = [SELECT AccountId, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | String accountId = useracc.AccountId; |
| | | List<Account> accList = [SELECT Name,Medical_Equipment_Expiration_Date__c FROM Account WHERE Id =:accountId]; |
| | | Account accountInfo = new Account(); |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.isShowReminder = false; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | if(accountInfo.Medical_Equipment_Expiration_Date__c != null){ |
| | | Integer days = LexUtility.getLicenceReminderDays(); |
| | | Date today = Date.today(); |
| | | // Date today = Date.newInstance(2024, 7, 21); |
| | | Integer numberDaysDue = today.daysBetween(accountInfo.Medical_Equipment_Expiration_Date__c); |
| | | if(numberDaysDue > days){ |
| | | results.isShowReminder = false; |
| | | }else{ |
| | | results.isShowReminder = true; |
| | | results.days = numberDaysDue; |
| | | } |
| | | results.result = 'Success'; |
| | | }else { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到医疗器械经营企业许可证有效期限'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.isShowReminder = false; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public Boolean isShowReminder; |
| | | @AuraEnabled |
| | | public Integer days; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexOutboundorderImportController { |
| | | //经销商产品分类 |
| | | public static String agencyProType { get; set; } |
| | | private static String sqlagencyProType; |
| | | public static Blob csvFileBody { get; set; } |
| | | public static string csvAsString { get; set; } |
| | | public static String[] csvFileLines { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> orderRecords { get; set; } |
| | | public static List<String[]> csvRecordStr { get; set; } |
| | | public static Map<String, String> hospitalconMap { get; set; } |
| | | public static Map<String, String> product2conMap { get; set; } |
| | | public static Map<String, String> hospitalSysMap { get; set; } |
| | | public static Map<String, String> secondAgencyMap { get; set; } |
| | | private static String accountid { get; set; } |
| | | private static String accountName { get; set; } |
| | | private static Integer messageCount; |
| | | public static boolean saveFLGbln { get; set; } |
| | | private static List<String> barcodeList { get; set; } |
| | | private static List<String> barcodePieceList { get; set; } |
| | | public static Map<String, Integer> barcodePieceMap { get; set; } |
| | | public static boolean errorflg { get; set; } |
| | | public static String errorMessage { get; set; } |
| | | private static String userWorkLocation { get; set; } |
| | | public static String errorMsg { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | messageCount = 0; |
| | | errorflg = false; |
| | | errorMessage = null; |
| | | User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountid = Useracc.accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.name; |
| | | |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('accountName', accountName); |
| | | data.put('sqlagencyProType', sqlagencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC importCSVFile( |
| | | String base64DataLwc, |
| | | String sqlagencyProTypeLwc, |
| | | String userWorkLocationLwc, |
| | | String accountNameLwc |
| | | ) { |
| | | System.debug('enter importCSVFile'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | errorMsg = ''; |
| | | sqlagencyProType = sqlagencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | accountName = accountNameLwc; |
| | | String base64Data = EncodingUtil.urlDecode(base64DataLwc, 'UTF-8'); |
| | | csvFileBody = EncodingUtil.base64Decode(base64Data); |
| | | product2conMap = new Map<String, String>(); |
| | | |
| | | messageCount = 0; |
| | | errormessage = null; |
| | | saveFLGbln = false; |
| | | csvRecordStr = new List<String[]>(); |
| | | barcodeList = new List<String>(); |
| | | barcodePieceMap = new Map<String, Integer>(); |
| | | barcodePieceList = new List<String>(); |
| | | orderRecords = new List<ConsumableorderdetailsInfo>(); |
| | | hospitalconMap = new Map<String, String>(); |
| | | if (csvFileBody == null) { |
| | | errorflg = true; |
| | | saveFLGbln = true; |
| | | // errormessage = '读取内容为空。'; |
| | | return new ResponseBodyLWC('Error', 500, '读取内容为空。', ''); |
| | | } else { |
| | | //产品数据查找 |
| | | map<string, string> orderNameMap = new Map<string, string>(); |
| | | try { |
| | | csvAsString = csvFileBody.toString(); |
| | | csvFileLines = csvAsString.split('\n'); |
| | | for (Integer i = 0; i < csvFileLines.size(); i++) { |
| | | string[] csvRecordData = csvFileLines[i].split(','); |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | if (String.valueOf(csvRecordData[9]) == '个') { |
| | | barcodePieceList.add(csvRecordData[6]); |
| | | barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7])); |
| | | } |
| | | } |
| | | String[] csvRecordDataStr = new List<String>(13); |
| | | for (Integer j = 0; j < csvRecordData.size(); j++) { |
| | | csvRecordDataStr[j] = csvRecordData[j]; |
| | | } |
| | | if (i == 0) { |
| | | csvRecordDataStr[12] = '产品'; |
| | | } else { |
| | | csvRecordDataStr[12] = ''; |
| | | } |
| | | csvRecordStr.add(csvRecordDataStr); |
| | | } |
| | | Map<String, String> productBarcodeMap = new Map<String, String>(); |
| | | List<Consumable_order_details2__c> cOrderDet = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodeList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Consumable_order_details2__c pdinfo : cOrderDet) { |
| | | productBarcodeMap.put(pdinfo.Bar_Code__c, pdinfo.Consumable_Product__c); |
| | | } |
| | | for (String[] csvlistStr : csvRecordStr) { |
| | | if (productBarcodeMap.containsKey(csvlistStr[6])) { |
| | | csvlistStr[12] = productBarcodeMap.get(csvlistStr[6]); |
| | | } else { |
| | | } |
| | | } |
| | | //检索存在拆盒产品数量 |
| | | Map<String, Integer> exitpieceBarcodeMap = new Map<String, Integer>(); |
| | | AggregateResult[] pieceOrderDet = [ |
| | | SELECT count(Id) cnt, Bar_Code__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodePieceList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | GROUP BY Bar_Code__c |
| | | ]; |
| | | for (AggregateResult ar : pieceOrderDet) { |
| | | exitpieceBarcodeMap.put(String.valueOf(ar.get('Bar_Code__c')), Integer.valueOf(ar.get('cnt'))); |
| | | } |
| | | for (String bc : barcodePieceList) { |
| | | if (!exitpieceBarcodeMap.containsKey(bc)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 不存在或单位错误,请确认。') |
| | | // ); |
| | | errorMsg += 'Barcode ' + bc + ' 不存在或单位错误,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (exitpieceBarcodeMap.containsKey(bc) && exitpieceBarcodeMap.get(bc) < barcodePieceMap.get(bc)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 库存不足,请确认。')); |
| | | errorMsg += 'Barcode ' + bc + ' 库存不足,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | //ApexPages.addMessages(e); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage()+e.getStackTraceString(), ''); |
| | | } |
| | | getorderinfo(); |
| | | dataInfoconfim(); |
| | | getorderdet2info(csvRecordStr); |
| | | if (saveFLGbln == false) { |
| | | getorderdetinfo(csvRecordStr); |
| | | } |
| | | data.put('orderRecords', orderRecords); |
| | | data.put('saveFLGbln', saveFLGbln); |
| | | data.put('csvRecordStr', csvRecordStr); |
| | | data.put('barcodeList', barcodeList); |
| | | data.put('secondAgencyMap',secondAgencyMap); |
| | | data.put('hospitalSysMap',hospitalSysMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | return res; |
| | | } |
| | | } |
| | | |
| | | public static void getorderinfo() { |
| | | map<string, string> orderNameMap = new Map<string, string>(); |
| | | try { |
| | | csvAsString = csvFileBody.toString(); |
| | | csvFileLines = csvAsString.split('\n'); |
| | | for (Integer i = 1; i < csvFileLines.size(); i++) { |
| | | Consumable_order__c cocObj = new Consumable_order__c(); |
| | | string[] csvRecordData = csvFileLines[i].split(','); |
| | | if (orderNameMap.containsKey(csvRecordData[0])) |
| | | continue; |
| | | cocObj.Name = csvRecordData[0]; |
| | | if (String.isNotBlank(csvRecordData[1])) { |
| | | cocObj.SummonsForDirction__c = csvRecordData[1]; |
| | | } else { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '出货目的为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '出货目的为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | cocObj.Order_Attachment__c = csvRecordData[2]; |
| | | cocObj.Order_Indication__c = csvRecordData[3]; |
| | | cocObj.Order_ForCustomerText__c = csvRecordData[4]; |
| | | cocObj.Invoice_Note__c = csvRecordData[5]; |
| | | if (String.isBlank(csvRecordData[11])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + cocObj.Name + '的产品中,存在出库日期为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + cocObj.Name + '的产品中,存在出库日期为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cocObj.Outbound_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | if (String.isNotEmpty(csvRecordData[2])) { |
| | | hospitalconMap.put(csvRecordData[2].trim(), csvRecordData[0].trim()); |
| | | } |
| | | orderNameMap.put(csvRecordData[0], csvRecordData[0]); |
| | | orderRecords.add(new ConsumableorderdetailsInfo(cocObj)); |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | public static void dataInfoconfim() { |
| | | //确认医院信息 |
| | | hospitalSysMap = new Map<String, String>(); |
| | | secondAgencyMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfo ass : orderRecords) { |
| | | if ( |
| | | (ass.order.SummonsForDirction__c == '销售给二级经销商' || |
| | | ass.order.SummonsForDirction__c == '直接销售给医院' || |
| | | ass.order.SummonsForDirction__c == '医院试用') && |
| | | (String.isBlank(ass.hospitalName) || |
| | | String.isBlank(ass.hospitalCode) || |
| | | String.isBlank(ass.order.Order_ForCustomerText__c)) |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '医院相关信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '医院相关信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | //return null; |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '销售给二级经销商') { |
| | | if (String.isBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '经销商信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '经销商信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '直接销售给医院') { |
| | | if (String.isNotBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '不需要二级经销商,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '不需要二级经销商,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '互相调货') { |
| | | if (String.isBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '经销商信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '经销商信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | if ( |
| | | String.isNotBlank(ass.hospitalName) || |
| | | String.isNotBlank(ass.hospitalCode) || |
| | | String.isNotBlank(ass.order.Order_ForCustomerText__c) |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '不需要医院相关信息,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '不需要医院相关信息,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | } |
| | | System.debug('accountName = ' + accountName); |
| | | List<Agency_Hospital_Link__c> hospitalInfo = [ |
| | | SELECT Hospital__c, Hospital__r.Management_Code__c, Hospital__r.Name |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__r.Name = :accountName |
| | | ]; |
| | | List<Dealer_elationship__c> secondAgencyInfo = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__r.Name = :accountName |
| | | ]; |
| | | for (Agency_Hospital_Link__c hpinfo : hospitalInfo) { |
| | | hospitalSysMap.put(hpinfo.Hospital__r.Management_Code__c, hpinfo.Hospital__c); |
| | | } |
| | | for (Dealer_elationship__c safo : secondAgencyInfo) { |
| | | secondAgencyMap.put(safo.Dealer_subordinate__r.Name, safo.Dealer_subordinate__c); |
| | | } |
| | | //出库单信息验证 |
| | | System.debug('hospitalconMap = ' + hospitalconMap); |
| | | System.debug('hospitalSysMap = ' + hospitalSysMap); |
| | | for (String widget : hospitalconMap.keySet()) { |
| | | if (!hospitalSysMap.containsKey(widget)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // hospitalconMap.get(widget) + |
| | | // ' 的医院编码' + |
| | | // widget + |
| | | // ' 不存在或者不是本经销商负责的医院,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += |
| | | '出库单 ' + |
| | | hospitalconMap.get(widget) + |
| | | ' 的医院编码' + |
| | | widget + |
| | | ' 不存在或者不是本经销商负责的医院,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void getorderdet2info(List<String[]> csvRecordStr) { |
| | | barcodeList = new List<String>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | } |
| | | if (String.isBlank(csvRecordData[9])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 不存在出库单位,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 不存在出库单位,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.valueOf(csvRecordData[9]) != '盒' && String.valueOf(csvRecordData[9]) != '个') { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 出库单位不正确,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 出库单位不正确,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | } |
| | | if (String.isBlank(csvRecordData[8])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.isNotBlank(csvRecordData[8])) { |
| | | if ( |
| | | Decimal.valueOf(csvRecordData[8]) == 0 && |
| | | (String.valueOf(csvRecordData[1]) == '直接销售给医院' || |
| | | String.valueOf(csvRecordData[1]) == '销售给二级经销商') |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '产品出货单价不能为0,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价不能为0,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | } |
| | | if (String.isBlank(csvRecordData[6])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的产品中,存在barcode为空,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的产品中,存在barcode为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.isBlank(csvRecordData[12])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 不存在或不是在库产品,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 不存在或不是在库产品,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.isBlank(csvRecordData[11])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的产品中,存在出库日期为空,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的产品中,存在出库日期为空,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | public static void getorderdetinfo(List<String[]> csvRecordStr) { |
| | | map<string, string> orderdetMap = new Map<string, string>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12])) |
| | | continue; |
| | | codObj.Remarks__c = csvRecordData[0]; |
| | | if (String.isBlank(csvRecordData[7])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '产品出货数量为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '产品出货数量为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (Decimal.valueOf(csvRecordData[7]) > 1 && String.valueOf(csvRecordData[9]) == '盒') { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // csvRecordData[0] + |
| | | // '存在单位是盒,产品出货数量大于1,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '存在单位是盒,产品出货数量大于1,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]); |
| | | } |
| | | codObj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } else { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '产品出货单价为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '出库单 ' + csvRecordData[0] + '产品出货单价为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | //if(String.isNotBlank(csvRecordData[10])){ |
| | | // codObj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]); |
| | | //} |
| | | codObj.Lose_reason__c = csvRecordData[12]; |
| | | codObj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim()); |
| | | orderdetMap.put(csvRecordData[0] + csvRecordData[12], csvRecordData[0] + csvRecordData[12]); |
| | | //orderdetRecords.add(new ConsumableorderdetailsInfo(codObj)); |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC dataImport( |
| | | List<String[]> csvRecordStrLwc, |
| | | String orderRecordsLwc, |
| | | String sqlagencyProTypeLwc, |
| | | String userWorkLocationLwc, |
| | | String accountNameLwc, |
| | | String accountidLwc, |
| | | String agencyProTypeLwc, |
| | | Map<String, String> secondAgencyMapLwc, |
| | | Map<String, String> hospitalSysMapLwc |
| | | ) { |
| | | List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>(); |
| | | product2conMap = new Map<String, String>(); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | csvRecordStr = csvRecordStrLwc; |
| | | orderRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class); |
| | | System.debug('orderRecords = ' + orderRecords); |
| | | sqlagencyProType = sqlagencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | accountName = accountNameLwc; |
| | | secondAgencyMap = secondAgencyMapLwc; |
| | | hospitalSysMap = hospitalSysMapLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | System.debug('agencyProType = ' + agencyProType); |
| | | |
| | | errorMsg = ''; |
| | | System.debug('csvRecordStr = ' + csvRecordStr); |
| | | orderdetRecords = getorderdetList(csvRecordStr); |
| | | orderdet2BoxRecords = getorderdet2BoxList(csvRecordStr); |
| | | orderdet2PieceRecords = getorderdet2pieceList(csvRecordStr); |
| | | System.debug('orderdetRecords = ' + orderdetRecords); |
| | | System.debug('orderdet2BoxRecords = ' + orderdet2BoxRecords); |
| | | System.debug('orderdet2PieceRecords = ' + orderdet2PieceRecords); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | Map<String, String> orderInfoMap = new Map<String, String>(); |
| | | List<Consumable_order__c> coc = new List<Consumable_order__c>(); |
| | | for (ConsumableorderdetailsInfo ass : orderRecords) { |
| | | ass.order.Order_type__c = '传票'; |
| | | ass.order.SummonsStatus_c__c = '已完成'; |
| | | ass.order.Order_ProType__c = agencyProType; |
| | | ass.order.Dealer_Info__c = accountid; |
| | | ass.order.Order_ForHospital__c = hospitalSysMap.get(ass.hospitalCode); |
| | | if (secondAgencyMap.containsKey(ass.agencyName)) { |
| | | ass.order.Order_ForDealer__c = secondAgencyMap.get(ass.agencyName); |
| | | } else { |
| | | ass.order.Order_ForDealerText__c = ass.agencyName; |
| | | } |
| | | ass.order.RecordTypeId = System.Label.RT_ConOrder_Sale; |
| | | coc.add(ass.order); |
| | | } |
| | | System.debug('coc = ' + coc); |
| | | if (coc.size() > 0) { |
| | | insert coc; |
| | | } |
| | | for (Consumable_order__c order : coc) { |
| | | orderInfoMap.put(order.Name, order.Id); |
| | | } |
| | | List<Consumable_Orderdetails__c> cod = new List<Consumable_Orderdetails__c>(); |
| | | for (String field : orderInfoMap.keySet()) { |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfo ass : orderdetRecords) { |
| | | if (ass.orderName == field) { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | ass.orderdetails1.Name = ass.orderName + '-' + str; |
| | | ass.orderdetails1.Consumable_order__c = orderInfoMap.get(ass.orderName); |
| | | ass.orderdetails1.Consumable_Product__c = ass.productName; |
| | | ass.orderdetails1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | cod.add(ass.orderdetails1); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | System.debug('cod = ' + cod); |
| | | if (cod.size() > 0) { |
| | | insert cod; |
| | | } |
| | | //盒的数据检索 |
| | | List<Consumable_Order_details2__c> cod2List = new List<Consumable_Order_details2__c>(); |
| | | List<Consumable_order_details2__c> cOrderDet = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodeList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '盒' |
| | | ]; |
| | | for (ConsumableorderdetailsInfo ass : orderdet2BoxRecords) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c codtest : cOrderDet) { |
| | | Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c(); |
| | | if (codtest.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | cod2 = codtest; |
| | | cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Used_date__c = ass.orderdetails2.Used_date__c; |
| | | cod2.Send_Date__c = ass.orderdetails2.Send_Date__c; |
| | | //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c; |
| | | cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c; |
| | | cod2List.add(cod2); |
| | | cOrderDet.remove(idx); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | |
| | | //个的数据检索 |
| | | List<Consumable_order_details2__c> cOrderDetPiece = [ |
| | | SELECT Id, Bar_Code__c, RemoveBox_No__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Bar_Code__c IN :barcodePieceList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Box_Piece__c = '个' |
| | | ORDER BY Bar_Code__c, RemoveBox_No__c DESC |
| | | ]; |
| | | for (ConsumableorderdetailsInfo ass : orderdet2PieceRecords) { |
| | | Decimal idy = 1; |
| | | for (Integer idx = 0; idx < cOrderDetPiece.size(); idx++) { |
| | | Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c(); |
| | | if (cOrderDetPiece[idx].Bar_Code__c == ass.orderdetails2.Bar_Code__c && idy <= ass.pieceCount) { |
| | | cod2 = cOrderDetPiece[idx].Clone(); |
| | | cod2.Id = cOrderDetPiece[idx].Id; |
| | | cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Used_date__c = ass.orderdetails2.Used_date__c; |
| | | cod2.Send_Date__c = ass.orderdetails2.Send_Date__c; |
| | | //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c; |
| | | cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c; |
| | | cod2List.add(cod2); |
| | | cOrderDetPiece[idx].Bar_Code__c = ''; |
| | | idy++; |
| | | //break; |
| | | } |
| | | } |
| | | } |
| | | if (cod2List.size() > 0) { |
| | | update cod2List; |
| | | } |
| | | errorflg = true; |
| | | //errorMessage = '保存完成。'; |
| | | saveFLGbln = true; |
| | | |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | return res; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), ''); |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdetList(List<String[]> csvRecordStr) { |
| | | List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>(); |
| | | map<string, Decimal> orderdetMap = new Map<string, Decimal>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) { |
| | | orderdetMap.put( |
| | | csvRecordData[0] + |
| | | csvRecordData[12] + |
| | | csvRecordData[9], |
| | | orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7]) |
| | | ); |
| | | continue; |
| | | } else { |
| | | orderdetMap.put(csvRecordData[0] + csvRecordData[12] + csvRecordData[9], Decimal.valueOf(csvRecordData[7])); |
| | | } |
| | | codObj.Remarks__c = csvRecordData[0]; |
| | | codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]); |
| | | codObj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | codObj.Lose_reason__c = csvRecordData[12]; |
| | | if (String.isNotBlank(csvRecordData[11])) { |
| | | codObj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim()); |
| | | orderdetRecords.add(new ConsumableorderdetailsInfo(codObj)); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : orderdetRecords) { |
| | | if (orderdetMap.containsKey(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c)) { |
| | | ass.orderdetails1.Shipment_Count__c = orderdetMap.get(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c); |
| | | } |
| | | } |
| | | System.debug('orderdetRecords = ' + orderdetRecords); |
| | | return orderdetRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | System.debug('orderdetRecords = null ' + e.getLineNumber()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdet2BoxList(List<String[]> csvRecordStr) { |
| | | barcodeList = new List<String>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (String.valueOf(csvRecordData[9]) == '盒') { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | } |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | //if(String.isNotBlank(csvRecordData[10])){ |
| | | // cod2Obj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]); |
| | | //} |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.valueOf(csvRecordData[1]) == '销售给二级经销商' || String.valueOf(csvRecordData[1]) == '直接销售给医院') { |
| | | cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | orderdet2BoxRecords.add(new ConsumableorderdetailsInfo(cod2Obj)); |
| | | } |
| | | } |
| | | return orderdet2BoxRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdet2pieceList(List<String[]> csvRecordStr) { |
| | | barcodePieceList = new List<String>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (String.valueOf(csvRecordData[9]) == '个') { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodePieceList.add(csvRecordData[6]); |
| | | } |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.valueOf(csvRecordData[1]) == '销售给二级经销商' || String.valueOf(csvRecordData[1]) == '直接销售给医院') { |
| | | cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | cod2Obj.Rrturn_count__c = Decimal.valueOf(csvRecordData[7]); |
| | | orderdet2PieceRecords.add(new ConsumableorderdetailsInfo(cod2Obj)); |
| | | } |
| | | } |
| | | return orderdet2PieceRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order__c order { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public String orderName { get; set; } |
| | | @AuraEnabled |
| | | public String hospitalCode { get; set; } |
| | | @AuraEnabled |
| | | public String hospitalName { get; set; } |
| | | @AuraEnabled |
| | | public String agencyName { get; set; } |
| | | @AuraEnabled |
| | | public String productName { get; set; } |
| | | @AuraEnabled |
| | | public Decimal pieceCount { get; set; } |
| | | // 取到的订单信息 |
| | | public ConsumableorderdetailsInfo(Consumable_order__c e) { |
| | | order = e; |
| | | hospitalCode = e.Order_Attachment__c; |
| | | hospitalName = e.Order_Indication__c; |
| | | agencyName = e.Invoice_Note__c; |
| | | e.Order_Attachment__c = ''; |
| | | e.Order_Indication__c = ''; |
| | | e.Invoice_Note__c = ''; |
| | | } |
| | | // 取到的订单明细 |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | orderName = e.Remarks__c; |
| | | productName = e.Lose_reason__c; |
| | | e.Lose_reason__c = ''; |
| | | e.Remarks__c = ''; |
| | | } |
| | | // 取到的产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails2 = e; |
| | | orderName = e.TracingCode__c; |
| | | productName = e.Return_reason__c; |
| | | pieceCount = e.Rrturn_count__c; |
| | | e.TracingCode__c = ''; |
| | | e.Return_reason__c = ''; |
| | | e.Rrturn_count__c = null; |
| | | } |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexOverdueStockController { |
| | | |
| | | /*****************検索用******************/ |
| | | public static String barcode { get; set; } |
| | | |
| | | // 过期和销存,画面显示用 |
| | | public static List<orderBean> codPageRecords { get; set; } |
| | | |
| | | // 过期和销存,画面显示用 |
| | | public static List<orderBean> overduePageRecords { get; set; } |
| | | |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | //经销商用户产品分类(ET、ENG) |
| | | private static String agencyProType; |
| | | private static String sqlagencyProType; |
| | | // 经销商信息 |
| | | private static Account accountInfo; |
| | | |
| | | //判断操作人员是否销存 |
| | | public static Boolean iSinventory = false; |
| | | |
| | | public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>(); |
| | | |
| | | public static Integer pageRecordsSize { |
| | | get { |
| | | return codPageRecords == null ? 0 : codPageRecords.size(); |
| | | } |
| | | } |
| | | |
| | | public LexOverdueStockController() { |
| | | |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | codPageRecords = new List<orderBean>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | // 过期库存汇总信息 |
| | | List<AggregateResult> orderDetZaiku = [SELECT count(Id) countsum, |
| | | Consumable_Product__c prodid, |
| | | Consumable_Product__r.Name_Text__c prodname, |
| | | Box_Piece__c boxPiece |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c]; |
| | | |
| | | for(AggregateResult overdue : orderDetZaiku){ |
| | | codPageRecords.add(new orderBean(overdue)); |
| | | } |
| | | |
| | | system.debug('codPageRecords====>'+codPageRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('accountName',accountInfo.Name); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('orderDetZaiku',JSON.serialize(orderDetZaiku)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(codPageRecordsLWC,List<orderBean>.class); |
| | | sqlagencyProType = '%' + agencyProTypeLWC + '%'; |
| | | system.debug('sqlagencyProType==>'+ sqlagencyProType); |
| | | barcode = barcodeLWC; |
| | | system.debug('barcode==>'+ barcode); |
| | | userWorkLocation = userWorkLocationLWC; |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | |
| | | iSinventory = true; |
| | | Set<String> barCodeoverdue = new Set<String>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | List<String> barCodeListP = ParseBarCode( barcode ); |
| | | // 页面显示数据初始化 |
| | | for (orderBean codPage : codPageRecords) { |
| | | codPage.pandian = 0; |
| | | } |
| | | // 查询所有过期库存 |
| | | List<Consumable_order_details2__c> orderDetZaiku = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation]; |
| | | // 没有输入条码时,循环页面,所有打钩产品全部销存 |
| | | // 取得所有 |
| | | overdueList = new List<Consumable_order_details2__c>(); |
| | | if (String.isBlank(barcode)) { |
| | | System.debug('barcode空'); |
| | | for(orderBean codPage : codPageRecords){ |
| | | if (codPage.check) { |
| | | for(Consumable_order_details2__c cod2 : orderDetZaiku){ |
| | | if(cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | } |
| | | } |
| | | codPage.pandian = codPage.overlimitCount; |
| | | } |
| | | } |
| | | // return; |
| | | System.debug('overduePageRecords = ' + overduePageRecords); |
| | | data.put('overduePageRecords',JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory',iSinventory); |
| | | data.put('overdueList',overdueList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | // res.msg = '请输入BarCode号'; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 输入barcode时 |
| | | |
| | | // BarCode的检索 所有在库 |
| | | List<Consumable_order_details2__c> reSet = [select Id,Consumable_Product__c, |
| | | Consumable_Product__r.Name__c,Box_Piece__c,Bar_Code_search__c, |
| | | Dealer_Shipment__c,Dealer_Saled__c,Lose_Flag__c,Bar_Code__c, |
| | | Cancellation_Flag__c,Isoverdue__c,Sterilization_limit__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Arrive__c = true |
| | | AND Cancellation_Flag__c = false |
| | | and Dealer_Returned__c = false |
| | | and Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | order by Name]; |
| | | |
| | | System.debug('reSet===>'+reSet); |
| | | |
| | | |
| | | for(Consumable_order_details2__c cod2 : reSet){ |
| | | if ((cod2.Dealer_Shipment__c == false && cod2.Dealer_Saled__c == false |
| | | && cod2.Lose_Flag__c == false && cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0) { |
| | | for (orderBean codPage : codPageRecords) { |
| | | if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | codPage.pandian ++; |
| | | codPage.check = true; |
| | | } |
| | | } |
| | | }else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) { |
| | | overduePageRecords.add(new orderBean(cod2,'产品已经出库')); |
| | | }else{ |
| | | overduePageRecords.add(new orderBean(cod2,'不是过期库存')); |
| | | } |
| | | } |
| | | System.debug('overduePageRecords = ' + overduePageRecords); |
| | | data.put('overduePageRecords',JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory',iSinventory); |
| | | data.put('overdueList',overdueList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | system.debug('saveCodPageRecords=============>'+saveCodPageRecords); |
| | | system.debug('saveoverdueList'+saveoverdueList); |
| | | overdueList = saveoverdueList; |
| | | // if(saveoverdueList==null){ |
| | | // return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | |
| | | // } |
| | | |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(saveCodPageRecords,List<orderBean>.class); |
| | | // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class); |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // return null; |
| | | } |
| | | integer Lo = 0; |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Lo++; |
| | | } |
| | | } |
| | | if(Lo == 0){ |
| | | iSinventory = false; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要销存的明细。')); |
| | | return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | // return null; |
| | | } |
| | | Integer orderDetNo = 1; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Consumable_order__c po = new Consumable_order__c(); |
| | | po.Name ='*'; |
| | | po.Order_status__c = '批准'; |
| | | po.Inventory_date__c = Date.today(); |
| | | po.Order_type__c = '销存'; |
| | | po.Dealer_Info__c = accountInfo.Id; |
| | | po.Order_ProType__c = agencyProType; |
| | | po.RecordTypeid = System.Label.RT_ConOrder_Overdue; |
| | | try{ |
| | | insert po; |
| | | Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id]; |
| | | List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>(); |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Consumable_orderdetails__c insPan = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(orderDetNo); |
| | | if(str.length() == 1){ |
| | | str = '0' + str; |
| | | } |
| | | insPan.Name = order.Name + '-'+ str; |
| | | insPan.Consumable_Product__c = header.prodId; |
| | | insPan.Consumable_order__c = po.Id; |
| | | insPan.Lose_reason__c = '过期库存销存'; |
| | | insPan.Overdue_count__c = header.pandian; |
| | | insPan.Overdue_SUM__c = header.overlimitCount; |
| | | insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory; |
| | | orderDetNo ++; |
| | | InsList.add(insPan); |
| | | } |
| | | } |
| | | // 生成明细1 |
| | | if(InsList.size()>0){ |
| | | insert InsList; |
| | | } |
| | | |
| | | for(Consumable_order_details2__c cod : overdueList){ |
| | | cod.Consumable_Inventory_order__c = po.Id; |
| | | cod.Inventory_date__c = Date.today(); |
| | | cod.Lose_reason__c = '过期库存销存'; |
| | | cod.Lose_Flag__c = true; |
| | | |
| | | } |
| | | if(overdueList.size()>0){ |
| | | ControllerUtil.updateOrderDetailsSatus(overdueList); |
| | | } |
| | | |
| | | }catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(ex); |
| | | return null; |
| | | } |
| | | // return new Pagereference('/' + po.Id); |
| | | data.put('Id',po.Id); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | public static List<String> ParseBarCode(String Code){ |
| | | Map<String,Integer> barcodeCountMap = new Map<String,Integer>(); |
| | | String[] Cache = new String[]{}; |
| | | Cache = Code.split('\n'); |
| | | List <String> Buff = new List<String>(); |
| | | for(String A : Cache){ |
| | | A = A.trim().toUpperCase(); |
| | | if(barcodeCountMap.containsKey(A)){ |
| | | barcodeCountMap.put(A,barcodeCountMap.get(A) + 1); |
| | | }else{ |
| | | barcodeCountMap.put(A,1); |
| | | } |
| | | Buff.add(A + barcodeCountMap.get(A)); |
| | | } |
| | | return Buff; |
| | | } |
| | | |
| | | // Data Bean |
| | | class orderBean implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | |
| | | // 过期库存 |
| | | @AuraEnabled |
| | | public Integer overlimitCount { get; set; } |
| | | // 销存数量 |
| | | @AuraEnabled |
| | | public Integer pandian { get; set; } |
| | | // 销存原因 |
| | | @AuraEnabled |
| | | public String diffReason { get; set; } |
| | | // 单位 |
| | | @AuraEnabled |
| | | public String boxPiece { get; set; } |
| | | @AuraEnabled |
| | | public String prodname { get; set; } |
| | | @AuraEnabled |
| | | public String prodid { get; set; } |
| | | orderBean(Consumable_order_details2__c e,string str) { |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | DiffReason = str; |
| | | } |
| | | public orderBean(AggregateResult e) { |
| | | check = false; |
| | | overlimitCount = Integer.valueOf(e.get('countsum')); |
| | | prodname = String.valueOf(e.get('prodname')); |
| | | prodid = String.valueOf(e.get('prodid')); |
| | | boxPiece = String.valueOf(e.get('BoxPiece')); |
| | | pandian = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | orderBean compareToesd =(orderBean)compareTo; |
| | | Integer returnValue = 0; |
| | | if (overlimitCount > compareToesd.overlimitCount ) { |
| | | returnValue = -1; |
| | | } else if (overlimitCount < compareToesd.overlimitCount ) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexProductLimitEditController { |
| | | public static String accountid { get; set; } |
| | | public static String product_Limit { get; set; } |
| | | //--------AddStart-----XHL--------------20180929------------- |
| | | public static String userPro_Type { get; set; } |
| | | public static Boolean EngFlag = false; |
| | | public static Boolean ETFlag = false; |
| | | //--------AddEnd-----XHL--------------20180929------------- |
| | | // 画面初始化 |
| | | public LexProductLimitEditController (){ |
| | | accountid= ApexPages.currentPage().getParameters().get('accountid'); |
| | | //--------AddStart-----XHL--------------20181008------------- |
| | | userPro_Type= ApexPages.currentPage().getParameters().get('userPro_Type'); |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //--------AddEnd-----XHL--------------20181008------------- |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String accountid,string userPro_Type) { |
| | | System.debug('userPro_Type==>'+userPro_Type); |
| | | System.debug('accountid==>'+accountid); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | |
| | | List<Account> accinfo = New List<Account>(); |
| | | //--------UpdateStart-----XHL--------------20181008------------- |
| | | accinfo = [SELECT Product_Limit_Date__c,Product_Limit_DateENG__c |
| | | FROM Account |
| | | WHERE id =:accountid]; |
| | | if(accinfo.size() > 0){ |
| | | if(EngFlag){ |
| | | product_Limit = accinfo [0].Product_Limit_DateENG__c; |
| | | }else if(ETFlag){ |
| | | product_Limit = accinfo [0].Product_Limit_Date__c; |
| | | } |
| | | |
| | | } |
| | | System.debug('product_Limit==>'+product_Limit); |
| | | data.put('product_Limit',product_Limit); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | //--------UpdateEnd-----XHL--------------20181008------------- |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexRemoveBoxController { |
| | | //经销商产品分类 |
| | | public static String agencyProType {get;set;} |
| | | public static String userPro_Typestr = null; |
| | | public static String barcode { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; } |
| | | //错误明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; } |
| | | //拆盒明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; } |
| | | public static boolean saveFLGbln {get;set;} |
| | | //错误信息 |
| | | public static String alertMessage {set;get;} |
| | | //拆盒明细件数 |
| | | public static integer getinventorysize(){ |
| | | return ConsumableorderdetailsRecordsdummy.size(); |
| | | } |
| | | public static Map<String, String> ExistIdMap = new Map<String, String>(); |
| | | public static Map<String, String> ErrorIdMap = new Map<String, String>(); |
| | | public static Map<String, String> AllMap = new Map<String, String>(); |
| | | public static List<String> BarCodeListP = new List<String>(); |
| | | //不符合的barcode和型号 |
| | | public static list<String> notInlist = new list<String>(); |
| | | public static String baseUrl {get;private set;} |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | //public String[] proidList =new String[]{}; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | |
| | | public LexRemoveBoxController(){ |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInventory = new List<ConsumableorderdetailsInfo>(); |
| | | saveFLGbln = FALSE; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> Useracc = New List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid]; |
| | | //String view_product = accountInfo[0].view_product__c; |
| | | accountName = accountInfo[0].Name; |
| | | //proidList = view_product.split(','); |
| | | |
| | | data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy)); |
| | | data.put('accountName',accountName); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | public static List<String> ParseBarCode(String Code){ |
| | | String[] Cache = new String[]{}; |
| | | Cache = Code.split('\n'); |
| | | Set <String> Buff = new Set<String>(); |
| | | for(String A : Cache){ |
| | | Buff.add(A); |
| | | } |
| | | List<String> outPut = new List<String>(); |
| | | for(String B :Buff){ |
| | | B = B.trim(); |
| | | outPut.add(B); |
| | | } |
| | | return outPut; |
| | | } |
| | | |
| | | //获取明细 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) { |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | barcode = barcode; |
| | | accountName = accountName; |
| | | userWorkLocation = userWorkLocation; |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | |
| | | |
| | | notInlist = new list<String>(); |
| | | BarCodeListP = ParseBarCode(barcode); |
| | | Consumable_order_details2__c p = new Consumable_order_details2__c(); |
| | | 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>(); |
| | | |
| | | saveFLGbln = false; |
| | | alertMessage=''; |
| | | |
| | | //判断barcode是否为空 |
| | | if(barcode == null || barcode ==''){ |
| | | return new ResponseBodyLWC('Error',500, '请输入BarCode号', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。')); |
| | | // return; |
| | | } |
| | | |
| | | // ExistIdMap.clear(); |
| | | // ErrorIdMap.clear(); |
| | | // notInlist.clear(); |
| | | // ConsumableorderdetailsRecordserror.clear(); |
| | | // ConsumableorderdetailsRecordsdummy.clear(); |
| | | |
| | | // 产品类型不同 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c,Product_Type__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | AND (not Product_Type__c like : userPro_Typestr) |
| | | ORDER BY Name ]; |
| | | 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 +'与用户类型'+ agencyProType +'不符,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | //未到货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = FALSE |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //已发货,未到货 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品未到货,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已规格=1 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND ProductPacking_list_manual__c = 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,就是在库,没拆盒,规格=1 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品规格为1,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | //已出货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Shipment__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品已出货'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已销售 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Saled__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品已销售'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已拆盒 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,就是在库,已拆盒 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品已拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 已经取消 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Cancellation_Flag__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品已经取消,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 工作地不同 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | // gzw 无法拆盒,去掉销售明细 20210802 |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | // gzw 无法拆盒,去掉销售明细 20210802 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != : userWorkLocation |
| | | ORDER BY Name ]; |
| | | 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].Arrive_Owner_Work_Location__c + ',不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | reSet = [SELECT Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__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, |
| | | Agencyinfo_fromSAP__c, |
| | | Frist_Storage_Agency__c, |
| | | Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | if(reSet.size()>0){ |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过错误的消耗品明细 |
| | | continue; |
| | | } |
| | | else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } |
| | | else{ |
| | | ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i])); |
| | | ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | AllMap.putAll(ExistIdMap); |
| | | //得到不存在的BarCode |
| | | for(Integer i = 0; i < BarCodeListP.size(); i++){ |
| | | if(ExistIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else if(ErrorIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else{ |
| | | notInlist.add(BarCodeListP[i]); |
| | | } |
| | | } |
| | | if(notInlist.size()>0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。')); |
| | | return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在', ''); |
| | | } |
| | | |
| | | |
| | | data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy)); |
| | | data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror)); |
| | | data.put('dataSize',ConsumableorderdetailsRecordsdummy.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | //拆盒确认 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC removeBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | accountName = accountName; |
| | | userWorkLocation =userWorkLocation; |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class); |
| | | |
| | | |
| | | |
| | | |
| | | List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>(); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | if(ConsumableorderdetailsRecordsdummy.size()<1){ |
| | | return new ResponseBodyLWC('Error',500, '不存在拆盒明细', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在拆盒明细')); |
| | | // return null; |
| | | } |
| | | |
| | | List<String> BarCodeList = new List<String>(); |
| | | for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) { |
| | | BarCodeList.add(tmp.esd.Bar_Code__c); |
| | | } |
| | | |
| | | try{ |
| | | //取得在库信息 |
| | | List<Consumable_order_details2__c> orderDetails2 = [SELECT |
| | | Id, |
| | | Name, |
| | | Bar_Code__c, |
| | | TracingCode__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Purchase_Unitprice_From__c, |
| | | Guarantee_period_for_products__c, |
| | | Used_account__c, |
| | | Consumable_ZS_order__c, |
| | | Cancellation_Date__c, |
| | | Consumable_product__c, |
| | | Consumable_order_minor__c, |
| | | Direct_Arrive_Product__c, |
| | | Arrive_date__c, |
| | | Consumable_Arrived_order__c, |
| | | Unitprice_To_agency__c, |
| | | SerialLotNo__c, |
| | | Sterilization_limit__c, |
| | | Invoice_Date__c, |
| | | Lose_reason__c, |
| | | Asset_Model_No__c, |
| | | Deliver_date__c, |
| | | Inventory_date__c, |
| | | Consumable_Inventory_order__c, |
| | | Dealer_Arrive__c, |
| | | ProductPacking_list_manual__c, |
| | | Agencyinfo_fromSAP__c, |
| | | Frist_Storage_Agency__c, |
| | | Dealer_Info_text__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | // tcm start |
| | | ,Consumable_order_minor__r.ContractNo__c |
| | | // tcm end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | |
| | | List<Consumable_order_details2__c> orderDetails2del = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> orderDetails2ins = new List<Consumable_order_details2__c>(); |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2) { |
| | | Decimal num = detail2tmp.ProductPacking_list_manual__c; |
| | | Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c(); |
| | | delDetails2.Id = detail2tmp.Id; |
| | | |
| | | //删除拆盒前在库 |
| | | //delete delDetails2; |
| | | orderDetails2del.add(delDetails2); |
| | | |
| | | for(integer i=0; i < num; i++){ |
| | | Consumable_order_details2__c insertDetails2 = new Consumable_order_details2__c(); |
| | | insertDetails2 = detail2tmp.clone(); |
| | | |
| | | insertDetails2.Id = null; |
| | | //单位(盒/个) |
| | | insertDetails2.Box_Piece__c = '个'; |
| | | //拆盒番号 |
| | | insertDetails2.RemoveBox_No__c = i+1; |
| | | //拆盒日期 |
| | | insertDetails2.RemoveBox_date__c = Date.today(); |
| | | //add by rentx 2020-10-13 start 拆盒/取消拆盒时,记录SAP合同号 |
| | | // insertDetails2.ContractNo_text__c= detail2tmp.ContractNo__c; |
| | | // tcm start |
| | | if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) { |
| | | insertDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c; |
| | | }else { |
| | | insertDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c; |
| | | } |
| | | // tcm end |
| | | //登录拆盒后在库 |
| | | //insert insertDetails2; |
| | | orderDetails2ins.add(insertDetails2); |
| | | } |
| | | } |
| | | |
| | | if (orderDetails2del.size()>0){ |
| | | delete orderDetails2del; |
| | | } |
| | | |
| | | if(orderDetails2ins.size()>0){ |
| | | insert orderDetails2ins; |
| | | |
| | | } |
| | | |
| | | saveFLGbln = true; |
| | | alertMessage = '拆盒完成'; |
| | | data.put('saveFLGbln',saveFLGbln); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = alertMessage; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // return null; |
| | | }catch(Exception e){ |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | //public String ProductName { get; set; } |
| | | //public Boolean canSELECT { get; set; } |
| | | //public String barCodeNo { get; set; } |
| | | //public Date sterilizationlimitDate { get; set; } |
| | | //public String serialNoorLotNo { get; set; } |
| | | //public String tracingCodeNo { get; set; } |
| | | @AuraEnabled |
| | | public String oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public String ErrorReason { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | } |
| | | /* |
| | | public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | esd = new Consumable_order_details2__c(); |
| | | ProductName = e.Name__c; |
| | | Prod = e; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | //esd = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | //ProductName = productName; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | */ |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexSaleAndDeliveryController { |
| | | // 显示数据条数限制 |
| | | private static Integer Select_Limit = 100; |
| | | |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | try { |
| | | System.debug('init'); |
| | | //经销商id |
| | | String accountid = ''; |
| | | //经销商产品分类 |
| | | String agencyProType = ''; |
| | | //登录用户 ID |
| | | String userinfoId = ''; |
| | | //登录者工作地 |
| | | String userWorkLocation = ''; |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | userinfoId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId]; |
| | | accountid = Useracc[0].accountid; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | data.put('userinfoId', userinfoId); |
| | | data.put('accountid', accountid); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | System.debug( |
| | | 'userinfoId = ' + |
| | | userinfoId + |
| | | ' accountid = ' + |
| | | accountid + |
| | | ' agencyProType = ' + |
| | | agencyProType + |
| | | ' userWorkLocation = ' + |
| | | userWorkLocation |
| | | ); |
| | | //默认检索显示未完成的指示单 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += 'order by SummonsStatus_c__c'; |
| | | System.debug('soql = ' + soql); |
| | | raesList = Database.query(soql); |
| | | System.debug('raesList = ' + raesList); |
| | | data.put('raesList', raesList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | |
| | | // 已出库未开票的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchOrderInstatus( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | // 获得订单一览 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Outbound_Date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Outbound_Date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsForDirction__c != \'' + '互相调货' + '\' '; |
| | | soql += 'and SummonsStatus_c__c = \'' + '已完成' + '\' '; |
| | | soql += 'and Billed_Status__c != \'' + '全部开票' + '\' '; |
| | | soql += 'order by CreatedDate desc limit ' + Select_Limit; |
| | | System.debug('soql = ' + soql); |
| | | raesList = Database.query(soql); |
| | | data.put('raesList', raesList); |
| | | if (raesList.size() > 0) { |
| | | res.msg = '共有' + raesList.size() + '个出库单'; |
| | | } else { |
| | | res.msg = '没有搜索到相关出库单。'; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | |
| | | //还没出库的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | System.debug('cate2 = ' + cate2); |
| | | System.debug('cate3 = ' + cate3); |
| | | // 获得订单一览 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Order_date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Order_date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' '; |
| | | soql += 'order by SummonsStatus_c__c limit ' + Select_Limit; |
| | | System.debug('soql+++++' + soql); |
| | | raesList = Database.query(soql); |
| | | data.put('raesList', raesList); |
| | | if (raesList.size() > 0) { |
| | | res.msg = '共有' + raesList.size() + '个出库单'; |
| | | } else { |
| | | res.msg = '没有搜索到相关出库单。'; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | |
| | | // 已出库已开票的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorFinish( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Outbound_Date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Outbound_Date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsStatus_c__c = \'' + '已完成' + '\' '; |
| | | soql += 'and Billed_Status__c = \'' + '全部开票' + '\' '; |
| | | soql += 'order by CreatedDate desc limit ' + Select_Limit; |
| | | raesList = Database.query(soql); |
| | | data.put('raesList', raesList); |
| | | if (raesList.size() > 0) { |
| | | res.msg = '共有' + raesList.size() + '个出库单'; |
| | | } else { |
| | | res.msg = '没有搜索到相关出库单。'; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC cleanUp(String accountid, String agencyProType, String userWorkLocation) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | // 获得显示数据 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += 'order by SummonsStatus_c__c'; |
| | | System.debug('soql = ' + soql); |
| | | raesList = Database.query(soql); |
| | | data.put('raesList', raesList); |
| | | if (raesList.size() > 0) { |
| | | res.msg = '共有' + raesList.size() + '个出库单'; |
| | | } else { |
| | | res.msg = '没有搜索到相关出库单。'; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSaleOrderController { |
| | | 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; } |
| | | @AuraEnabled |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { get; set; } |
| | | @AuraEnabled |
| | | 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; } |
| | | public static Map<String, String> orderpieceorboxMap { get; set; } |
| | | public static Map<String, Decimal> orderpriceMap { get; set; } |
| | | public static Map<String, Decimal> orderagencypriceMap { get; set; } |
| | | public static Map<String, Decimal> orderdetCountMap { get; set; } |
| | | public static Map<String, Integer> BarcodeCntMap { get; set; } |
| | | public static String baseUrl { get; private set; } |
| | | public static String ESetId { get; set; } |
| | | public static String accountName { get; set; } |
| | | public static String userWorkLocation { get; set; } |
| | | public static Boolean hasSpecialHos { get; set; } |
| | | public static Map<String, Integer> msiMap { get; set; } |
| | | public static List<Consumable_orderdetails__c> orderdetails { get; set; } |
| | | public static String accountid { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC GoodsDeliveryInit(String ESetId) { |
| | | System.debug('LexSaleOrderController GoodsDeliveryInit'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | String UserName = UserInfo.getUserId(); |
| | | 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]; |
| | | accountName = accountInfo.Name; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | coc = new Consumable_order__c(); |
| | | List<Consumable_order_details2__c> arriveDat = new List<Consumable_order_details2__c>(); |
| | | orderpieceorboxMap = new Map<String, String>(); |
| | | orderdetails = new List<Consumable_orderdetails__c>(); |
| | | orderagencypriceMap = new Map<String, Decimal>(); |
| | | orderpriceMap = new Map<String, Decimal>(); |
| | | orderdetCountMap = new Map<String, Decimal>(); |
| | | if (String.isNotBlank(ESetId)) { |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | NoConfirmedPrice__c, |
| | | Order_ForDealer__r.Name, |
| | | Summons_Order_type__c, |
| | | Order_status__c, |
| | | Dealer_Info__c, |
| | | Dealer_Info__r.Name, |
| | | SummonsStatus_c__c, |
| | | Deliver_date__c, |
| | | Order_Reason__c, |
| | | Order_date__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Arrive_Order__c, |
| | | Arrive_Order__r.IsShipment__c, |
| | | Outbound_Date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_ForCustomerText__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-16 |
| | | if (coc.Arrive_Order__c != null) { |
| | | arriveDat = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Guarantee_period_for_products__c, |
| | | Box_Piece__c, |
| | | // gzw add 20210308 报错修复 |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ]; |
| | | for (Integer j = 0; j < arriveDat.size(); j++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(arriveDat[j])); |
| | | } |
| | | } |
| | | |
| | | orderdetails = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_product__r.Name, |
| | | Shipment_Count__c, |
| | | Box_Piece__c, |
| | | Delivery_List_RMB__c, |
| | | Unitprice_To_agency__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | 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); |
| | | } |
| | | 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 |
| | | FROM hospitalprice__c |
| | | WHERE hospital__c = :coc.ShipmentAccount__c AND account__c = :accountid |
| | | ]; |
| | | if (hlist == null || hlist.size() == 0) { |
| | | hasSpecialHos = false; |
| | | } else { |
| | | hasSpecialHos = true; |
| | | } |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | data.put('coc', coc); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('accountid', accountid); |
| | | data.put('orderdetails', orderdetails); |
| | | data.put('orderpieceorboxMap', orderpieceorboxMap); |
| | | data.put('orderpriceMap', orderpriceMap); |
| | | data.put('orderagencypriceMap', orderagencypriceMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC SearchPro( |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountName, |
| | | String userWorkLocation, |
| | | String accountid, |
| | | List<Consumable_orderdetails__c> orderdetails, |
| | | Map<String, String> orderpieceorboxMap |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | coc = cocLwc; |
| | | orderdetails = orderdetails; |
| | | barcode = barcodeLwc; |
| | | accountName = accountName; |
| | | userWorkLocation = userWorkLocation; |
| | | accountid = accountid; |
| | | orderdetails = orderdetails; |
| | | orderpieceorboxMap = orderpieceorboxMap; |
| | | //判断是否和订单联动 |
| | | if (coc.Arrive_Order__c != null) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'无需到货确认,请直接出库。')); |
| | | // return; |
| | | return new ResponseBodyLWC('Error', 500, '无需到货确认,请直接出库', ''); |
| | | } |
| | | //判断barcode是否为空 |
| | | if (barcode == null || barcode == '') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输BarCode号。')); |
| | | // return; |
| | | return new ResponseBodyLWC('Error', 500, '请输BarCode号', ''); |
| | | } |
| | | list<String> exitlist = new List<String>(); |
| | | list<String> notexitlist = new List<String>(); |
| | | existIdMap = new Map<String, String>(); |
| | | errorIdMap = new Map<String, String>(); |
| | | allMap = new Map<String, String>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | List<String> barCodeListP = new List<String>(); |
| | | List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>(); |
| | | |
| | | //BarCodelist做成 |
| | | barCodeListP = ParseBarCode(barcode); |
| | | //针对所有商品到货确认 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | hospitalSpecialOffer__c, |
| | | exchangeOutPattern__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>(); |
| | | Set<Id> proIds = new Set<Id>(); |
| | | |
| | | for (String barcode : barCodeListP) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c cod2 : reSet1) { |
| | | if (cod2.Bar_Code__c == barcode) { |
| | | newdet2.add(cod2); |
| | | reSet1.remove(idx); |
| | | proIds.add(cod2.Consumable_product__c); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | 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]; |
| | | if (hpList != null && hpList.size() > 0) { |
| | | for (hospitalprice__c hp : hpList) { |
| | | 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) + '是', ''); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | for (Integer j = 0; j < newdet2.size(); j++) { |
| | | if ( |
| | | newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && |
| | | newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c |
| | | ) { |
| | | String 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) { |
| | | 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)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | //add by rentx 2021-03-22 end |
| | | |
| | | if (hpList != null && hpList.size() > 0) { |
| | | if (proHosMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | continue; |
| | | } else if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | continue; |
| | | } else { |
| | | String str = '该商品出库医院错误'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //管理编码为空时,报错 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND (TracingCode__c = NULL |
| | | OR TracingCode__c = '') |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该产品没有管理编码,无法出库,请与特约经销商管理部人员联系,修正数据'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Cancellation_Flag__c = TRUE |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经取消'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //不是本出库单的出库产品 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else if (!orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)) { |
| | | String str = '不是本出库单的出库产品'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Dealer_Info_text__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND ((Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | OR Dealer_Info_text__c != :accountName) |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | // 当前经销商是否存在此产品判断 |
| | | boolean containsFlg = false; |
| | | for (Consumable_order_details2__c cod2 : newdet2) { |
| | | if (cod2.Bar_Code__c == reSet1[i].Bar_Code__c) { |
| | | containsFlg = true; |
| | | break; |
| | | } |
| | | } |
| | | if (containsFlg == false) { |
| | | 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)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Saled__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经销售'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Shipment__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出库'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Lose_Flag__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经丢失'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | TracingCode__c, |
| | | Transfer_Time__c, |
| | | Frist_Transfer_Agency__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | //对应录入barcode数量的检索结果 |
| | | newdet2 = new List<Consumable_order_details2__c>(); |
| | | for (String barcode : barCodeListP) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c cod2 : reSet) { |
| | | if (cod2.Bar_Code__c == barcode) { |
| | | newdet2.add(cod2); |
| | | reSet.remove(idx); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | Map<String, String> checkBarcodeResult = new Map<String, String>(); |
| | | 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 ( |
| | | (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)); |
| | | 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)); |
| | | 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); |
| | | 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()) { |
| | | String str = '管理编码有误,请检查条形码数据。'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j],str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c,newdet2[j].Bar_Code__c); |
| | | continue; |
| | | } |
| | | } |
| | | // String str = '管理编码中有数字,请与管理员确认是否错误。'; |
| | | // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | // 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])); |
| | | 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 == '个') { |
| | | // 跳过超过数量的消耗品明细 |
| | | continue; |
| | | } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | //CHAN-C23BWX update by rentx 2021-04-28 start |
| | | // String str = '该商品超出订货数量'; |
| | | String str = '该产品超出出库单产品范围'; |
| | | //CHAN-C23BWX update by rentx 2021-04-28 end |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Dealer_Arrive__c = FALSE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND ((Consumable_order_minor__c != NULL |
| | | AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) |
| | | OR (Consumable_order_minor__c = NULL |
| | | AND Cancellation_Flag__c = FALSE)) |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品未到货确认'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | allMap.putAll(errorIdMap); |
| | | allMap.putAll(existIdMap); |
| | | //得到不存在的BarCode |
| | | for (Integer i = 0; i < barCodeListP.size(); i++) { |
| | | if (allMap.containsKey(barCodeListP[i])) { |
| | | continue; |
| | | } else { |
| | | exitlist.add(barCodeListP[i]); |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__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 |
| | | 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)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出货'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | allMap.putAll(errorIdMap); |
| | | for (Integer i = 0; i < barCodeListP.size(); i++) { |
| | | if (allMap.containsKey(barCodeListP[i])) { |
| | | continue; |
| | | } else { |
| | | notexitlist.add(barCodeListP[i]); |
| | | } |
| | | } |
| | | if (notexitlist.size() > 0) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode号'+ notexitlist + '不存在。')); |
| | | return new ResponseBodyLWC('Error', 500, 'BarCode号' + notexitlist + '不存在。', ''); |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 去的页面上的barcode,转换成List |
| | | public static List<String> ParseBarCode(String Code) { |
| | | String[] Cache = new List<String>{}; |
| | | Cache = Code.split('\n'); |
| | | List<String> Buff = new List<String>(); |
| | | for (String A : Cache) { |
| | | A = A.trim(); |
| | | Buff.add(A.toUpperCase()); |
| | | } |
| | | return Buff; |
| | | } |
| | | |
| | | // 出货 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC ProdElivery( |
| | | String ESetIdLwc, |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String consumableorderdetailsRecordsLwc, |
| | | List<Consumable_orderdetails__c> orderdetailsLwc, |
| | | Map<String, Decimal> orderpriceMapLwc, |
| | | Map<String, Decimal> orderagencypriceMapLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | ESetId = ESetIdLwc; |
| | | coc = cocLwc; |
| | | barcode = barcodeLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsLwc, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | orderdetails = orderdetailsLwc; |
| | | orderpriceMap = orderpriceMapLwc; |
| | | orderagencypriceMap = orderagencypriceMap; |
| | | BarcodeCntMap = new Map<String, Integer>(); |
| | | if (coc.Arrive_Order__r.IsShipment__c == true) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '订单已经出货')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '订单已经出货', ''); |
| | | } |
| | | |
| | | if (consumableorderdetailsRecords.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无出货明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '无出货明细', ''); |
| | | } |
| | | |
| | | Getconsumableorderdetails2Nobox(); |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | String key = '' + ass.orderdetails2.Bar_Code__c; |
| | | Integer deliverycnt = BarcodeCntMap.get(key); |
| | | if ( |
| | | ass.orderdetails2.Box_Piece__c == '个' && |
| | | (ass.outboundCount == null || |
| | | String.valueof(ass.outboundCount) == '' || |
| | | ass.outboundCount <= 0) |
| | | ) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量')); |
| | | // return null; |
| | | 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 + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | 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) { |
| | | a = a + ass.outboundCount; |
| | | } |
| | | } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+a)); |
| | | |
| | | 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 + '数量小于出货数量', ''); |
| | | } 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 + '超出出货数量', ''); |
| | | } |
| | | } |
| | | List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | List<Consumable_orderdetails__c> orderdetails1List = [ |
| | | SELECT Id, Used_date__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | | } |
| | | //coc.Order_type__c = '出货'; |
| | | coc.RecordTypeId = System.Label.RT_ConOrder_Shipment; |
| | | // update start by vivek 2019-7-15 |
| | | // coc.SummonsStatus_c__c = '已完成'; |
| | | if (coc.NoConfirmedPrice__c) { |
| | | coc.SummonsStatus_c__c = '价格未定'; |
| | | } else { |
| | | coc.SummonsStatus_c__c = '已完成'; |
| | | } |
| | | // update start by vivek 2019-7-15 |
| | | coc.Outbound_Date__c = Date.today(); |
| | | update coc; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | 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.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 |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | 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; |
| | | } |
| | | cnt++; |
| | | Ins.add(insDetails); |
| | | if (cnt > ass.outboundCount) |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | insDetails.Id = ass.orderdetails2.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.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 |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | 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; |
| | | } |
| | | Ins.add(insDetails); |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | ControllerUtil.updateOrderDetailsSatus(Ins); |
| | | } |
| | | if (coc.Arrive_Order__c != null) { |
| | | Consumable_order__c OrderUps = new Consumable_order__c(); |
| | | OrderUps.Id = coc.Arrive_Order__c; |
| | | OrderUps.IsShipment__c = true; |
| | | update OrderUps; |
| | | } |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | return new ResponseBodyLWC('Error', 500, ex.getMessage(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 销售 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC ProSale( |
| | | String ESetIdLwc, |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String consumableorderdetailsRecordsLwc, |
| | | List<Consumable_orderdetails__c> orderdetailsLwc, |
| | | Map<String, Decimal> orderpriceMapLwc, |
| | | Map<String, Decimal> orderagencypriceMapLwc |
| | | ) { |
| | | System.debug('enter ProSale'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | ESetId = ESetIdLwc; |
| | | coc = cocLwc; |
| | | barcode = barcodeLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsLwc, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | orderdetails = orderdetailsLwc; |
| | | orderpriceMap = orderpriceMapLwc; |
| | | orderagencypriceMap = orderagencypriceMapLwc; |
| | | System.debug('ESetId = ' + ESetId); |
| | | System.debug('coc = ' + coc); |
| | | System.debug('barcode = ' + barcode); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug('consumableorderdetailsRecords = ' + consumableorderdetailsRecords); |
| | | System.debug('orderdetails = ' + orderdetails); |
| | | System.debug('orderpriceMap = ' + orderpriceMap); |
| | | System.debug('orderagencypriceMap = ' + orderagencypriceMap); |
| | | BarcodeCntMap = new Map<String, Integer>(); |
| | | |
| | | if (consumableorderdetailsRecords.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无销售明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '无销售明细', ''); |
| | | } |
| | | if (coc.Arrive_Order__r.IsShipment__c == true) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '订单已经销售')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '订单已经销售', ''); |
| | | } |
| | | Getconsumableorderdetails2Nobox(); |
| | | |
| | | System.debug('BarcodeCntMap = ' + BarcodeCntMap); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | String key = '' + ass.orderdetails2.Bar_Code__c; |
| | | Integer deliverycnt = BarcodeCntMap.get(key); |
| | | if (ass.orderdetails2.Box_Piece__c == '个' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) { |
| | | // 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.outboundCount = ' + ass.outboundCount); |
| | | 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 + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | 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) { |
| | | 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 + '数量小于出货数量', ''); |
| | | } 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 + '超出出货数量', ''); |
| | | } |
| | | } |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | List<Consumable_orderdetails__c> orderdetails1List = [ |
| | | SELECT Id, Used_date__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | | } |
| | | //coc.Order_type__c = '销售'; |
| | | coc.RecordTypeId = System.Label.RT_ConOrder_Sale; |
| | | // update start by vivek 2019-7-15 |
| | | // coc.SummonsStatus_c__c = '已完成'; |
| | | if (coc.NoConfirmedPrice__c) { |
| | | coc.SummonsStatus_c__c = '价格未定'; |
| | | } else { |
| | | coc.SummonsStatus_c__c = '已完成'; |
| | | } |
| | | // update start by vivek 2019-7-15 |
| | | coc.Outbound_Date__c = Date.today(); |
| | | update coc; |
| | | //销售明细 |
| | | List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>(); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | 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_Shipment_order__c = null; |
| | | 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.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | | insDetails.Consumable_Sale_order__c = ESetId; |
| | | cnt++; |
| | | Ins.add(insDetails); |
| | | if (cnt > ass.outboundCount) |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | insDetails.Id = ass.orderdetails2.Id; |
| | | insDetails.Consumable_Shipment_order__c = null; |
| | | 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.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | | insDetails.Consumable_Sale_order__c = ESetId; |
| | | Ins.add(insDetails); |
| | | } |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableorderdetails2Nobox +++'+consumableorderdetails2Nobox.size())); |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Ins +++'+Ins)); |
| | | //return null; |
| | | if (Ins.size() > 0) { |
| | | ControllerUtil.updateOrderDetailsSatus(Ins); |
| | | } |
| | | if (coc.Arrive_Order__c != null) { |
| | | Consumable_order__c orderUps = new Consumable_order__c(); |
| | | orderUps.Id = coc.Arrive_Order__c; |
| | | orderUps.IsShipment__c = true; |
| | | update orderUps; |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static integer Getconsumableorderdetails2Nobox() { |
| | | if (String.isBlank(barcode)) { |
| | | return 0; |
| | | } |
| | | List<String> barCodeListP = ParseBarCode(barcode); |
| | | consumableorderdetails2Nobox = new List<Consumable_order_details2__c>(); |
| | | BarcodeCntMap.clear(); |
| | | consumableorderdetails2Nobox = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | |
| | | AggregateResult[] results = [ |
| | | SELECT Bar_Code__c, count(Id) recordCount |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | GROUP BY Bar_Code__c |
| | | ]; |
| | | |
| | | for (AggregateResult ar : results) { |
| | | String key = '' + ar.get('Bar_Code__c'); |
| | | BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount'))); |
| | | } |
| | | return consumableorderdetails2Nobox.size(); |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public String oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public String ErrorReason { get; set; } |
| | | @AuraEnabled |
| | | public Decimal outboundCount { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) { |
| | | orderdetails1 = new Consumable_orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails1 = new Consumable_orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | if (e.Box_Piece__c == '盒') { |
| | | outboundCount = 1; |
| | | } |
| | | oldConsumableCount = e.name; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | outboundCount = e.Shipment_Count__c; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSearchContractController { |
| | | private static Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | |
| | | @AuraEnabled |
| | | public static Results init(String ctype){ |
| | | Results results = new Results(); |
| | | try { |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | User useracc = [SELECT accountid,OSHFLG__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | OSHFLG = Useracc.OSHFLG__c; //lt 20230517 安徽两票制 add; |
| | | String accountId = Useracc.accountid; |
| | | List<Account> attList = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c, |
| | | Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c |
| | | FROM Account |
| | | WHERE ParentId = :accountId |
| | | AND Contact_Type__c like :ctype |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Secondary_contract__c = false |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | results.attList = attList; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchContract(String searchName, String accountId, String ctype, Boolean OSHFLGStr){ |
| | | Results results = new Results(); |
| | | OSHFLG = OSHFLGStr; |
| | | try { |
| | | results.attList = Database.query(makeSoql(searchName,Date.today(),accountId,ctype)); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | private static String makeSoql(String CateName,Date timetest,String accountId, String ctype){ |
| | | |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,'; |
| | | soql += ' Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c,OSH_Dealer__c FROM Account'; |
| | | soql += ' where ParentId = \'' + accountId + '\'' ; |
| | | soql += ' AND OSH_Dealer__c = ' + OSHFLG + '' ; //lt 20230517 安徽两票制 add |
| | | soql += ' AND Secondary_contract__c = false' ; |
| | | soql += ' AND Contact_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\''; |
| | | soql += ' AND Contract_Decide_Start_Date__c <=' + String.valueOf(timetest).substring(0, 10); |
| | | soql += ' AND Contract_Decide_End_Date__c >= ' + String.valueOf(timetest).substring(0, 10); |
| | | if(!String.isBlank(CateName)){ |
| | | soql += ' AND Name like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\''; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<Account> attList; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSearchHospitalController { |
| | | |
| | | @AuraEnabled |
| | | public static Results init(){ |
| | | Results results = new Results(); |
| | | try { |
| | | User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | String accountId = Useracc.accountid; |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ; |
| | | soql += ' order by Name desc limit 100'; |
| | | results.attList = Database.query(soql); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchHospital(String searchName, String accountId){ |
| | | Results results = new Results(); |
| | | try { |
| | | results.attList = Database.query(makeSoql(searchName, accountId)); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | private static String makeSoql(String searchName,String accountId){ |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ; |
| | | if(String.isNotBlank(searchName)){ |
| | | soql += ' AND Name like \'%' + searchName+ '%\''; |
| | | } |
| | | soql += ' order by Name desc limit 100'; |
| | | return soql; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<Account> attList; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSummonsCreatController { |
| | | public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); |
| | | |
| | | /*****************検索用******************/ |
| | | //经销商用户产品分类(ET、ENG) |
| | | @AuraEnabled |
| | | public static String agencyProType { get; set; } |
| | | public static Consumable_order__c coc { get; set; } // 画view用, 可能是 出库指示单, 也有可能是到货单, 也有可能 空instance |
| | | public static User localuser { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | //public String category_Goods {get ; set;} |
| | | public static Boolean cansee { get; set; } |
| | | public static Integer size { get; set; } |
| | | //经销商定价查看权限 |
| | | //public static ApexPages.StandardSetController setCon { get; set; } |
| | | public static Boolean dealerPricesee { get; set; } |
| | | /*****************画面初始化用********************************/ |
| | | /******20160313_add**************/ |
| | | public static String IdCheck { get; set; } |
| | | public static Boolean editAble { get; set; } |
| | | public static String statusEdit { get; set; } |
| | | public static String alertMessage { get; set; } |
| | | public static String SearchDone { get; set; } |
| | | public static List<String> zaikuId = new List<String>(); |
| | | public static List<String> orderzaikuId = new List<String>(); |
| | | //附件 |
| | | public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; } |
| | | public static Boolean getExistarrive() { |
| | | return (coc.Arrive_Order__c != null); |
| | | } |
| | | //总价格计算结果 |
| | | @AuraEnabled |
| | | public static Decimal sumPrice { get; set; } |
| | | /******20160317_add**************/ |
| | | public static String SummonsFlag { get; set; } // 新規: hidden, 更新: visible |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> categoryOptionMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category4OptionMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category5OptionMap { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //明细2 |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | //错误明细 |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; } |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> pageRecords { get; set; } |
| | | public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; } |
| | | //public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetails2Records { get; set; } |
| | | public static List<Consumable_order__c> consumableInvoiceRecords { get; set; } |
| | | private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | private static List<Attachment> attachmentinfo = new List<Attachment>(); |
| | | public static List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | @AuraEnabled |
| | | public static Map<String, String> orderpieceorboxMap { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_orderdetails__c> orderdetails { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderagencypriceMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderpriceMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderdetCountMap { get; set; } |
| | | @AuraEnabled |
| | | public static Boolean hasSpecialHos { get; set; } |
| | | //选择产品size |
| | | public static Integer consumableorderdetailsCount { |
| | | get { |
| | | return pageRecords == null ? 0 : pageRecords.size(); |
| | | } |
| | | } |
| | | //消耗品明细2数量 |
| | | public static Integer consumableorderdetails2Count { |
| | | get { |
| | | return consumableorderdetails2Records == null ? 0 : consumableorderdetails2Records.size(); |
| | | } |
| | | } |
| | | //订货单号 |
| | | public static String consumableorderId { |
| | | get { |
| | | return (coc.Arrive_Order__c); |
| | | } |
| | | } |
| | | //选择框 |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> provinceOptsMap { get; set; } |
| | | public static String SecondDealer { get; set; } |
| | | //public List<SelectOption> orderForHospitalOpts { get; set; } |
| | | public static String HospitalInfo { get; set; } |
| | | public static String HospitalName { get; set; } |
| | | |
| | | public static Boolean EditDelCommitBtnDisabled { get; private set; } |
| | | public static Boolean saveBtnDisabled { get; private set; } |
| | | public static Boolean SorderBtnDisabled { get; private set; } |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | //public static String sortField { get; set; } |
| | | //public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | public static Integer addSize { get; set; } |
| | | //List<ConsumableorderdetailsInfoLwc> reSetLwc |
| | | public static List<ConsumableorderdetailsInfo> addData { get; set; } |
| | | public static Map<String, String> skipData { get; set; } |
| | | // 保存后动作: 1.检索 2.排序 |
| | | // public static String sortKey { get; set; } |
| | | // public static String preSortKey { get; private set; } |
| | | // public static Boolean sortOrderAsc { get; private set; } |
| | | // public static String[] sortOrder { get; private set; } |
| | | // private static String[] columus = new List<String>{ |
| | | // 'Consumable_Product__r.Name', |
| | | // 'Consumable_Product__r.Asset_Model_No__c', |
| | | // 'Consumable_Product__r.Intra_Trade_List_RMB__c', |
| | | // '', |
| | | // '', |
| | | // 'Consumable_Product__r.Category3__c', |
| | | // 'Consumable_Product__r.Category4__c', |
| | | // 'Consumable_Product__r.Category5__c' |
| | | // }; |
| | | // private static String[] columus_no = new List<String>{ |
| | | // 'Product2__c.Name', |
| | | // 'Product2__c.Asset_Model_No__c', |
| | | // 'Product2__c.Intra_Trade_List_RMB__c', |
| | | // '', |
| | | // '', |
| | | // 'Category3__c', |
| | | // 'Category4__c', |
| | | // 'Category5__c' |
| | | // }; |
| | | |
| | | //到货单明细1 |
| | | private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>(); |
| | | //到货单明细2 |
| | | private static List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = new List<Consumable_order_details2__c>(); |
| | | |
| | | //出库单明细2 |
| | | private static List<Consumable_order_details2__c> consumableorderdetails2RecordsList = new List<Consumable_order_details2__c>(); |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | //private String cate1ForSort = null; |
| | | private static String accountid = null; |
| | | @AuraEnabled |
| | | public static String accountName { get; set; } |
| | | |
| | | // 产品 ID |
| | | private static String ESetId = ''; |
| | | @AuraEnabled |
| | | public static String arriveorder { get; set; } |
| | | private static String userId = ''; |
| | | //private String[] ProidListAll = new String[]{}; |
| | | |
| | | // 登录者工作地 |
| | | @AuraEnabled |
| | | public static String userWorkLocation { get; set; } |
| | | |
| | | //add by rentx 2021-01-29 |
| | | public static List<SelectOption> outOutPatternOptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> outOutPatternOptionMap { get; set; } |
| | | public static String outOutPattern { get; set; } |
| | | public static Boolean hasHos { get; set; } |
| | | @AuraEnabled |
| | | public static Boolean hasHosPro { get; set; } |
| | | |
| | | private static Map<String, String> HosProMap = new Map<String, String>(); |
| | | //add by rentx 2021-01-29 |
| | | |
| | | public LexSummonsCreatController() { |
| | | System.debug('LexSummonsCreatController'); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | // ESetId = ApexPages.currentPage().getParameters().get('esetId'); |
| | | // arriveorder = ApexPages.currentPage().getParameters().get('arriveorder'); |
| | | // statusEdit = ApexPages.currentPage().getParameters().get('KeyWords'); |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInvoiceRecords = new List<Consumable_order__c>(); |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | outOutPatternOptionMap = new Map<String, String>(); |
| | | outOutPatternOptionMap.put('', '-无-'); |
| | | outOutPatternOptionMap.put('ishos', '医院特价产品'); |
| | | outOutPatternOptionMap.put('nothos', '非医院特价产品'); |
| | | |
| | | outOutPatternOptionList.add(new SelectOption('', '-无-')); |
| | | outOutPatternOptionList.add(new SelectOption('ishos', '医院特价产品')); |
| | | outOutPatternOptionList.add(new SelectOption('nothos', '非医院特价产品')); |
| | | HospitalName = ''; |
| | | } |
| | | |
| | | public static void firstInit(String ESetidJs) { |
| | | System.debug('enter firstInit'); |
| | | ESetid = ESetidJs; |
| | | System.debug('ESetid = ' + ESetid); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInvoiceRecords = new List<Consumable_order__c>(); |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | outOutPatternOptionMap = new Map<String, String>(); |
| | | outOutPatternOptionMap.put('', '-无-'); |
| | | outOutPatternOptionMap.put('ishos', '医院特价产品'); |
| | | outOutPatternOptionMap.put('nothos', '非医院特价产品'); |
| | | |
| | | // outOutPatternOptionList.add(new SelectOption('', '-无-')); |
| | | // outOutPatternOptionList.add(new SelectOption('ishos', '医院特价产品')); |
| | | // outOutPatternOptionList.add(new SelectOption('nothos', '非医院特价产品')); |
| | | HospitalName = ''; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) { |
| | | // try { |
| | | firstInit(ESetidJs); |
| | | statusEdit = statusEdit; |
| | | arriveorder = ''; |
| | | HospitalName = ''; |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | // public static Integer pagesize { get; set; } |
| | | // public static Integer pageToken { get; set; } |
| | | // public static String sortField { get; set; } |
| | | // public static String sortOrder { get; set; } |
| | | pagesize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | |
| | | // sortKey = '1'; |
| | | // preSortKey = '1'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | //cate1ForSort = ''; |
| | | sumPrice = 0; |
| | | IdCheck = EsetId; |
| | | if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = false; |
| | | } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()]; |
| | | //userId = '00510000005QO75'; |
| | | user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | accountid = Useracc.accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.Name; |
| | | //coc.Order_date__c = Date.today(); |
| | | list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>(); |
| | | Dealerelationship = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__c = :accountid |
| | | ]; |
| | | |
| | | List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>(); |
| | | AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid]; |
| | | |
| | | //add by rentx 2021-3-1 start |
| | | //判断当前经销商下是否有特价医院 |
| | | List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hlist == null || hlist.size() == 0) { |
| | | hasHos = false; |
| | | } else { |
| | | for (hospitalprice__c hp : hlist) { |
| | | HosProMap.put(hp.product__c, ''); |
| | | } |
| | | hasHos = true; |
| | | } |
| | | //add by rentx 2021-3-1 end |
| | | |
| | | saveBtnDisabled = false; |
| | | SorderBtnDisabled = false; |
| | | String sqlagencyProType = '%' + agencyProType + '%'; |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //add by rentx 2021-01-29 |
| | | Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //add by rentx 2021-01-29 |
| | | |
| | | List<AggregateResult> orderdetailCount = [ |
| | | SELECT count(id), Consumable_Product__c cpc, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | GROUP BY Consumable_Product__c, Box_Piece__c |
| | | ]; |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | | System.debug('sqlagencyProType = ' + sqlagencyProType); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug('accountName = ' + accountName); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx 2020-11-27 start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx 2020-11-27 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | // 新規 |
| | | if (ESetId == null || ESetId == '') { |
| | | SummonsFlag = 'hidden'; |
| | | String msoql = makeSoqlinventory(); |
| | | initStandardController(msoql); |
| | | System.debug('msoql = ' + msoql); |
| | | product2Selected = Database.query(msoql); |
| | | if (String.isBlank(arriveorder)) { |
| | | EditDelCommitBtnDisabled = true; |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | System.debug('MidMap2.size() = ' + MidMap2.size()); |
| | | /*//然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage); |
| | | }*/ |
| | | } |
| | | |
| | | //update by rentx 2021-01-29 end |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | //if(bss.allnumber>0){ |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | //add by rentx 2021-3-10 |
| | | if (ass.hospitalSpecialOffer) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords1'); |
| | | makepagerecords(); |
| | | //listCut(); |
| | | } else { |
| | | if (statusEdit == '' || statusEdit == null) { |
| | | editAble = false; |
| | | } else if (statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | // upadte start by vivek 2019-7-15 |
| | | // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c, |
| | | // Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c, |
| | | // Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c, |
| | | // Order_status__c,Shipment_total_amount__c,Offers_Price__c, |
| | | // Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c |
| | | // FROM Consumable_order__c |
| | | // WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation |
| | | // AND recordtypeid = :System.Label.RT_ConOrder_Arrive]; |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Summons_Order_type__c, |
| | | NoConfirmedPrice__c, |
| | | SummonsStatus_c__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForDealerTextID__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Order_date__c, |
| | | Arrive_Order__c, |
| | | Order_status__c, |
| | | Shipment_total_amount__c, |
| | | Offers_Price__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | Order_ForCustomerText__c, |
| | | ConInvoice_Code__c, |
| | | Onchange_order__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE |
| | | Id = :arriveorder |
| | | AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | AND recordtypeid = :System.Label.RT_ConOrder_Arrive |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | //明细1获取 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Sum_of_money__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_count__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | InvoiceProNot_count__c, |
| | | //Unitprice_To_agency__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :coc.Arrive_Order__c |
| | | ORDER BY Name |
| | | ]; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | } |
| | | msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | /*for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | |
| | | }*/ |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size())); |
| | | //return; |
| | | |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | cdc1.Shipment_Count__c = cdc1.Consumable_count__c; |
| | | if (ass.prod.Id == cdc1.Consumable_Product__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | } |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords2'); |
| | | makepagerecords(); |
| | | consumablearriveproductdetailsSelected = [ |
| | | 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.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__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, |
| | | Delivery_List_RMB__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Consumable_order_minor__c = :coc.Arrive_Order__c |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = TRUE |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | if ( |
| | | consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c && |
| | | HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c) |
| | | ) { |
| | | coc.OutPattern__c = true; |
| | | } |
| | | consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } |
| | | } else { |
| | | // 更新、 |
| | | SummonsFlag = 'visible'; |
| | | // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select |
| | | consumableInvoiceRecords = [ |
| | | SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c |
| | | FROM Consumable_order__c |
| | | WHERE |
| | | Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId) |
| | | AND Invoice_status__c != '草案中' |
| | | ]; |
| | | |
| | | System.debug('coc ESetId = ' + ESetId); |
| | | System.debug('coc userWorkLocation = ' + userWorkLocation); |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Summons_Order_type__c, |
| | | NoConfirmedPrice__c, |
| | | SummonsStatus_c__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForDealerTextID__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Order_date__c, |
| | | Arrive_Order__c, |
| | | Order_status__c, |
| | | Shipment_total_amount__c, |
| | | Offers_Price__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | Order_ForCustomerText__c, |
| | | ConInvoice_Code__c, |
| | | Onchange_order__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票' |
| | | ]; |
| | | // update start by vivek 2019-7-15 |
| | | if (getExistarrive()) { |
| | | arriveorder = coc.Arrive_Order__c; |
| | | } |
| | | // 到货订单来的时候 |
| | | if (getExistarrive()) { |
| | | if (editAble) { |
| | | alertMessage = '到货订单直接出库,出库单明细不可编辑'; |
| | | } |
| | | if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') { |
| | | system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c); |
| | | saveBtnDisabled = true; |
| | | SorderBtnDisabled = true; |
| | | EditDelCommitBtnDisabled = false; |
| | | } |
| | | //医院二级经销商分类 |
| | | Integer io = 0; |
| | | while (io < Dealerelationship.size()) { |
| | | if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) { |
| | | SecondDealer = Dealerelationship[io].Dealer_subordinate__c; |
| | | coc.Order_ForDealer__c = null; |
| | | io = io + Dealerelationship.size(); |
| | | } |
| | | io++; |
| | | } |
| | | |
| | | Integer ik = 0; |
| | | while (ik < AgencyHospitalLink.size()) { |
| | | if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) { |
| | | HospitalInfo = AgencyHospitalLink[ik].Hospital__c; |
| | | HospitalName = AgencyHospitalLink[ik].Hospital__r.Name; |
| | | coc.Order_ForHospital__c = null; |
| | | ik = ik + AgencyHospitalLink.size(); |
| | | } |
| | | ik++; |
| | | } |
| | | //出库单明细1取得 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Shipment_amount__c, |
| | | //Unitprice_To_agency__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | InvoiceProNot_count__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Shipment_amount__c; |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | //add by rentx 2021-2-26 |
| | | String tempId = cdc1.Consumable_product__c; |
| | | if (cdc1.isOutPattern__c) { |
| | | cocMap.put(tempId + 'ishos', cdc1); |
| | | } else { |
| | | cocMap.put(tempId + 'nothos', cdc1); |
| | | } |
| | | //add by rentx 2021-2-26 |
| | | } |
| | | String msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | /*for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | }*/ |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | |
| | | //if(bss.allnumber > 0){ |
| | | //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format(); |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | |
| | | //update by rentx 2021-2-26 start |
| | | if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | //update by rentx 2021-2-26 end |
| | | // consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | //update by rentx 2012-3-1 start |
| | | // if(ass.prod.Id == cdc1.Consumable_Product__c){ |
| | | // ass.check = true; |
| | | // ass.orderdetails1 = cdc1; |
| | | // } |
| | | if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | //update by rentx 2012-3-1 end |
| | | } |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords3'); |
| | | makepagerecords(); |
| | | //listCut(); |
| | | // 消耗品明细2を取得 |
| | | consumableorderdetails2RecordsList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SerialLotNo__c, |
| | | Consumable_Product__r.Name__c, |
| | | TracingCode__c, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Return_date__c, |
| | | Invoice_Date__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) { |
| | | consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i])); |
| | | } |
| | | //产品明细取得 |
| | | consumablearriveproductdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Name, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } else { |
| | | // 不是到货订单来的时候 |
| | | if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') { |
| | | system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c); |
| | | saveBtnDisabled = true; |
| | | SorderBtnDisabled = true; |
| | | EditDelCommitBtnDisabled = false; |
| | | } |
| | | //医院二级经销商分类 |
| | | Integer io = 0; |
| | | while (io < Dealerelationship.size()) { |
| | | if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) { |
| | | SecondDealer = Dealerelationship[io].Dealer_subordinate__c; |
| | | coc.Order_ForDealer__c = null; |
| | | io = io + Dealerelationship.size(); |
| | | } |
| | | io++; |
| | | } |
| | | Integer ik = 0; |
| | | while (ik < AgencyHospitalLink.size()) { |
| | | if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) { |
| | | HospitalInfo = AgencyHospitalLink[ik].Hospital__c; |
| | | HospitalName = AgencyHospitalLink[ik].Hospital__r.Name; |
| | | coc.Order_ForHospital__c = null; |
| | | ik = ik + AgencyHospitalLink.size(); |
| | | } |
| | | ik++; |
| | | } |
| | | // 消耗品明细1を取得 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_amount__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | //Unitprice_To_agency__c, |
| | | InvoiceProNot_count__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | //add by rentx 202-2-26 |
| | | Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Shipment_amount__c; |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | //add by rentx 2021-2-26 |
| | | String tempId = cdc1.Consumable_product__c; |
| | | if (cdc1.isOutPattern__c) { |
| | | cocMap.put(tempId + 'ishos', cdc1); |
| | | } else { |
| | | cocMap.put(tempId + 'nothos', cdc1); |
| | | } |
| | | //add by rentx 2021-2-26 |
| | | } |
| | | |
| | | String msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | |
| | | //if(bss.allnumber>0){ |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | |
| | | //update by rentx 2021-2-26 start |
| | | if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | // consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | // return null; |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | //update by rentx 2012-3-1 start |
| | | // if(ass.prod.Id == cdc1.Consumable_Product__c){ |
| | | // ass.check = true; |
| | | // ass.orderdetails1 = cdc1; |
| | | // } |
| | | if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | //update by rentx 2012-3-1 end |
| | | } |
| | | |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords4'); |
| | | makepagerecords(); |
| | | |
| | | // 消耗品明细2を取得 |
| | | consumableorderdetails2RecordsList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SerialLotNo__c, |
| | | Consumable_Product__r.Name__c, |
| | | TracingCode__c, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Return_date__c, |
| | | Invoice_Date__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) { |
| | | consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i])); |
| | | } |
| | | } |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer)); |
| | | if (SecondDealer == null || SecondDealer == '') { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } else { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe(); |
| | | cansee = dfr.isAccessible(); |
| | | Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe(); |
| | | dealerPricesee = dealerPrice.isAccessible(); |
| | | // 显示数据条数信息 |
| | | // makeMessage(); |
| | | //附件 |
| | | attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId]; |
| | | if (attachmentinfo.size() > 0) { |
| | | for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | } |
| | | } |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | |
| | | categoryOptionList = new List<SelectOption>(); |
| | | categoryOptionList.add(new SelectOption('', '-无-')); |
| | | categoryOptionMap = new Map<String, String>(); |
| | | categoryOptionMap.put('', '-无-'); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | categoryOptionMap.put(deliverycnt, deliverycnt); |
| | | } |
| | | |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | /*for(AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4)); |
| | | }*/ |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = pageRecords.size(); |
| | | System.debug('pageToken = ' + pageToken); |
| | | System.debug('pageSize = ' + pageSize); |
| | | System.debug('totalCount = ' + totalCount); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken); |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>(); |
| | | if (endIdx > pageRecords.size()) { |
| | | endIdx = pageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecordsTemp.add(pageRecords.get(i)); |
| | | } |
| | | |
| | | Boolean Existarrive = (coc.Arrive_Order__c != null); |
| | | String ConsumableOut_report = System.Label.ConsumableOut_report; |
| | | System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords); |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('ConsumableOut_report', ConsumableOut_report); |
| | | data.put('accountid', accountid); |
| | | data.put('consumableproductdetailsRecords', consumableproductdetailsRecords); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('categoryOptionMap', categoryOptionMap); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | data.put('outOutPatternOptionMap', outOutPatternOptionMap); |
| | | data.put('hasHosPro', hasHosPro); |
| | | data.put('Existarrive', Existarrive); |
| | | data.put('sumPrice', sumPrice); |
| | | data.put('HospitalName', HospitalName); |
| | | data.put('provinceOptsMap', provinceOptsMap); |
| | | data.put('SummonsFlag', SummonsFlag); |
| | | data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled); |
| | | data.put('EditAble', EditAble); |
| | | data.put('coc', coc); |
| | | data.put('pageRecords', pageRecordsTemp); |
| | | data.put('arriveorder', arriveorder); |
| | | data.put('consumableorderdetails2Count', consumableorderdetails2Count); |
| | | data.put('consumableorderdetails2Records', consumableorderdetails2Records); |
| | | data.put('HospitalInfo', HospitalInfo); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // } catch (Exception e) { |
| | | // return new ResponseBodyLWC('Error',500, e.getMessage(), ''); |
| | | // } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryAllload(String category3Lwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | category3 = category3Lwc; |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryload(String category3Lwc, String category4Lwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | category3 = category3Lwc; |
| | | category4 = category4Lwc; |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c = :category4 AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String agencyProTypeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String outOutPattern, |
| | | String category1, |
| | | String category3, |
| | | String category4, |
| | | String category5, |
| | | Boolean editAbleLwc, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc, |
| | | List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc, |
| | | String arriveorderLwc, |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC |
| | | ) { |
| | | consumableproductdetailsRecords = consumableproductdetailsRecordsLwc; |
| | | pageRecordsLwc = pageRecordsLwcLwc; |
| | | System.debug('pageRecordsLwc = ' + pageRecordsLwc); |
| | | arriveorder = arriveorderLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | product2Selected = new List<Product2__c>(); |
| | | pagesize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | addSize = 0; |
| | | addData = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('start addData = ' + addData); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | String sqlagencyProType = '%' + agencyProTypeLwc + '%'; |
| | | List<AggregateResult> orderdetailCount = [ |
| | | SELECT count(id), Consumable_Product__c cpc, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountNameLwc |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc |
| | | GROUP BY Consumable_Product__c, Box_Piece__c |
| | | ]; |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | | editAble = editAbleLwc; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | SearchDone = 'SearchDone'; |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //update by rentx 2021-01-29 |
| | | Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>(); |
| | | String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Dealer_Shipment__c = false AND Dealer_Saled__c = false AND Dealer_Returned__c = false AND Lose_Flag__c = false AND Bar_Code__c != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c = :userWorkLocation AND Dealer_Info_text__c = :accountName '; |
| | | if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) { |
| | | countdelSoql += ' AND hospitalSpecialOffer__c = true'; |
| | | } else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) { |
| | | countdelSoql += ' AND hospitalSpecialOffer__c = false'; |
| | | } |
| | | System.debug('countdelSoql = ' + countdelSoql); |
| | | List<Consumable_order_details2__c> CountDel = Database.query(countdelSoql); |
| | | System.debug('CountDel = ' + CountDel); |
| | | //update by rentx 2021-01-29 |
| | | |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //consumableorderdetailsSelectRecords = reSet; |
| | | String soql = makeSoql(category1, category3, category4, category5); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(soql); |
| | | System.debug('soql = ' + soql); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | Integer ishosnum = 0; |
| | | System.debug('MidMap2 = ' + MidMap2); |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | bss.sortBy = false; |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | |
| | | if (bss.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | makepagerecordsLwc(); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = pageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | System.debug('addSize = ' + addSize); |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>(); |
| | | if (endIdx > pageRecords.size()) { |
| | | endIdx = pageRecords.size(); |
| | | } |
| | | |
| | | System.debug('addData.size() = ' + addData.size()); |
| | | for (ConsumableorderdetailsInfo ci : addData) { |
| | | pageRecordsTemp.add(ci); |
| | | } |
| | | System.debug('startIdx = ' + startIdx); |
| | | System.debug('endIdx = ' + endIdx); |
| | | System.debug('skipData = ' + skipData); |
| | | System.debug('pageRecords = ' + pageRecords.size()); |
| | | String hos = ''; |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | System.debug('skipData.get(pageRecords.get(i).Prod.Id) = ' + skipData.get(pageRecords.get(i).Prod.Id)); |
| | | if (pageRecords.get(i).hospitalSpecialOffer == true) { |
| | | hos = 'ishos'; |
| | | } else { |
| | | hos = 'nothos'; |
| | | } |
| | | if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) { |
| | | pageRecordsTemp.add(pageRecords.get(i)); |
| | | } |
| | | } |
| | | |
| | | System.debug('pageRecordsTemp = ' + pageRecordsTemp.size()); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageRecords', pageRecordsTemp); |
| | | data.put('SearchDone', SearchDone); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql(String CateName, String Category3, String Category4, String Category5) { |
| | | String sqlTail1 = '(\''; |
| | | for (Integer i = 0; i < zaikuId.size(); i++) { |
| | | if (zaikuId[i] != null) { |
| | | if (i < zaikuId.size() - 1) { |
| | | sqlTail1 += zaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail1 += zaikuId[i]; |
| | | } |
| | | } |
| | | } |
| | | sqlTail1 += '\')'; |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | soql += ' WHERE Id in' + sqlTail1; |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | public static String makeSoqlorderdet() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderzaikuId.size(); i++) { |
| | | if (i < orderzaikuId.size() - 1) { |
| | | sqlTail += orderzaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderzaikuId[i]; |
| | | } |
| | | } |
| | | sqlTail += '\')'; |
| | | String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | msoql += ' WHERE Id in' + sqlTail; |
| | | return msoql; |
| | | } |
| | | |
| | | public static String makeSoqlinventory() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < zaikuId.size(); i++) { |
| | | if (zaikuId[i] != null) { |
| | | if (i < zaikuId.size() - 1) { |
| | | sqlTail += zaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += zaikuId[i]; |
| | | } |
| | | } |
| | | } |
| | | sqlTail += '\')'; |
| | | String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | msoql += ' WHERE Id in' + sqlTail; |
| | | return msoql; |
| | | } |
| | | |
| | | public static void initStandardController(String soql) { |
| | | // init standard controller |
| | | System.debug('soql =' + soql); |
| | | System.debug('initStandardController star'); |
| | | //setCon = new ApexPages.StandardSetController(Database.getQueryLocator(soql)); |
| | | // sets the number of records in each page set |
| | | //setCon.setPageSize(size); |
| | | System.debug('initStandardController end'); |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecords() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | System.debug('zhj1'); |
| | | //取出选择的产品 |
| | | if (pageRecords != null) { |
| | | System.debug('zhj2'); |
| | | for (ConsumableorderdetailsInfo ass : pageRecords) { |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | } else { |
| | | selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | } |
| | | reSet.add(ass); |
| | | } |
| | | } |
| | | } |
| | | System.debug('zhj3'); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('reSet.size() = ' + reSet.size()); |
| | | if (editAble && String.isBlank(arriveorder)) { |
| | | pageRecords = reSet; |
| | | } |
| | | //Integer pagestartNo = (setCon.getPageNumber() * size)-size; |
| | | //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1); |
| | | Integer addNo = 0; |
| | | //update by rentx 2021-2-26 start |
| | | System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size()); |
| | | for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if ( |
| | | (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) || |
| | | (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos')) |
| | | ) { |
| | | addNo++; |
| | | } else { |
| | | if (info.check == false) { |
| | | info.orderdetails1 = orderdetails1; |
| | | } |
| | | pageRecords.add(info); |
| | | addNo++; |
| | | } |
| | | } |
| | | System.debug('pageRecords 2 = ' + pageRecords); |
| | | System.debug('zhj5'); |
| | | System.debug('pageRecords = ' + pageRecords); |
| | | return pageRecords; |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() { |
| | | List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | skipData = new Map<String, String>(); |
| | | System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc); |
| | | //取出选择的产品 |
| | | if (pageRecordsLwc != null) { |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | System.debug('ass.check = ' + ass.check); |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | } else { |
| | | selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | } |
| | | reSetLwc.add(ass); |
| | | } |
| | | } |
| | | } |
| | | System.debug('selectedIdMap = ' + selectedIdMap); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble && String.isBlank(arriveorder)) { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('reSetLwc = ' + reSetLwc); |
| | | for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) { |
| | | ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo(); |
| | | ci.check = assLwc.check; |
| | | ci.oldCheck = assLwc.oldCheck; |
| | | ci.orderdetails1 = assLwc.orderdetails1; |
| | | ci.orderdetails2 = assLwc.orderdetails2; |
| | | ci.Prod = assLwc.Prod; |
| | | ci.Boxnumber = assLwc.Boxnumber; |
| | | ci.Piecenumber = assLwc.Piecenumber; |
| | | ci.allnumber = assLwc.allnumber; |
| | | ci.oldConsumableCount = assLwc.oldConsumableCount; |
| | | ci.canSelect = assLwc.canSelect; |
| | | ci.sortBy = assLwc.sortBy; |
| | | ci.packinglist = assLwc.packinglist; |
| | | ci.approbation_No = assLwc.approbation_No; |
| | | ci.expiration_Date = assLwc.expiration_Date; |
| | | ci.boxorpiecein = assLwc.boxorpiecein; |
| | | ci.boxorpiece = assLwc.boxorpiece; |
| | | ci.boxorpieceMap = assLwc.boxorpieceMap; |
| | | ci.concc = assLwc.concc; |
| | | ci.BoxPiece = assLwc.BoxPiece; |
| | | ci.hospitalSpecialOffer = assLwc.hospitalSpecialOffer; |
| | | ci.hosPro = assLwc.hosPro; |
| | | reSet.add(ci); |
| | | } |
| | | pageRecords = reSet; |
| | | System.debug('reSet = ' + reSet); |
| | | addData = reSet.clone(); |
| | | System.debug('addData = reSet = ' + addData); |
| | | } |
| | | //Integer pagestartNo = (setCon.getPageNumber() * size)-size; |
| | | //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1); |
| | | Integer addNo = 0; |
| | | //update by rentx 2021-2-26 start |
| | | System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size()); |
| | | for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if ( |
| | | (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) || |
| | | (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos')) |
| | | ) { |
| | | System.debug('去掉的id : ' + info.Prod.Id); |
| | | addNo++; |
| | | addSize++; |
| | | } else { |
| | | if (info.check == false) { |
| | | info.orderdetails1 = orderdetails1; |
| | | } |
| | | pageRecords.add(info); |
| | | addNo++; |
| | | } |
| | | } |
| | | System.debug('pageRecords.size() = ' + pageRecords.size()); |
| | | System.debug('end addData = ' + addData); |
| | | return pageRecords; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save( |
| | | Consumable_order__c cocLwc, |
| | | String hospitalInfoLwc, |
| | | String hospitalNameLwc, |
| | | String secondaryDistributorLwc, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwc, |
| | | String accountidLwc, |
| | | String ESetIdLwc, |
| | | List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc, |
| | | String agencyProTypeLwc, |
| | | String userWorkLocationLwc |
| | | ) { |
| | | coc = cocLwc; |
| | | HospitalInfo = hospitalInfoLwc; |
| | | HospitalName = hospitalNameLwc; |
| | | SecondDealer = secondaryDistributorLwc; |
| | | pageRecordsLwc = pageRecordsLwc; |
| | | accountid = accountidLwc; |
| | | consumableproductdetailsRecords = consumableproductdetailsRecordsLwc; |
| | | ESetId = ESetIdLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | |
| | | System.debug('coc = ' + coc); |
| | | System.debug('HospitalInfo = ' + HospitalInfo); |
| | | System.debug('HospitalName = ' + HospitalName); |
| | | System.debug('SecondDealer = ' + SecondDealer); |
| | | System.debug('pageRecordsLwc = ' + pageRecordsLwc); |
| | | System.debug('accountid = ' + accountid); |
| | | System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords); |
| | | System.debug('ESetId = ' + ESetId); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | //订单信息确认 |
| | | if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) { |
| | | // coc.SummonsForDirction__c.addError('请输入指示单目的'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入指示单目的', ''); |
| | | } else if (coc.SummonsForDirction__c == '直接销售给医院') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('不需要二级经销商和经销商(录入)信息' ); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要二级经销商和经销商(录入)信息', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '医院试用') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '销售给二级经销商') { |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '互相调货') { |
| | | if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) { |
| | | // coc.addError('不需要输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入医院', ''); |
| | | } |
| | | if (String.isNotBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | } |
| | | |
| | | Integer isHos = 0; |
| | | |
| | | Integer FLG = 0; |
| | | Integer Count = 0; |
| | | for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) { |
| | | FLG = FLG + 1; |
| | | if (CheckCount.check == false) { |
| | | Count = Count + 1; |
| | | } else { |
| | | //add by rentx |
| | | if (CheckCount.hospitalSpecialOffer) { |
| | | isHos = isHos + 1; |
| | | } |
| | | //add by rentx |
| | | } |
| | | } |
| | | if (Count == FLG) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请选择所需消耗品')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请选择所需消耗品', ''); |
| | | } |
| | | // gzw 注释 判断提前 20210308 |
| | | //checkOutPattern(); |
| | | //根据用户选中的产品给 出库单上的是否医院特价出库字段赋值 |
| | | Integer isHosCheckOutPattern = 0; |
| | | for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) { |
| | | if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) { |
| | | isHosCheckOutPattern = isHosCheckOutPattern + 1; |
| | | } |
| | | } |
| | | if (isHosCheckOutPattern > 0) { |
| | | coc.OutPattern__c = true; |
| | | } else { |
| | | coc.OutPattern__c = false; |
| | | } |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | //特价医院出库非本医院维护的特价商品时,报错 非特价医院出库维护在医院特价关系表的产品时 报错 |
| | | if (coc.SummonsForDirction__c != '互相调货') { |
| | | //非特价医院出库特价产品时 报错(当前经销商下没有特价医院除外) |
| | | List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | //经销商对应医院下的所有特价产品 |
| | | Map<String, String> proMap = new Map<String, String>(); |
| | | //经销商下的所有特价产品 |
| | | Map<String, String> allProMap = new Map<String, String>(); |
| | | |
| | | if (hopList != null && hopList.size() > 0) { |
| | | Boolean flag = false; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | for (hospitalprice__c hp : hopList) { |
| | | allProMap.put(hp.product__c, ''); |
| | | //如果当前 医院特价关系中的医院对应出库单上出库的医院,则放产品id到map |
| | | if (hp.hospital__c == HospitalInfo) { |
| | | flag = true; |
| | | proMap.put(hp.product__c, ''); |
| | | } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | //判断选中的医院特价产品 |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | //用户选中了当前医院下的特价产品 |
| | | if (proMap.containsKey(ass.Prod.Id)) { |
| | | continue; |
| | | //用户选中了没有维护特价医院的特价产品 |
| | | } else if (!allProMap.containsKey(ass.Prod.Id)) { |
| | | continue; |
| | | } else { |
| | | //用户选中非当前医院维护的特价产品 |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '当前医院没有维护 消耗品:'+ ass.Prod.Name__c +' 的特价')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '当前医院没有维护 消耗品:' + ass.Prod.Name__c + '的特价', ''); |
| | | } |
| | | } //非医院特价产品可以出库给任意医院,所以不需要判断 |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | //如果是互相调货,判断 经销商(录入) 是否维护了 当前选中的特价产品 |
| | | List<hospitalprice__c> hopList = [ |
| | | SELECT id, hospital__c, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :coc.Order_ForDealerTextID__c |
| | | ]; |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (hopList != null && hopList.size() > 0) { |
| | | for (hospitalprice__c hpc : hopList) { |
| | | proMap.put(hpc.product__c, ''); |
| | | } |
| | | |
| | | String proStr = ''; |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | if (!proMap.containsKey(ass.Prod.Id)) { |
| | | proStr += ass.Prod.Name__c + ','; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (proStr != '') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '经销商:'+coc.Order_ForDealerText__c +' 没有消耗品:'+proStr.substring(0,proStr.length()-1) + ' 的特价')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '经销商:' + |
| | | coc.Order_ForDealerText__c + |
| | | ' 没有消耗品:' + |
| | | proStr.substring(0, proStr.length() - 1) + |
| | | ' 的特价', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // checkOutPattern(); |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>(); |
| | | List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | // try { |
| | | //新建订单时 |
| | | if (String.isEmpty(ESetId)) { |
| | | p.Name = '*'; |
| | | p.Order_type__c = '传票'; |
| | | p.Order_ProType__c = agencyProType; |
| | | if (coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c)) |
| | | coc.SummonsStatus_c__c = '草案中'; |
| | | // update strat by vivek 2019-7-12 |
| | | p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c; |
| | | // update end by vivek 2019-7-12 |
| | | p.SummonsStatus_c__c = coc.SummonsStatus_c__c; |
| | | if (coc.Arrive_Order__c != null) { |
| | | p.Arrive_Order__c = coc.Arrive_Order__c; |
| | | } |
| | | p.Offers_Price__c = coc.Offers_Price__c; |
| | | p.Dealer_Info__c = accountid; |
| | | if (String.isBlank(SecondDealer)) { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | } else { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | p.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | P.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.SummonsForDirction__c = coc.SummonsForDirction__c; |
| | | p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder; |
| | | // update start by vivek 2019-7-15 |
| | | p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c; |
| | | // update end by vivek 2019-7-15 |
| | | //add by rentx |
| | | p.OutPattern__c = coc.OutPattern__c; |
| | | //add by rentx |
| | | //Map<String,String> ProductNewMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } |
| | | |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } else if (ass.orderdetails1.Box_Piece__c == '个') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | insert p; |
| | | ESetId = p.id; |
| | | List<Consumable_order__c> detailName = new List<Consumable_order__c>(); |
| | | detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId]; |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = detailName[0].name + '-' + str; |
| | | InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c; |
| | | InsAfterDel.Consumable_order__c = p.id; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; |
| | | InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c; |
| | | // TODO 默认 盒 ,需要修正 |
| | | InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c; |
| | | InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c; |
| | | //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c; |
| | | InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c; |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | //add by rentx 2021-2-26 start |
| | | InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer; |
| | | //add by rentx 2021-2-26 end |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | // 如果 出库单 和 OCM发货Header连 的话,发货的Detail2 Copy到 出库单的Detail2里 |
| | | if (getExistarrive()) { |
| | | for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) { |
| | | //BlockForP; |
| | | Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c(); |
| | | InsProductDet.Id = ass.orderdetails2.Id; |
| | | InsProductDet.Consumable_ZS_order__c = p.id; |
| | | i++; |
| | | InsProduct.add(InsProductDet); |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | if (InsProduct.size() > 0) { |
| | | //ControllerUtil.updateOrderDetailsSatus(InsProduct); |
| | | update InsProduct; |
| | | } |
| | | } else if (ESetId != null || ESetId.length() > 0) { |
| | | //修改之后 保存订单 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select |
| | | cocinfo = [ |
| | | SELECT Id, Name, SummonsStatus_c__c, NoConfirmedPrice__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.Name = coc.Name; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | if (String.isEmpty(SecondDealer)) { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | System.debug('SecondDealer = ' + SecondDealer); |
| | | p.Order_ForDealer__c = null; |
| | | } else { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | p.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | P.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.SummonsForDirction__c = coc.SummonsForDirction__c; |
| | | //add by rentx |
| | | p.OutPattern__c = coc.OutPattern__c; |
| | | // update start by vivek 2019-7-15 |
| | | if (p.SummonsStatus_c__c == '价格未定') { |
| | | p.NoConfirmedPrice__c = false; |
| | | p.SummonsStatus_c__c = '已完成'; |
| | | } else { |
| | | p.SummonsStatus_c__c = '草案中'; |
| | | } |
| | | // p.SummonsStatus_c__c = '草案中'; |
| | | // update end by vivek 2019-7-15 |
| | | Integer i = 1; |
| | | //Map<String,String> ProductOldMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } else if (ass.orderdetails1.Box_Piece__c == '个') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) { |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } else { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = p.name + '-' + str; |
| | | InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c; |
| | | InsAfterDel.Consumable_order__c = ESetId; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; |
| | | InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c; |
| | | InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c; |
| | | InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c; |
| | | //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c; |
| | | InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c; |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | //add by rentx 2021-2-26 start |
| | | InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer; |
| | | //add by rentx 2021-2-26 end |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | update p; |
| | | List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>(); |
| | | qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | } |
| | | // }catch (Exception ex) { |
| | | // Database.rollback(sp); |
| | | // // ApexPages.addMessages(ex); |
| | | // // return null; |
| | | // //return new ResponseBodyLWC('Error',500, ex.getMessage(), ''); |
| | | // return new ResponseBodyLWC('Error',500, JSON.serialize(ex), ''); |
| | | // } |
| | | data.put('ESetId', ESetId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void checkOutPattern() { |
| | | //根据用户选中的产品给 出库单上的是否医院特价出库字段赋值 |
| | | Integer isHos = 0; |
| | | for (ConsumableorderdetailsInfo CheckCount : pageRecords) { |
| | | if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) { |
| | | ishos = ishos + 1; |
| | | } |
| | | } |
| | | if (isHos > 0) { |
| | | coc.OutPattern__c = true; |
| | | } else { |
| | | coc.OutPattern__c = false; |
| | | } |
| | | } |
| | | |
| | | //打印PDF |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc, String ESetId) { |
| | | System.debug('cocLwc = ' + cocLwc); |
| | | System.debug('ESetId = ' + ESetId); |
| | | coc = cocLwc; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | if (coc.SummonsStatus_c__c == '批准') { |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SummonsStatus_c__c, |
| | | NoConfirmedPrice__c, |
| | | Dealer_Info__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.SummonsStatus_c__c = '出库单已打印'; |
| | | update p; |
| | | } |
| | | data.put('ESetId', ESetId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //查找经销商 |
| | | @AuraEnabled(cacheable=true scope='global') |
| | | public static List<LookupSearchResult> search(String searchTerm) { |
| | | System.debug('searchTerm = ' + searchTerm); |
| | | String nameCondition = ''; |
| | | nameCondition += '%' + String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) + '%'; |
| | | List<Account> accs = new List<Account>(); |
| | | System.debug('nameCondition = ' + nameCondition); |
| | | //查询条件修改 |
| | | //筛选判断条件:当前财年的4/1 ~ 第二年的6/30 & ET or ENG类型 & 当前用户类型 |
| | | //1 and 2 |
| | | //1. Integer year 2022/4/1 ~ 2023/6/30 |
| | | //开始日期 + 结束日期 |
| | | //Contract_Decide_Start_Date__c>=开始日期 and Contract_Decide_End_Date__c<结束日期 |
| | | //2. 添加经销商允销类型:ET经销商协议;ENG耗材经销商协议 |
| | | //取当前用户的类型,如果用户类型是ET,ET经销商协议 = true |
| | | // Date today = Date.today(); |
| | | // Integer thisYear = today.year(); |
| | | // Integer nextYear = today.year() + 1; |
| | | // Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | // Date nextDatetime = Date.newInstance(nextYear, 6, 30); |
| | | // System.debug('thisDatetime = ' + thisDatetime); |
| | | // System.debug('nextDatetime = ' + nextDatetime); |
| | | |
| | | // User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()]; |
| | | // System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId()); |
| | | // System.debug('UserProTypecTemp = ' + UserProTypecTemp); |
| | | // System.debug('UserProTypecTemp.UserPro_Type__c = ' + UserProTypecTemp.UserPro_Type__c); |
| | | // if (UserProTypecTemp.UserPro_Type__c == 'ENG') { |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // // AND |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | | // AND Contract_Decide_End_Date__c <= :nextDatetime |
| | | // AND ENG_Dealer__c = true |
| | | // ORDER BY Name |
| | | // LIMIT 49 |
| | | // ]; |
| | | // } |
| | | // if (UserProTypecTemp.UserPro_Type__c == 'ET') { |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // // AND |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | | // AND Contract_Decide_End_Date__c <= :nextDatetime |
| | | // AND ET_SP_Dealer__c = true |
| | | // ORDER BY Name |
| | | // LIMIT 49 |
| | | // ]; |
| | | // } |
| | | |
| | | |
| | | Date today = Date.today(); |
| | | //Date today = Date.newInstance(2023, 3, 1); |
| | | Integer thisMonth = today.month(); |
| | | System.debug('thisMonth = ' + thisMonth); |
| | | |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 7, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 7, 1); |
| | | System.debug('lastDatetime = ' + lastDatetime); |
| | | System.debug('thisDatetime = ' + thisDatetime); |
| | | System.debug('thisDatetime2 = ' + thisDatetime2); |
| | | System.debug('nextDatetime = ' + nextDatetime); |
| | | System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId()); |
| | | User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()]; |
| | | |
| | | String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition '; |
| | | if(thisMonth < 4){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 '; |
| | | }else if(thisMonth >= 4 && thisMonth <= 6){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | }else{ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | } |
| | | if (UserProTypecTemp.UserPro_Type__c == 'ENG') { |
| | | sql += 'AND ENG_Dealer__c = true'; |
| | | } |
| | | if (UserProTypecTemp.UserPro_Type__c == 'ET') { |
| | | sql += 'AND ET_SP_Dealer__c = true'; |
| | | } |
| | | System.debug('sql = ' + sql); |
| | | accs = Database.query(sql); |
| | | // 用于保存特约经销商匹配到的其父类的id |
| | | Set<String> pids = new Set<String>(); |
| | | for (Account acc : accs) { |
| | | pids.add(acc.Parentid); |
| | | } |
| | | |
| | | accs = [ |
| | | SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | FROM Account |
| | | WHERE |
| | | (Id IN :pids |
| | | OR (Name = '奥林巴斯(北京)销售服务有限公司' |
| | | AND Name LIKE :nameCondition)) |
| | | AND RecordType.DeveloperName = 'Agency' |
| | | ORDER BY Name |
| | | LIMIT 49 |
| | | ]; |
| | | |
| | | // accs = [ |
| | | // SELECT id, Parentid |
| | | // FROM Account |
| | | // WHERE |
| | | // Parent.Name LIKE :nameCondition |
| | | // AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | // AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | // ]; |
| | | |
| | | // 用于保存特约经销商匹配到的其父类的id |
| | | // Set<String> pids = new Set<String>(); |
| | | // for (Account acc : accs) { |
| | | // pids.add(acc.Parentid); |
| | | // } |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // (Id IN :pids |
| | | // OR (Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // AND Name LIKE :nameCondition)) |
| | | // AND RecordType.DeveloperName = 'Agency' |
| | | // AND Is_Active__c != '無効' |
| | | // ORDER BY Name |
| | | // LIMIT 5 |
| | | // ]; |
| | | System.debug('accs = ' + accs); |
| | | List<LookupSearchResult> results = new List<LookupSearchResult>(); |
| | | String accountIcon = 'standard:account'; |
| | | for (Account account : accs) { |
| | | String subtitle = account.BillingCity == null ? 'Account' : 'Account • ' + account.BillingCity; |
| | | results.add(new LookupSearchResult(account.Id, 'Account', accountIcon, account.Name, subtitle)); |
| | | } |
| | | results.sort(); |
| | | System.debug('results = ' + results); |
| | | return results; |
| | | } |
| | | |
| | | //保存附件 |
| | | @AuraEnabled |
| | | public static String saveFile(Id recordId, String fileName, String base64Data) { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = recordId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | return cv.Id; |
| | | } |
| | | |
| | | //获取附件 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC getFiles(Id recordId) { |
| | | System.debug('getFiles recordId = ' + recordId); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<ContentVersion> cvList = [ |
| | | SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :recordId |
| | | ]; |
| | | data.put('cvList', cvList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //跳转出货/销售 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC GoodsDelivery( |
| | | Consumable_order__c cocLwc, |
| | | String ESetId, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | coc = cocLwc; |
| | | ESetId = ESetId; |
| | | pageRecordsLwc = pageRecordsLwcLwc; |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | List<Account> accList = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE Name = :coc.Order_ForDealerText__c AND RecordType.DeveloperName = 'Agency' |
| | | ]; |
| | | if (accList.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请输入二级经销商全称!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入二级经销商全称!', ''); |
| | | } |
| | | } |
| | | if (coc.SummonsStatus_c__c == '批准') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请先打印指示单!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请先打印指示单!', ''); |
| | | } |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', ''); |
| | | } |
| | | } |
| | | data.put('ESetid', ESetid); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //删除按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC DelConsumable(String ESetId) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | ESetId = ESetId; |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>(); |
| | | Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId]; |
| | | if (Dqs.size() > 0 || qs.size() > 0) { |
| | | delete Dqs; |
| | | delete qs; |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | System.debug(e.getMessage() + e.getLineNumber()); |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Boxnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Piecenumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Integer packinglist { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String boxorpiecein { get; set; } |
| | | |
| | | public List<SelectOption> boxorpiece { get; set; } |
| | | @AuraEnabled |
| | | public Map<String, String> boxorpieceMap { get; set; } |
| | | @AuraEnabled |
| | | public Attachment concc { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hosPro { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo() { |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | orderdetails1 = e; |
| | | orderdetails2 = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.Shipment_Count__c; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | BoxPiece = e.Box_Piece__c; |
| | | boxorpiece = new List<SelectOption>(); |
| | | boxorpiece.add(new SelectOption('盒', '盒')); |
| | | boxorpiece.add(new SelectOption('个', '个')); |
| | | |
| | | boxorpieceMap = new Map<String, String>(); |
| | | boxorpieceMap.put('盒', '盒'); |
| | | boxorpieceMap.put('个', '个'); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | // 消耗品发货明细 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | orderdetails1 = new Consumable_Orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | //boxorpiece = new List<SelectOption>(); |
| | | //boxorpiece.add(new SelectOption('盒', '盒')); |
| | | //boxorpiece.add(new SelectOption('个', '个')); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | //附件 |
| | | public ConsumableorderdetailsInfo(Attachment e) { |
| | | concc = e; |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | orderdetails1 = new Consumable_Orderdetails__c(); |
| | | orderdetails2 = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | //oldConsumableCount = null; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | orderdetails1.Box_Piece__c = '盒'; |
| | | boxorpiece = new List<SelectOption>(); |
| | | boxorpiece.add(new SelectOption('盒', '盒')); |
| | | boxorpiece.add(new SelectOption('个', '个')); |
| | | |
| | | boxorpieceMap = new Map<String, String>(); |
| | | boxorpieceMap.put('盒', '盒'); |
| | | boxorpieceMap.put('个', '个'); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToorderdetails1 = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (sortBy == false) { |
| | | if (Boxnumber > compareToorderdetails1.Boxnumber) { |
| | | returnValue = -1; |
| | | } else if (Boxnumber < compareToorderdetails1.Boxnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (Boxnumber > compareToorderdetails1.Boxnumber) { |
| | | returnValue = 1; |
| | | } else if (Boxnumber < compareToorderdetails1.Boxnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfoLwc { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Boxnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Piecenumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Integer packinglist { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String boxorpiecein { get; set; } |
| | | public List<SelectOption> boxorpiece { get; set; } |
| | | @AuraEnabled |
| | | public Map<String, String> boxorpieceMap { get; set; } |
| | | @AuraEnabled |
| | | public Attachment concc { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hosPro { get; set; } |
| | | @AuraEnabled |
| | | public List<Map<String, String>> unitOptions { get; set; } |
| | | @AuraEnabled |
| | | public String unitValue { get; set; } |
| | | @AuraEnabled |
| | | public Integer shipmentNumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal shippingUnitPrice { get; set; } |
| | | @AuraEnabled |
| | | public String recordId { get; set; } |
| | | @AuraEnabled |
| | | public String Id { get; set; } |
| | | @AuraEnabled |
| | | public String Name { get; set; } |
| | | @AuraEnabled |
| | | public String Category3 { get; set; } |
| | | @AuraEnabled |
| | | public String Category4 { get; set; } |
| | | @AuraEnabled |
| | | public String Category5 { get; set; } |
| | | } |
| | | |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexTopPageController { |
| | | //经销商信息 |
| | | public static account accountInfo; |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords =new List<ConsumableorderdetailsInfo>(); |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | //page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | // public static Integer pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // public static Integer totalcount; |
| | | // public static Integer pagecount; |
| | | // public static Integer currentpage = 0; |
| | | // public static Boolean hasPrevious; |
| | | // public static Boolean hasNext; |
| | | public static List<ConsumableorderdetailsInfo> pageRecords; |
| | | public static String soql {get;set;} |
| | | // 汇总使用 |
| | | public static Integer Total_num; |
| | | public static Integer OrderNumber_arrived; |
| | | public static Integer Delivery_detail_count; |
| | | public static Integer OrderNumber_notarrive; |
| | | public static Integer More_than_seven_days; |
| | | //排序使用 |
| | | // public static String sortKey; |
| | | // public static String preSortKey; |
| | | // public static Boolean sortOrderAsc; |
| | | // public static String[] sortOrder; |
| | | /*****************一周未到货订单一览对应start******************/ |
| | | // 订单 字段标签 |
| | | public static List<String> title; |
| | | // 订单 字段名 |
| | | public static List<String> column; |
| | | public static List<List<String>> columns; |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList; |
| | | /*****************一周未到货订单一览对应end******************/ |
| | | //排序使用 |
| | | private static String[] orderby = new String[]{ 'Product2__c.Name__c'}; |
| | | //产品上下限 |
| | | public static String[] proLimitAndDate =new String[]{}; |
| | | public static String product_Limit; |
| | | //库存产品最早有效期限 |
| | | private static Map<String,Date> productkucun = new Map<String,Date>(); |
| | | //消费期限小于一年的产品 |
| | | public static List<ConsumableorderdetailsInfo> overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>(); |
| | | public static String accountid; |
| | | public static String accountName; |
| | | public static List<String> orderDetZaikuList = new List<String>(); |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 未到货订单信息(超过一周)显示控制 |
| | | public static Boolean over_view { |
| | | get { |
| | | return raesList.size() > 0 ? true : false; |
| | | } |
| | | } |
| | | // 使用期限小于一年的产品 显示控制 |
| | | public static Boolean overlimit { |
| | | get { |
| | | return overlimitdateorderdetails.size() > 0 ? true : false; |
| | | } |
| | | } |
| | | //用户产品区分 |
| | | public static String userPro_Type; |
| | | public static String userPro_Typestr = null; |
| | | public static Boolean EngFlag = false; |
| | | public static Boolean ETFlag = false; |
| | | public static Boolean hasHos; |
| | | |
| | | @AuraEnabled |
| | | public static Results initAgency(){ |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | accountid = useracc.accountid; |
| | | List<Account> accList = new List<Account>(); |
| | | accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c, |
| | | Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c, |
| | | Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c, |
| | | Business_Authorization_No__c,Business_Paper_Expiration_Date__c, |
| | | Credit_Check_No__c,Dealer_discount__c, |
| | | Phone,Address_Together__c,Is_Active_Formula__c, |
| | | Management_Code__c,Sales_Shop_Class__c,Postal_Code__c, |
| | | Fax,Address__c,Deposit_Receipt_Finished__c, |
| | | Deposit_Receipt_Completion_Day__c, |
| | | Product_Limit_Date__c, |
| | | Product_Limit_DateENG__c |
| | | FROM account WHERE id =:accountid]; |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | results.result = 'Success'; |
| | | results.accountInfo = accountInfo; |
| | | }catch(Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results initPage(Integer pageSizeLWC,Integer pageTokenLWC){ |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>(); |
| | | //page |
| | | // pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // currentpage = 0; |
| | | |
| | | User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | // String uid = '0051000000E7Pv9AAF'; |
| | | // User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:uid]; |
| | | accountid = useracc.accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | userPro_Type = useracc.UserPro_Type__c; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | userPro_Typestr = '%' + userPro_Type + '%'; |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //经销商·基本信息获取 |
| | | List<Account> accList = new List<Account>(); |
| | | accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c, |
| | | Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c, |
| | | Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c, |
| | | Business_Authorization_No__c,Business_Paper_Expiration_Date__c, |
| | | Credit_Check_No__c,Dealer_discount__c, |
| | | Phone,Address_Together__c,Is_Active_Formula__c, |
| | | Management_Code__c,Sales_Shop_Class__c,Postal_Code__c, |
| | | Fax,Address__c,Deposit_Receipt_Finished__c, |
| | | Deposit_Receipt_Completion_Day__c, |
| | | Product_Limit_Date__c, |
| | | Product_Limit_DateENG__c |
| | | FROM account WHERE id =:accountid]; |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | accountName = accountInfo.Name; |
| | | if(EngFlag){ |
| | | product_Limit = accountInfo.Product_Limit_DateENG__c; |
| | | }else if(ETFlag){ |
| | | product_Limit = accountInfo.Product_Limit_Date__c; |
| | | } |
| | | if(product_Limit != null && product_Limit !=''){ |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //库存明细取得 |
| | | orderDetZaikuList = new List<String>(); |
| | | List<AggregateResult> orderDetZaiku = [SELECT count(Id), |
| | | Consumable_Product__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | group by Consumable_Product__c]; |
| | | for(AggregateResult zaikuId : orderDetZaiku){ |
| | | orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c'))); |
| | | } |
| | | Map<String,Product2__c> MidMap = new Map<String,Product2__c>(); |
| | | List<Product2__c> product2Selected = [SELECT Id, Name, |
| | | Name__c, |
| | | Asset_Model_No__c, |
| | | Category3__c, |
| | | Category4__c, |
| | | Category5__c, |
| | | SFDA_Status__c, |
| | | Product2__r.SFDA_Approbation_No__c, |
| | | Product2__r.SFDA_Expiration_Date__c, |
| | | Product2__r.Packing_list_manual__c |
| | | FROM Product2__c |
| | | WHERE Id in :orderDetZaikuList |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, product2Selected[i]); |
| | | } |
| | | //返品库存统计 |
| | | List<Consumable_order_details2__c> CountDel = [SELECT Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation]; |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒'){ |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone(); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个'){ |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex )){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex).clone(); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage); |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | //如果是 医院特价创建的明细2 则 |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> newHosMidBoxList = new List<ConsumableorderdetailsInfo>(); |
| | | //把Boxmap里的值从新赋给boxRecords |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | if(bss.allnumber>0){ |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if(bss.allnumber>0){ |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | //排序应该是 非医院特价的盒,医院特价的盒,非医院特价的个,医院特价的个 |
| | | //add by rentx 2020-11-27 先判断医院特价的盒 和 个 |
| | | //2020-11-27 日 于 rentx 注释 start |
| | | String temp = 'A'; |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | //该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id+'个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id+'个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id+'个A'); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id+'个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | // consumableorderdetailsRecords.addAll(newMidPieceMap.values()); |
| | | //2020-11-27 日 于 rentx 注释 end |
| | | // consumableorderdetailsRecords.addAll(newMidPieceMap.values()); |
| | | //2020-11-27 日 于 rentx 注释 end |
| | | |
| | | notarriveorder(); |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | //add by rentx |
| | | Integer ishos = 0; |
| | | for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){ |
| | | if(productkucun.get(bss.Prod.Id) != null){ |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | //add by rentx 2021-3-10 start |
| | | if (bss.hospitalSpecialOffer) { |
| | | ishos = ishos+1; |
| | | } |
| | | |
| | | } |
| | | if (ishos > 0) { |
| | | hasHos = true; |
| | | }else{ |
| | | hasHos = false; |
| | | } |
| | | //add by rentx 2021-3-10 end |
| | | //consumableorderdetailsRecords.sort(); |
| | | //list分割 |
| | | //listCut(); |
| | | // sortKey = '0'; |
| | | // preSortKey = '0'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new String[1]; |
| | | // sortOrder = new String[]{' ', '↓'}; |
| | | //总件数 |
| | | totalCount = consumableorderdetailsRecords.size(); |
| | | //页数 |
| | | // pagecount=(totalcount + pagesize - 1) / pagesize; |
| | | //显示第一页 |
| | | // moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | System.debug('pageToken==>'+ pageToken); |
| | | System.debug('pageSize===>'+ pageSize); |
| | | |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | System.debug('paginatedAccounts.recordStart'+ paginatedAccounts.recordStart); |
| | | System.debug('paginatedAccounts.pageNumber'+ paginatedAccounts.pageNumber); |
| | | System.debug('paginatedAccounts.nextPageToken===>'+paginatedAccounts.nextPageToken); |
| | | System.debug('recordEnd'+ recordEnd); |
| | | |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | //end |
| | | System.debug('PaginatedAccounts===>'+PaginatedAccounts); |
| | | |
| | | //赋值回传 |
| | | results.result = 'Success'; |
| | | results.title = title; |
| | | results.raesList = raesList; |
| | | results.columns = columns; |
| | | results.over_view = over_view; |
| | | results.overlimit = overlimit; |
| | | results.hasHos = hasHos; |
| | | results.overlimitdateorderdetails = overlimitdateorderdetails; |
| | | results.accountInfo = accountInfo; |
| | | results.pageRecords = pageRecords; |
| | | results.product_Limit = product_Limit; |
| | | results.totalNum = Total_num; |
| | | results.orderNumberArrived = OrderNumber_arrived; |
| | | results.deliveryDetailCount = Delivery_detail_count; |
| | | results.orderNumberNotarrive = OrderNumber_notarrive; |
| | | results.moreThanSevenDays = More_than_seven_days; |
| | | //add by WangXueqin 2023/05/05 |
| | | results.userPro_Type = userPro_Type; |
| | | results.paginatedAccounts = paginatedAccounts; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //超过一周未到货订单 |
| | | public static void notarriveorder(){ |
| | | //over_view = false; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | |
| | | List<Consumable_order_details2__c> orderdetails = [SELECT Id,Name,Consumable_order_minor__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Deliver_date__c < :orderdate |
| | | and Consumable_order_minor__c !=null |
| | | and Dealer_Info_text__c = :accountName |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = false |
| | | ]; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO , 'userPro_Type——————' + userPro_Type)); |
| | | Map<String, String> notarriveorderMap = new Map<String, String>(); |
| | | List<String> notarriveorderid = new List<String>(); |
| | | for(Integer i = 0; i < orderdetails.size(); i++){ |
| | | if(notarriveorderMap.containsKey(orderdetails[i].Consumable_order_minor__c)){ |
| | | continue; |
| | | }else{ |
| | | notarriveorderMap.put(orderdetails[i].Consumable_order_minor__c, orderdetails[i].Consumable_order_minor__c); |
| | | //notarriveorderid.add('\'' + orderdetails[i].Consumable_order_minor__c +'\''); |
| | | notarriveorderid.add(orderdetails[i].Consumable_order_minor__c); |
| | | } |
| | | } |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | system.debug('columns=====================>'+columns); |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Delivery_detail_count__c > 0 and showFalseNotshowTrue__c = false '; |
| | | soql += ' and Order_ProType__c = \'' + userPro_Type + '\' ' ; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | |
| | | if(notarriveorderid.size() < 1){ |
| | | soql +=' AND Id = null '; |
| | | }else{ |
| | | String sqlTail = '(\''; |
| | | for(Integer i = 0 ; i< notarriveorderid.size();i++){ |
| | | if(i<notarriveorderid.size()-1){ |
| | | sqlTail += notarriveorderid[i]+'\',\''; |
| | | }else{ |
| | | sqlTail += notarriveorderid[i]+'\')'; |
| | | } |
| | | } |
| | | //over_view = true; |
| | | soql +=' AND Id in ' + sqlTail; |
| | | } |
| | | system.debug('soql_____11111__' + soql); |
| | | raesList = Database.query(soql); |
| | | // update end by vivek2020-01-15 |
| | | Total_num = 0; |
| | | OrderNumber_arrived = 0; |
| | | Delivery_detail_count = 0; |
| | | OrderNumber_notarrive = 0; |
| | | More_than_seven_days = 0; |
| | | for(Consumable_order__c conorder :raesList){ |
| | | Total_num += (Integer)conorder.Total_num__c; |
| | | OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c; |
| | | Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c; |
| | | OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c; |
| | | More_than_seven_days += (Integer)conorder.More_than_seven_days__c; |
| | | } |
| | | // update end by vivek2020-01-15 |
| | | } |
| | | |
| | | public static void productLimtAndDate(){ |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String,String> productLimt = new Map<String,String>(); |
| | | for(Integer i = 0; i < proLimitAndDate.size(); i++){ |
| | | nowName = proLimitAndDate[i]; |
| | | if( nowName.indexOf( '|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|')); |
| | | nowName = nowName.subString( nowName.indexOf( '|')+1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(productLimt.containsKey(ass.Prod.Asset_Model_No__c)){ |
| | | ass.lowerlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|'))); |
| | | ass.upperlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')+1)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void datelimitSearch(){ |
| | | Set<String> barcodekucun = new Set<String>(); |
| | | //--------UpdateStart-----XHL--------------20180929------------- |
| | | List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c, |
| | | Recordtypeid,Guarantee_period_for_products__c, |
| | | Sterilization_limit__c,Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like :userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Consumable_Product__c, Sterilization_limit__c asc ]; |
| | | //--------UpdateEnd-----XHL--------------20180929------------- |
| | | for(Integer i = 0 ; i< orderkucun.size();i++){ |
| | | if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){ |
| | | continue; |
| | | }else{ |
| | | productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c); |
| | | } |
| | | } |
| | | barcodekucun.clear(); |
| | | for(Integer i = 0 ; i< orderkucun.size();i++){ |
| | | if(orderkucun[i].Sterilization_limit__c < Date.today().addYears(1)){ |
| | | if(barcodekucun.contains(orderkucun[i].Bar_Code__c)){ |
| | | continue; |
| | | }else{ |
| | | barcodekucun.add(orderkucun[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | List<AggregateResult> overlimitdatedetails = [SELECT Asset_Model_No__c prodName , |
| | | Box_Piece__c BoxPiece,count(id) countid |
| | | FROM Consumable_order_details2__c |
| | | WHERE Bar_Code__c in :barcodekucun |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | GROUP BY Asset_Model_No__c,Box_Piece__c |
| | | ORDER BY Asset_Model_No__c,Box_Piece__c]; |
| | | for(Integer i = 0 ; i< overlimitdatedetails.size();i++){ |
| | | overlimitdateorderdetails.add(new ConsumableorderdetailsInfo(overlimitdatedetails[i])); |
| | | } |
| | | } |
| | | |
| | | //首页 |
| | | // public static void moveToFirst(){ |
| | | // if(currentpage == 1) return; |
| | | // currentpage = 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | //判断是否可翻页 |
| | | // public static void canMove(){ |
| | | // hasPrevious = false; |
| | | // hasNext = false; |
| | | // if(pagecount > 1 && currentpage > 1) hasPrevious = true; |
| | | // if(pagecount > 1 && currentpage < pagecount) hasNext = true; |
| | | // } |
| | | |
| | | //编辑当前页内容 |
| | | public static void makeCurrentPageRecords(){ |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | if (endIdx > consumableorderdetailsRecords.size()) { |
| | | endIdx = consumableorderdetailsRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | } |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | //public Boolean check { get; set; } |
| | | //public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public Date guaranteeperiod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal countid { get; set; } |
| | | @AuraEnabled |
| | | public String prodName { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set ;} |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | //check = false; |
| | | //oldCheck = false; |
| | | esd = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | oldConsumableCount = null; |
| | | allnumber = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(AggregateResult e) { |
| | | countid =Integer.valueOf(e.get('countid')); |
| | | prodName = String.valueOf(e.get('prodname')); |
| | | BoxPiece = String.valueOf(e.get('BoxPiece')); |
| | | } |
| | | |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo; |
| | | Integer returnValue = 0; |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public List<List<String>> columns; |
| | | @AuraEnabled |
| | | public Boolean over_view; |
| | | @AuraEnabled |
| | | public Boolean overlimit; |
| | | @AuraEnabled |
| | | public Boolean hasHos; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> overlimitdateorderdetails; |
| | | @AuraEnabled |
| | | public Account accountInfo; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> pageRecords; |
| | | @AuraEnabled |
| | | public String product_Limit; |
| | | @AuraEnabled |
| | | public Integer totalNum; |
| | | @AuraEnabled |
| | | public Integer orderNumberArrived; |
| | | @AuraEnabled |
| | | public Integer deliveryDetailCount; |
| | | @AuraEnabled |
| | | public Integer orderNumberNotarrive; |
| | | @AuraEnabled |
| | | public Integer moreThanSevenDays; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | //add by WangXueqin 2023/05/05 |
| | | @AuraEnabled |
| | | public String userPro_Type; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> pageCodeRecords; |
| | | @AuraEnabled |
| | | public PaginatedAccounts paginatedAccounts; |
| | | |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexUpAccountProLimit { |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC upAccount(String accountId,String productLimit,String userPro_Type){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | //--------AddStart-----XHL--------------20180929------------- |
| | | Boolean EngFlag = false; |
| | | Boolean ETFlag = false; |
| | | String userPro_Typestr = null; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type)); |
| | | //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type)); |
| | | userPro_Typestr = '%' + userPro_Type + '%'; |
| | | //--------AddEnd-----XHL--------------20180929------------- |
| | | system.debug('userPro_Type' + userPro_Type); |
| | | String checkResoultstr = checkResoult(productLimit); |
| | | system.debug('checkResoultstr====>'+checkResoultstr); |
| | | if(String.isNotBlank(checkResoultstr)){ |
| | | return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', ''); |
| | | // return checkResoultstr; |
| | | } |
| | | //String[] proidList =new String[]{}; |
| | | String[] proList =new String[]{}; |
| | | String[] pro_List =new String[]{}; |
| | | List<Account> acc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Limit_Date__c |
| | | FROM |
| | | Account |
| | | WHERE |
| | | Id = : accountId |
| | | FOR UPDATE |
| | | ]; |
| | | if(null == acc || acc.size() == 0) { |
| | | // return '没有经销商:' + accountId + '的数据。'; |
| | | return new ResponseBodyLWC('Error',500,'没有经销商:' + accountId + '的数据', ''); |
| | | } |
| | | //proidList = acc[0].view_product__c.split(','); |
| | | //--------UpdateStart-----XHL--------------20180929------------- |
| | | String sql = ''; |
| | | List<Product2__c> roduct2List = [SELECT Asset_Model_No__c |
| | | FROM Product2__c |
| | | WHERE Product_Type__c like :userPro_Typestr limit 10000];//Add Limit by Li Jun 20230601, need to remove limit later |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'roduct2List:'+ roduct2List)); |
| | | //sql = 'SELECT Asset_Model_No__c ' |
| | | // + ' FROM Product2__c ' |
| | | // + ' WHERE Pro2_Dealer_Object__c = true'; |
| | | //if(EngFlag){ |
| | | // sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ; |
| | | //}else if(ETFlag){ |
| | | // sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag; |
| | | //} |
| | | //system.debug('sqlZZZZZZ' + sql); |
| | | //List<Product2__c> roduct2List = Database.query(sql); |
| | | //--------UpdateEnd-----XHL--------------20180929------------- |
| | | Map<String, String> productMap = new Map<String, String>(); |
| | | proList = productLimit.split(','); |
| | | system.debug('productLimitDDDDD' + productLimit); |
| | | system.debug('proListFFFFF' + proList); |
| | | if(proList.size() > 0 && String.isNotEmpty(proList[0])){ |
| | | for(Integer i = 0; i < proList.size(); i++){ |
| | | pro_List.add(proList[i].subString(0,proList[i].indexOf( '|'))); |
| | | } |
| | | } |
| | | if(roduct2List.size() > 0){ |
| | | for(Product2__c pro2 :roduct2List){ |
| | | productMap.put(pro2.Asset_Model_No__c, pro2.Asset_Model_No__c); |
| | | } |
| | | } |
| | | for(Integer i = 0; i < pro_List.size(); i++){ |
| | | if(!productMap.containsKey(pro_List[i])){ |
| | | // return '经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在!'; |
| | | return new ResponseBodyLWC('Error',500,'经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在', ''); |
| | | } |
| | | } |
| | | String productLimitDa = ''; |
| | | for(String str : productLimit.split(',')){ |
| | | |
| | | if(str != null && str != ''){ |
| | | productLimitDa += ',' + str; |
| | | } |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try{ |
| | | Account accinfo = new Account(); |
| | | accinfo.Id = accountId; |
| | | if(EngFlag){ |
| | | accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1); |
| | | }else if(ETFlag){ |
| | | accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1); |
| | | } |
| | | |
| | | UPDATE accinfo; |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // return ''; |
| | | }catch(DmlException de){ |
| | | Database.rollback(sp); |
| | | throw de; |
| | | } |
| | | } |
| | | public static String checkResoult (String productLimit){ |
| | | String[] proLimit = productLimit.split(','); |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | List<String> asstModelNo = new List<String>(); |
| | | Map<String,String> asstModelNoMap = new Map<String,String>(); |
| | | List<String> asstModelNoCount = new List<String>(); |
| | | for(Integer i = 0; i < proLimit.size(); i++){ |
| | | nowName = proLimit[i]; |
| | | if( nowName.indexOf( '|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|')); |
| | | } |
| | | asstModelNo.add(nowRightAsstModelNo); |
| | | } |
| | | |
| | | for(Integer i = 0; i < asstModelNo.size(); i++){ |
| | | if(asstModelNoMap.containsKey(asstModelNo[i])){ |
| | | asstModelNoCount.add(asstModelNo[i]); |
| | | }else{ |
| | | asstModelNoMap.put(asstModelNo[i], asstModelNo[i]); |
| | | } |
| | | } |
| | | if(asstModelNoCount.size() > 0){ |
| | | return '产品:' + asstModelNoCount + '的数据重复'; |
| | | // return new ResponseBodyLWC('Error',500,'产品:' + asstModelNoCount + '的数据重复。', ''); |
| | | }else{ |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexUtility { |
| | | |
| | | //查询是否一直显示提示 |
| | | public static Boolean getIsNoteStay(){ |
| | | NoteStay__c noteStay = NoteStay__c.getInstance('NoteStay'); |
| | | return noteStay.IsStay__c; |
| | | } |
| | | |
| | | //查询许可证提醒天数 |
| | | public static Integer getLicenceReminderDays(){ |
| | | LicenceReminderDate__c days = LicenceReminderDate__c.getInstance('180Days'); |
| | | return days.ReminderDays__c.intValue(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | * Class used to serialize a single Lookup search result item |
| | | * The Lookup controller returns a List<LookupSearchResult> when sending search result back to Lightning |
| | | */ |
| | | public class LookupSearchResult implements Comparable { |
| | | private Id id; |
| | | private String sObjectType; |
| | | private String icon; |
| | | private String title; |
| | | private String subtitle; |
| | | public virtual class LookupSearchResult implements Comparable { |
| | | protected String id; |
| | | protected String sObjectType; |
| | | protected String icon; |
| | | protected String title; |
| | | protected String subtitle; |
| | | |
| | | protected LookupSearchResult() { |
| | | } |
| | | |
| | | |
| | | public LookupSearchResult(Id id, String sObjectType, String icon, String title, String subtitle) { |
| | | /** |
| | | * @param id the lookup entry identifier (generally a record ID) |
| | | * @param sObjectType Optional - The sObject type of the selected record. This value is not used for lookup rendering. It's passed back to the selection handler in case you search on multiple object types. |
| | | * @param icon Optional - A qualified SLDS icon name taken from https://www.lightningdesignsystem.com/icons. It defaults to standard:default. |
| | | * @param title Required - The label of the lookup entry |
| | | * @param subtitle Optional - A subtitle that is displayed under the lookup entry label |
| | | */ |
| | | public LookupSearchResult(String id, String sObjectType, String icon, String title, String subtitle) { |
| | | this.id = id; |
| | | this.sObjectType = sObjectType; |
| | | this.icon = icon; |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public Id getId() { |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class lexSearchAgencyHospitalController { |
| | | //经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType {get;set;} |
| | | public static String searchName {get;set;} |
| | | private static String accountid = null; |
| | | @AuraEnabled |
| | | public static List<Account> at {get;set;} |
| | | |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String ctype){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | accountid = Useracc.accountid; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ; |
| | | soql += ' order by Name desc limit 100'; |
| | | at = Database.query(soql); |
| | | data.put('at',at); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC serContact(String searchName,String ctype){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | accountid = Useracc.accountid; |
| | | at = Database.query(makeSoql(searchName,accountid,ctype)); |
| | | data.put('at',at); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql(String searchName,String accountid,String ctype){ |
| | | |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ; |
| | | if(String.isNotBlank(searchName)){ |
| | | soql += ' AND Name like \'%' + String.escapeSingleQuotes(searchName.replaceAll('%', '\\%')) + '%\''; |
| | | } |
| | | soql += ' order by Name desc limit 100'; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'soql' + soql)); |
| | | return soql; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <labels> |
| | | <fullName>LexArrivegsDetailsPageHelpText</fullName> |
| | | <language>zh_CN</language> |
| | | <protected>false</protected> |
| | | <shortDescription>LexArrivegsDetailsPageHelpText</shortDescription> |
| | | <value>当选择消耗品订单入库时,显示名称</value> |
| | | </labels> |
| | | <labels> |
| | | <fullName>LexConInvoiceViewReport</fullName> |
| | | <language>zh_CN</language> |
| | | <protected>false</protected> |
| | | <shortDescription>发票显示明细</shortDescription> |
| | | <value>00O6D000000UPzaUAG</value> |
| | | </labels> |
| | | <labels> |
| | | <fullName>View_Weekly_Report</fullName> |
| | | <language>zh_CN</language> |
| | | <protected>false</protected> |
| | | <shortDescription>查看周报活动</shortDescription> |
| | | <value>00O6D000000UPzZUAW</value> |
| | | </labels> |
| | | <labels> |
| | | <fullName>invoiceStart</fullName> |
| | | <language>zh_CN</language> |
| | | <protected>false</protected> |
| | | <shortDescription>发票对象前3位数值</shortDescription> |
| | | <value>a2K</value> |
| | | </labels> |
| | | </CustomLabels> |
| New file |
| | |
| | | <template> |
| | | <lightning-combobox |
| | | name="progress" |
| | | label="Status" |
| | | value={value} |
| | | placeholder="请选择单位" |
| | | options={options} |
| | | onchange={handleChange} > |
| | | </lightning-combobox> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api } from 'lwc'; |
| | | |
| | | export default class BoxorpieceType extends LightningElement { |
| | | value = '盒'; |
| | | @api customValueA; |
| | | |
| | | get options() { |
| | | return [ |
| | | { label: '盒', value: '盒' }, |
| | | { label: '个', value: '个' } |
| | | ]; |
| | | } |
| | | |
| | | connectedCallback(){ |
| | | console.log('enter BoxorpieceType') |
| | | } |
| | | |
| | | handleChange(event) { |
| | | this.value = event.detail.value; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <template if:true={showToastBar}> |
| | | <div class="slds-notify_container"> |
| | | <div class={outerClass} role="status"> |
| | | <span class="slds-assistive-text">{type}</span> |
| | | <span class={innerClass} title={message}> |
| | | <lightning-icon icon-name={getIconName} alternative-text="icon" styleclass="slds-icon slds-icon_small" variant="inverse" size="small"></lightning-icon> |
| | | </span> |
| | | <div class="slds-notify__content"> |
| | | <h2 class="slds-text-heading_small"> |
| | | <lightning-formatted-rich-text value={message}> |
| | | </lightning-formatted-rich-text> |
| | | </h2> |
| | | </div> |
| | | |
| | | <div class="slds-notify__close"> |
| | | <lightning-button-icon icon-name="utility:close" size="small" variant="border-filled" class="slds-button slds-button_icon slds-button_icon-inverse" alternative-text="next" onclick={closeModel} ></lightning-button-icon> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,track,api} from 'lwc'; |
| | | |
| | | export default class CommonToast extends LightningElement { |
| | | @track type='success'; |
| | | @track message; |
| | | @track messageIsHtml=false; |
| | | @track showToastBar = false; |
| | | @api autoCloseTime = 5000; |
| | | @track icon=''; |
| | | |
| | | @api |
| | | showToast(type, message,icon,time) { |
| | | this.type = type; |
| | | this.message = message; |
| | | this.icon=icon; |
| | | this.autoCloseTime=time; |
| | | this.showToastBar = true; |
| | | setTimeout(() => { |
| | | this.closeModel(); |
| | | }, this.autoCloseTime); |
| | | } |
| | | |
| | | closeModel() { |
| | | this.showToastBar = false; |
| | | this.type = ''; |
| | | this.message = ''; |
| | | } |
| | | |
| | | get getIconName() { |
| | | if(this.icon) |
| | | { |
| | | return this.icon; |
| | | } |
| | | return 'utility:' + this.type.toLowerCase(); |
| | | } |
| | | |
| | | get innerClass() { |
| | | return 'slds-icon_container slds-icon-utility-' + this.type.toLowerCase() + ' slds-m-right_small slds-no-flex slds-align-top'; |
| | | } |
| | | |
| | | get outerClass() { |
| | | return 'slds-notify slds-notify_toast slds-theme_' + this.type.toLowerCase(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | |
| | | </template> |
| New file |
| | |
| | | import { LightningElement } from 'lwc'; |
| | | import boxorpieceType from './templates/boxorpieceType'; |
| | | |
| | | export default class CustomLightningDatatable extends LightningElement { |
| | | static customTypes = { |
| | | boxorpieceType: { |
| | | template: boxorpieceType, |
| | | typeAttributes: ['customValueA'] |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <c-boxorpiece-type |
| | | custom-value-a={typeAttributes.customValueA}></c-boxorpiece-type> |
| | | </template> |
| New file |
| | |
| | | <template> |
| | | <lightning-input step="0" type="number" name="count" label="出货数量" |
| | | variant="label-hidden" onchange={outboundCountBlur} data-field="shipmentNumber" value={count} |
| | | min="0" disabled={isDisable} style="min-width: 150px;"></lightning-input> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api } from 'lwc'; |
| | | |
| | | export default class CustomOutboundCountComp extends LightningElement { |
| | | @api isDisable; |
| | | @api recordId; |
| | | @api count; |
| | | |
| | | |
| | | connectedCallback(){ |
| | | console.log('enter CustomOutboundCountComp'); |
| | | console.log('isDisable = ' + this.isDisable); |
| | | console.log('recordId = ' + this.recordId); |
| | | console.log('count = ' + this.count); |
| | | } |
| | | |
| | | outboundCountBlur(event){ |
| | | console.log('outboundCountBlur') |
| | | this.count = event.target.value; |
| | | |
| | | this.dispatchEvent(new CustomEvent('outboundcount', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: { count: this.count, recordId: this.recordId } |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <template if:true={showTitle}> |
| | | <template if:true={showLink}> |
| | | <p style="height: 10px;"></p> |
| | | <a style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;" onclick={clickLink}><lightning-formatted-text value={outputValue}></lightning-formatted-text></a> |
| | | <p style="height: 10px;"></p> |
| | | </template> |
| | | <template if:false={showLink}> |
| | | <div style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;color:#696969;"> |
| | | <lightning-formatted-text value={outputValue}></lightning-formatted-text> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | <template if:false={showTitle}> |
| | | <div style="text-align: right;"> |
| | | <template if:true={showLink}> |
| | | <a style="margin-left: 10px;margin-right: 10px;" onclick={clickLink}><lightning-formatted-number value={outputValue}></lightning-formatted-number></a> |
| | | </template> |
| | | <template if:false={showLink}> |
| | | <lightning-formatted-number style="margin-left: 10px;margin-right: 10px;" value={outputValue}></lightning-formatted-number> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api,track } from 'lwc'; |
| | | |
| | | export default class CustomOutputGood extends LightningElement { |
| | | @api outputValue; |
| | | @api outputType; |
| | | @api recordId; |
| | | |
| | | get showTitle(){ |
| | | if(this.outputType == 'Title'){ |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | get showLink(){ |
| | | if(this.outputType == 'Title'){ |
| | | if(this.outputValue == '订单明细汇总' || this.outputValue == '待操作入库订单汇总'){ |
| | | return false; |
| | | }else{ |
| | | return true |
| | | } |
| | | }else{ |
| | | if(this.outputValue == 0 || this.outputValue == '0' || this.outputValue == ''){ |
| | | return false; |
| | | }else{ |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | clickLink(event){ |
| | | this.dispatchEvent(new CustomEvent('clicklink', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: { value: this.outputValue, type: this.outputType, recordId:this.recordId} |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <lightning-input |
| | | name="shipmentAmount" |
| | | label="shipmentAmount" |
| | | variant="label-hidden" |
| | | value={shipmentAmount} |
| | | read-only style="margin-left: 10px;"> |
| | | |
| | | </lightning-input> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api } from 'lwc'; |
| | | |
| | | export default class CustomShipmentAmountComp extends LightningElement { |
| | | @api shipmentAmount; |
| | | |
| | | connectedCallback(){ |
| | | console.log('进入 CustomShipmentAmountComp shipmentAmount = ' + this.shipmentAmount); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <template> |
| | | <lightning-input style="border:1px solid red" step="0" type="number" name="shipmentNumber" label="出货数量" |
| | | variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber} |
| | | onblur={shipmentNumberBlur} min="0" class="inputFont"></lightning-input> |
| | | <!-- <lightning-input style="border:1px solid red" name="shipmentNumber" label="出货数量" |
| | | variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber} |
| | | onblur={shipmentNumberBlur}></lightning-input> --> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api,track } from 'lwc'; |
| | | |
| | | export default class CustomShipmentNumberComp extends LightningElement { |
| | | @api recordId; |
| | | @api shipmentNumber; |
| | | |
| | | connectedCallback(){ |
| | | console.log('shipmentNumber = ' + this.shipmentNumber); |
| | | } |
| | | |
| | | shipmentNumberBlur(event){ |
| | | console.log('shipmentNumberBlur') |
| | | this.shipmentNumber = event.target.value; |
| | | |
| | | this.dispatchEvent(new CustomEvent('shipmentnumber', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: { shipmentnumber: this.shipmentNumber, recordId: this.recordId } |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <template> |
| | | <lightning-input style="border:1px solid red" step="0.01" type="number" name="shipmentUnitPrice" |
| | | label="deliveryOrderNo" variant="label-hidden" data-field="shipmentUnitPrice" value={shippingUnitPrice} |
| | | onblur={shipmentUnitPriceBlur} class="inputFont"></lightning-input> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api,track } from 'lwc'; |
| | | |
| | | export default class CustomShippingUnitPriceComp extends LightningElement { |
| | | @api recordId; |
| | | @api shippingUnitPrice; |
| | | |
| | | connectedCallback(){ |
| | | console.log('shippingUnitPrice = ' + this.shippingUnitPrice); |
| | | } |
| | | |
| | | shipmentUnitPriceBlur(event){ |
| | | console.log('shipmentUnitPriceBlur') |
| | | this.shippingUnitPrice = event.target.value; |
| | | |
| | | this.dispatchEvent(new CustomEvent('shipmentunitprice', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: { shipmentunitprice: this.shippingUnitPrice, recordId: this.recordId } |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <!-- sldsValidatorIgnore --> |
| | | <!-- sldsValidatorIgnore --> |
| | | <template> |
| | | <!-- <select id="citySel" class="selectUnit" onchange={handleDataChange} data-field="selectUnit"> |
| | | <template for:each={unitOptions} for:item="uo"> |
| | | <option value={uo.value} key={uo.value}>{uo.label}</option> |
| | | </template> |
| | | </select> --> |
| | | <div class="picklist-container"> |
| | | <lightning-combobox |
| | | name="selectUnit" |
| | | label="unit" |
| | | value={unitValue} |
| | | variant="label-hidden" |
| | | onchange={handleDataChange} |
| | | data-field="selectUnit" |
| | | options={unitOptions} |
| | | class="inputFont" |
| | | disabled={isDisabled} |
| | | ></lightning-combobox> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api } from 'lwc'; |
| | | |
| | | export default class CustomUnitComp extends LightningElement { |
| | | @api unitValue; |
| | | @api unitOptions; |
| | | @api recordId; |
| | | @api isDisabled; |
| | | |
| | | connectedCallback(){ |
| | | if(this.isDisabled == null){ |
| | | this.isDisabled = false; |
| | | } |
| | | } |
| | | |
| | | handleDataChange(event){ |
| | | console.log('unitValue = ' + event.target.value); |
| | | this.unitValue = event.target.value; |
| | | this.dispatchEvent(new CustomEvent('unitchange', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: { unitValue: this.unitValue, recordId: this.recordId } |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <template if:true={isShowButton}> |
| | | <lightning-button label="查看周报活动" title="周报" onclick={toWeeklyReport} class="slds-m-left_x-small"></lightning-button> |
| | | </template> |
| | | <template if:false={isShowButton}> |
| | | <p style="text-align: center;">...</p> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement, api, track } from 'lwc'; |
| | | import { NavigationMixin } from "lightning/navigation"; |
| | | import View_Weekly_Report from '@salesforce/label/c.View_Weekly_Report'; |
| | | |
| | | const customLabel = { |
| | | View_Weekly_Report |
| | | } |
| | | export default class CustomWeeklyReportComp extends NavigationMixin(LightningElement) { |
| | | @track label = customLabel; |
| | | |
| | | @api recordId; |
| | | @api hospitalName; |
| | | @api isShowButton; |
| | | |
| | | connectedCallback() { |
| | | console.log('CustomWeeklyReportComp recordId = ' + this.recordId); |
| | | console.log('CustomWeeklyReportComp hospitalName = ' + this.hospitalName); |
| | | } |
| | | |
| | | toWeeklyReport() { |
| | | console.log('去报表'); |
| | | let reportFilters = '[{"operator":"equals","value":"' + this.hospitalName + '","column":"Agency_Report__c.Hospital__c"}]'; |
| | | let reportUrl = this.label.View_Weekly_Report; |
| | | console.log('reportUrl = ' + reportUrl); |
| | | let url = "/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url, |
| | | }, |
| | | }); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> </template> |
| New file |
| | |
| | | import LightningDatatable from 'lightning/datatable'; |
| | | import navigateToRecordTemplate from './navigateToRecordTemplate.html'; |
| | | |
| | | export default class DatatableWithCustomTypes extends LightningDatatable { |
| | | static customTypes = { |
| | | navigateToRecord: { |
| | | template: navigateToRecordTemplate, |
| | | typeAttributes: ['label'] |
| | | } |
| | | }; |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <c-navigate-to-record |
| | | data-navigation="enable" |
| | | record-id={value} |
| | | label={typeAttributes.label} |
| | | > |
| | | </c-navigate-to-record> |
| | | </template> |
| New file |
| | |
| | | lightning-output-field { |
| | | pointer-events: none; |
| | | --lwc-colorTextLabel:#696969; |
| | | --lwc-inputStaticFontSize: 16px; |
| | | --lwc-formLabelFontSize: 16px; |
| | | --lwc-brandTextLink: black; |
| | | --lwc-spacingXxSmall:0px; |
| | | } |
| | | |
| | | /* lightning-output-field>a { |
| | | color: black; |
| | | } */ |
| | | |
| | | body{ |
| | | /* --lwc-fontFamily:sans-serif; */ |
| | | font-family: sans-serif; |
| | | } |
| New file |
| | |
| | | <template> |
| | | <template if:true={showSpinner}> |
| | | <lightning-spinner size="medium" variant="brand"></lightning-spinner> |
| | | </template> |
| | | <c-common-toast></c-common-toast> |
| | | <template if:true={showPage}> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>经销商信息</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <lightning-accordion allow-multiple-sections-open active-section-name={activeSections}> |
| | | <lightning-record-view-form record-id={accountId} object-api-name="Account"> |
| | | <lightning-accordion-section label="经销商详细信息" name="A"> |
| | | <lightning-layout multiple-rows="true"> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Management_Code__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Name"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Ban_On_Use_Date__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Ban_On_Use_Reason__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Dealer_discount__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Sales_Shop_Class__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Deposit_Receipt_Finished__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Deposit_Receipt_Completion_Day__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | </lightning-layout> |
| | | </lightning-accordion-section> |
| | | <lightning-accordion-section label="营业许可证书状况" name="B"> |
| | | <lightning-layout multiple-rows="true"> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Business_Authorization_No__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Business_Paper_Expiration_Date__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Tax_Practice_No__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Tax_Practice_Expiration_Date__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Medical_Equipment_Num__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Medical_Equipment_Expiration_Date__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | </lightning-layout> |
| | | </lightning-accordion-section> |
| | | <lightning-accordion-section label="地址信息" name="C"> |
| | | <lightning-layout multiple-rows="true"> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Postal_Code__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Phone"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Address_Together__c"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | <lightning-layout-item size="5"> |
| | | <lightning-output-field field-name="Fax"></lightning-output-field> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="1"></lightning-layout-item> |
| | | </lightning-layout> |
| | | </lightning-accordion-section> |
| | | </lightning-record-view-form> |
| | | </lightning-accordion> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,track } from 'lwc'; |
| | | import initAgency from '@salesforce/apex/LexTopPageController.initAgency'; |
| | | |
| | | export default class LexAgencyInfo extends LightningElement { |
| | | @track showSpinner = true; |
| | | @track showPage = false; |
| | | @track accountInfo; |
| | | @track accountId; |
| | | @track activeSections = ['A', 'B', 'C']; |
| | | //是否一直显示提示 |
| | | @track isNoteStay = true; |
| | | |
| | | connectedCallback() { |
| | | this.init(); |
| | | } |
| | | |
| | | init() { |
| | | this.showSpinner = true; |
| | | initAgency() |
| | | .then(result => { |
| | | this.showPage = true; |
| | | this.isNoteStay = result.isNoteStay; |
| | | if (result.result == 'Success') { |
| | | this.accountInfo = result.accountInfo; |
| | | this.accountId = result.accountInfo.Id; |
| | | this.showSpinner = false; |
| | | } else { |
| | | this.showSpinner = false; |
| | | console.log("Error:" + result.errorMsg); |
| | | this.showMyToast('初始化页面失败', result.errorMsg, 'error'); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | this.showSpinner = false; |
| | | console.log("Error:" + error); |
| | | this.showMyToast('初始化页面失败', JSON.stringify(error), 'error'); |
| | | }) |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if(variant == 'success'){ |
| | | iconName = 'utility:check'; |
| | | }else{ |
| | | iconName = 'utility:error'; |
| | | } |
| | | if(message != ''){ |
| | | content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; |
| | | }else{ |
| | | content = '<h2><strong>'+title+'<strong/></h2>'; |
| | | } |
| | | this.template.querySelector('c-common-toast'). |
| | | showToast(variant,content,iconName,10000); |
| | | // var mode; |
| | | // if(this.isNoteStay){ |
| | | // mode ='sticky'; |
| | | // }else{ |
| | | // mode = 'dismissable'; |
| | | // } |
| | | // const evt = new ShowToastEvent({ |
| | | // title: title, |
| | | // message: message, |
| | | // variant: variant, |
| | | // mode: mode |
| | | // }); |
| | | // this.dispatchEvent(evt); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightningCommunity__Page</target> |
| | | <target>lightningCommunity__Default</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <template if:true={isShowInputField}> |
| | | <lightning-record-edit-form object-api-name="Agency_Opportunity__c"> |
| | | <lightning-input-field field-name={fieldName} variant="label-hidden" value={inputValue} onchange={inputChange}></lightning-input-field> |
| | | </lightning-record-edit-form> |
| | | </template> |
| | | <template if:false={isShowInputField}> |
| | | <lightning-record-view-form record-id={recordId} object-api-name="Agency_Opportunity__c"> |
| | | <lightning-output-field variant="label-hidden" field-name={fieldName}></lightning-output-field> |
| | | </lightning-record-view-form> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,api } from 'lwc'; |
| | | |
| | | export default class LexAgencyOppCusCell extends LightningElement { |
| | | @api recordId; |
| | | @api fieldName; |
| | | @api inputValue; |
| | | @api showType; |
| | | |
| | | get isShowInputField(){ |
| | | if(this.showType == 'inputField'){ |
| | | return true; |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | inputChange(event){ |
| | | this.inputValue = event.detail.value; |
| | | |
| | | this.dispatchEvent(new CustomEvent('inputchange', { |
| | | composed: true, |
| | | bubbles: true, |
| | | cancelable: true, |
| | | detail: { |
| | | data: {recordId:this.recordId,fieldName:this.fieldName,inputValue:this.inputValue,showType:this.showType} |
| | | } |
| | | })); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <template> |
| | | <template if:true={showSpinner}> |
| | | <lightning-spinner size="medium" variant="brand"></lightning-spinner> |
| | | </template> |
| | | <c-common-toast></c-common-toast> |
| | | <template if:true={showPage}> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;"> |
| | | <div style="padding:10px;"> |
| | | <!-- 按钮 --> |
| | | <!-- <lightning-button style="margin: 5px;" label="入库" onclick={orderArrive}></lightning-button> |
| | | <lightning-button style="margin: 5px;" label="返品" onclick={orderReturn}></lightning-button> --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;margin-right: 150px;" label="入库" onclick={orderArrive}>入库</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="返品" onclick={orderReturn}>返品</button> |
| | | <p style="height: 10px;"></p> |
| | | <!-- 检索条件 --> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>检索条件</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <!-- <p style="font-size: 16px;"><strong>检索条件</strong></p> --> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <table> |
| | | <tbody> |
| | | <tr> |
| | | <td style="width: 10px;"></td> |
| | | <td style="width: 120px;"> |
| | | <div style="color:#696969;font-size:16px;text-align: left;">消耗品订单名称</div> |
| | | </td> |
| | | <td> |
| | | <lightning-input class="inputFont" type="text" variant="label-hidden" label="消耗品订单名称" value={category1} onchange={category1Change}></lightning-input> |
| | | </td> |
| | | <td style="width: 30px;"></td> |
| | | <td style="width: 108px;"> |
| | | <div style="color:#696969;font-size:16px;text-align: left;">最新发货日期</div> |
| | | </td> |
| | | <td> |
| | | <lightning-input class="inputFont" type="date" variant="label-hidden" label="最新发货日期" value={cate2} onchange={cate2Change}></lightning-input> |
| | | </td> |
| | | <td style="width: 30px;"></td> |
| | | <td> |
| | | <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="搜索" onclick={search}></lightning-button> |
| | | <lightning-button style="margin-left: 5px;margin-right: 5px;" label="清空" onclick={clear}></lightning-button> --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height:32px;margin-right: 30px;" label="搜索" onclick={search}>搜索</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="height:32px;" label="清空" onclick={clear}>清空</button> |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <!-- 订单明细 --> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>订单明细</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <!-- <p style="font-size: 16px;"><strong>订单明细</strong></p> --> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms} data={raesList}></lightning-datatable> --> |
| | | <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <!-- 订单各种数量信息弹窗 --> |
| | | <template if:true={showPop}> |
| | | <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;"> |
| | | <div class="slds-modal__container"> |
| | | <header class="slds-modal__header" style="background-color: #F3F3F3;"> |
| | | <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}> |
| | | <lightning-icon icon-name="utility:close" |
| | | alternative-text="close" |
| | | variant="inverse" |
| | | size="small" ></lightning-icon> |
| | | <span class="slds-assistive-text">Close</span> |
| | | </button> |
| | | <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2> |
| | | </header> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;"> |
| | | <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2} data={recordList}></lightning-datatable> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,api,track } from 'lwc'; |
| | | import { CurrentPageReference } from 'lightning/navigation'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | import init from '@salesforce/apex/LexArriveGoodsMainController.init'; |
| | | import searchConsumableorderdetails from '@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails'; |
| | | import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum'; |
| | | import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet'; |
| | | import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll'; |
| | | import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet'; |
| | | import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll'; |
| | | import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet'; |
| | | import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll'; |
| | | import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7'; |
| | | import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All'; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | |
| | | export default class LexArriveGoodsMain extends NavigationMixin(LightningElement) { |
| | | //页面基础变量 |
| | | @track agencyProType; |
| | | @track category1; |
| | | @track cate2; |
| | | // @track eSetId; |
| | | @track accountId; |
| | | @track title = []; |
| | | @track raesList = []; |
| | | @track recordList = []; |
| | | @track userWorkLocation; |
| | | @track totalNum; |
| | | @track orderNumberArrived; |
| | | @track deliveryDetailCount; |
| | | @track orderNumberNotarrive; |
| | | @track moreThanSevenDays; |
| | | @track showSpinner = true; |
| | | @track showPage = false; |
| | | @track showPop = false; |
| | | @track popTitle; |
| | | stylesLoaded = false; |
| | | //是否一直显示提示 |
| | | @track isNoteStay = true; |
| | | |
| | | @track colms = [ |
| | | // {label:'消耗品订单名称',fieldName:'Name'}, |
| | | // {label:'订单总数',fieldName:'Total_num__c'}, |
| | | // {label:'已到货数量',fieldName:'OrderNumber_arrived__c'}, |
| | | // {label:'待系统操作入库数量',fieldName:'Delivery_detail_count__c'}, |
| | | // {label:'还没发货数量',fieldName:'OrderNumber_notarrive__c'}, |
| | | // {label:'发货七天还未到货数',fieldName:'More_than_seven_days__c'}, |
| | | {label:'消耗品订单名称', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "Name" }, |
| | | type: 'Title', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true,initialWidth:200}, |
| | | {label:'SAP合同号',fieldName:'ContractNo__c',hideDefaultActions: true}, |
| | | {label:'订单总数', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "Total_num__c" }, |
| | | type: 'TotalNum', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true, initialWidth: 100}, |
| | | {label:'已到货数量', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "OrderNumber_arrived__c" }, |
| | | type: 'ArrDet', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true, initialWidth: 110}, |
| | | {label:'待系统操作入库数量', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "Delivery_detail_count__c" }, |
| | | type: 'DeliveryDet', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true, initialWidth: 180}, |
| | | {label:'还没发货数量', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "OrderNumber_notarrive__c" }, |
| | | type: 'NotArrDet', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true, initialWidth: 120}, |
| | | {label:'发货七天还未到货数', |
| | | type: "customOutputGood", |
| | | typeAttributes: { |
| | | outputValue: { fieldName: "More_than_seven_days__c" }, |
| | | type: 'MoreThan7', |
| | | recordId: { fieldName: "Id" } |
| | | }, |
| | | hideDefaultActions: true, initialWidth: 180}, |
| | | {label:'最新发货日期',fieldName:'Shipment_date__c',hideDefaultActions: true, initialWidth: 140}, |
| | | {label:'首次发货日期',fieldName:'First_Delivery__c',hideDefaultActions: true, initialWidth: 140} |
| | | ]; |
| | | |
| | | @track colms2 = [ |
| | | {label:'产品型号',fieldName:'prodModel',hideDefaultActions: true}, |
| | | {label:'数量',fieldName:'recordCount',hideDefaultActions: true,initialWidth: 100} |
| | | ]; |
| | | |
| | | //获取参数 |
| | | // @wire(CurrentPageReference) |
| | | // getStateParameters(currentPageReference) { |
| | | // console.log('CurrentPageReference'); |
| | | // if (currentPageReference) { |
| | | // this.eSetId = currentPageReference.state?.ESetid; |
| | | // } |
| | | // } |
| | | |
| | | renderedCallback(){ |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | console.log("Custom styles loaded"); |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error loading custom styles"); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //初始化 |
| | | connectedCallback(){ |
| | | init() |
| | | .then(result=>{ |
| | | this.isNoteStay = result.isNoteStay; |
| | | if(result.result == 'Success'){ |
| | | this.agencyProType = result.agencyProType; |
| | | this.accountId = result.accountId; |
| | | this.title = result.title; |
| | | this.userWorkLocation = result.userWorkLocation; |
| | | this.totalNum = result.totalNum; |
| | | this.orderNumberArrived = result.orderNumberArrived; |
| | | this.deliveryDetailCount = result.deliveryDetailCount; |
| | | this.orderNumberNotarrive = result.orderNumberNotarrive; |
| | | this.moreThanSevenDays = result.moreThanSevenDays; |
| | | this.raesList = result.raesList; |
| | | this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays}); |
| | | this.showSpinner = false; |
| | | this.showPage = true; |
| | | }else{ |
| | | this.showSpinner = false; |
| | | console.log("Error:"+result.errorMsg); |
| | | this.showMyToast('初始化页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //点击链接 |
| | | clickLick(event){ |
| | | var outputValue = event.detail.data.value; |
| | | var outputType = event.detail.data.type; |
| | | var recordId = event.detail.data.recordId; |
| | | console.log("click:"+outputValue+"---"+outputType+"---"+recordId); |
| | | if(outputType == 'Title'){ |
| | | const config = { |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: '/lexarrivegoods?ESetId='+recordId |
| | | } |
| | | }; |
| | | this[NavigationMixin.Navigate](config); |
| | | }else if(outputType == 'TotalNum'){ |
| | | this.popTitle = '所有产品一览'; |
| | | initTotalNum({ordId:recordId, type:'all'}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | // this.recordList = result.recordList; |
| | | var dataStr = JSON.stringify(result.recordList); |
| | | this.recordList = JSON.parse(dataStr); |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载所有产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | }else if(outputType == 'ArrDet'){ |
| | | if(recordId == '1'){ |
| | | this.popTitle = '所有已到货产品一览'; |
| | | initArrDetAll({type:'all'}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | // this.recordList = result.recordList; |
| | | var dataStr = JSON.stringify(result.recordList); |
| | | this.recordList = JSON.parse(dataStr); |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载所有已到货产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.popTitle = '已到货产品一览'; |
| | | initArrDet({orderId:recordId}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载已到货产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | }else if(outputType == 'DeliveryDet'){ |
| | | if(recordId == '1'){ |
| | | this.popTitle = '所有已发货还没到货产品一览'; |
| | | initDeliveryDetAll({type:'all'}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载所有已发货还没到货产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.popTitle = '未到货产品一览'; |
| | | initDeliveryDet({orderId:recordId}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载未到货产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | }else if(outputType == 'NotArrDet'){ |
| | | if(recordId == '1'){ |
| | | this.popTitle = '所有还没发货产品一览'; |
| | | initNotArrDetAll({type:'all'}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载所有还没发货产品一览页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.popTitle = '还没发货数量'; |
| | | initNotArrDet({orderId:recordId}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载还没发货数量页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }else if(outputType == 'MoreThan7'){ |
| | | if(recordId == '1'){ |
| | | this.popTitle = '所有发货七天还未到货数'; |
| | | initMoreThan7All({type:'all'}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载所有发货七天还未到货数页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.popTitle = '发货七天还未到货数'; |
| | | initMoreThan7({orderId:recordId}) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | this.recordList = result.recordList; |
| | | console.log('data:'+JSON.stringify(this.recordList)); |
| | | this.showPop = true; |
| | | }else{ |
| | | this.showMyToast('加载发货七天还未到货数页面失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | //关闭弹窗 |
| | | closePop(){ |
| | | this.showPop = false; |
| | | } |
| | | |
| | | //消耗品订单名称变更 |
| | | category1Change(event){ |
| | | this.category1 = event.detail.value; |
| | | } |
| | | |
| | | //最新发货日期变更 |
| | | cate2Change(event){ |
| | | this.cate2 = event.detail.value; |
| | | } |
| | | |
| | | //检索 |
| | | search(){ |
| | | this.showSpinner = true; |
| | | searchConsumableorderdetails({ |
| | | category1Str:this.category1, |
| | | cate2Str:this.cate2, |
| | | accountidStr:this.accountId, |
| | | userWorkLocationStr:this.userWorkLocation, |
| | | agencyProTypeStr:this.agencyProType}) |
| | | .then(result=>{ |
| | | this.showSpinner = false; |
| | | if(result.result == 'Success'){ |
| | | this.raesList = result.raesList; |
| | | this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays}); |
| | | if(this.raesList.length > 1){ |
| | | var count = this.raesList.length - 1; |
| | | this.showMyToast('搜索成功','共搜索到'+count+'条数据','success'); |
| | | }else{ |
| | | this.showMyToast('未搜索到数据','','error'); |
| | | } |
| | | }else{ |
| | | this.showMyToast('搜索失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //清空搜索框 |
| | | clear(){ |
| | | this.showSpinner = true; |
| | | this.category1 = ''; |
| | | this.cate2 = null; |
| | | searchConsumableorderdetails({ |
| | | category1Str:this.category1, |
| | | cate2Str:this.cate2, |
| | | accountidStr:this.accountId, |
| | | userWorkLocationStr:this.userWorkLocation, |
| | | agencyProTypeStr:this.agencyProType}) |
| | | .then(result=>{ |
| | | this.showSpinner = false; |
| | | if(result.result == 'Success'){ |
| | | this.raesList = result.raesList; |
| | | this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays}); |
| | | if(this.raesList.length > 1){ |
| | | var count = this.raesList.length - 1; |
| | | this.showMyToast('搜索成功','共搜索到'+count+'条数据','success'); |
| | | }else{ |
| | | this.showMyToast('未搜索到数据','','error'); |
| | | } |
| | | }else{ |
| | | this.showMyToast('搜索失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //入库 |
| | | orderArrive(){ |
| | | const config = { |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: '/lexarrivegoods?ArrType=Arr' |
| | | } |
| | | }; |
| | | this[NavigationMixin.Navigate](config); |
| | | } |
| | | |
| | | //返品 |
| | | orderReturn(){ |
| | | const config = { |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: '/lexarrivegoods?ArrType=ReG' |
| | | } |
| | | }; |
| | | this[NavigationMixin.Navigate](config); |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if(variant == 'success'){ |
| | | iconName = 'utility:check'; |
| | | }else{ |
| | | iconName = 'utility:error'; |
| | | } |
| | | if(message != ''){ |
| | | content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; |
| | | }else{ |
| | | content = '<h2><strong>'+title+'<strong/></h2>'; |
| | | } |
| | | this.template.querySelector('c-common-toast'). |
| | | showToast(variant,content,iconName,10000); |
| | | // var mode; |
| | | // if(this.isNoteStay){ |
| | | // mode ='sticky'; |
| | | // }else{ |
| | | // mode = 'dismissable'; |
| | | // } |
| | | // const evt = new ShowToastEvent({ |
| | | // title: title, |
| | | // message: message, |
| | | // variant: variant, |
| | | // mode: mode |
| | | // }); |
| | | // this.dispatchEvent(evt); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightningCommunity__Page</target> |
| | | <target>lightningCommunity__Default</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <template> |
| | | <template if:true={showSpinner}> |
| | | <lightning-spinner size="medium" variant="brand"></lightning-spinner> |
| | | </template> |
| | | <c-common-toast></c-common-toast> |
| | | <template if:true={showPage}> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>到货</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <!-- <p style="font-size: 16px;"><strong>到货</strong></p> --> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <!-- 按钮 --> |
| | | <!-- <lightning-button style="margin: 5px;" label="出库" onclick={proSale} disabled={arrivetoorder}></lightning-button> --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="出库" onclick={proSale} disabled={arrivetoorder}>出库</button> |
| | | <p style="height: 10px;"></p> |
| | | <!-- 到货订单信息 --> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>到货订单信息</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <!-- <p style="font-size: 16px;"><strong>到货订单信息</strong></p> --> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <table> |
| | | <tbody> |
| | | <tr> |
| | | <td style="width:10px;"></td> |
| | | <td style="width:140px;"> |
| | | <div style="color:#696969;font-size:16px;">到货订单名称</div> |
| | | </td> |
| | | <td style="width:200px;"> |
| | | <lightning-formatted-text style="font-size: 16px;" value={coc.Name}></lightning-formatted-text> |
| | | </td> |
| | | <td style="width:30px;"></td> |
| | | <td style="width:140px;"> |
| | | <div style="color:#696969;font-size:16px;">本次入库产品金额</div> |
| | | </td> |
| | | <td style="width:100px;"> |
| | | <lightning-formatted-number style="font-size: 16px;" value={coc.Arrive_total_amount__c} minimum-fraction-digits="2"></lightning-formatted-number> |
| | | </td> |
| | | <td></td> |
| | | </tr> |
| | | <tr style="height: 20px;"></tr> |
| | | <tr> |
| | | <td style="width:10px;"></td> |
| | | <td style="width:120px;"> |
| | | <div style="color:#696969;font-size:16px;">消耗品订单名称<lightning-helptext style="--lwc-spacingXxSmall:0px;" content={label.helpText}></lightning-helptext></div> |
| | | </td> |
| | | <td style="width:200px;"> |
| | | <lightning-formatted-text style="font-size: 16px;" value={coc.arriveOrder}></lightning-formatted-text> |
| | | <!-- <lightning-formatted-text value={coc.Arrive_Order__r.Name}></lightning-formatted-text> --> |
| | | </td> |
| | | <td></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <!-- 在库商品库存一览 --> |
| | | <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>在库商品库存一览</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <!-- <p style="font-size: 16px;"><strong>在库商品库存一览</strong></p> --> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={colms} data={consumableorderdetailsRecords}></lightning-datatable> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track } from 'lwc'; |
| | | import { CurrentPageReference } from 'lightning/navigation'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | import init from '@salesforce/apex/LexArriveGsDetailsController.init'; |
| | | import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale'; |
| | | import helpText from '@salesforce/label/c.LexArrivegsDetailsPageHelpText'; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | |
| | | export default class LexArriveGsDetails extends NavigationMixin(LightningElement) { |
| | | |
| | | @track eSetId; |
| | | @track showSpinner = true; |
| | | @track showPage = false; |
| | | @track accountid; |
| | | @track orderallcount; |
| | | @track consumableorderdetailsCount; |
| | | @track arrivetoorder = false; |
| | | @track coc; |
| | | @track consumableorderdetailsRecords = []; |
| | | stylesLoaded = false; |
| | | //是否一直显示提示 |
| | | @track isNoteStay = true; |
| | | @track colms = [ |
| | | {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true}, |
| | | {label:'规格' , fieldName:'packing_list', hideDefaultActions: true,wrapText:true,initialWidth:50,cellAttributes: { alignment: "right" }}, |
| | | {label:'CFDA状态' , fieldName:'statusCFDA', hideDefaultActions: true,wrapText:true,initialWidth:100}, |
| | | {label:'注册证编码号' , fieldName:'approbation_No', hideDefaultActions: true,wrapText:true,initialWidth:125}, |
| | | {label:'注册证效期' , fieldName:'expiration_DateStr', hideDefaultActions: true,wrapText:true,initialWidth:115}, |
| | | {label:'使用期限' , fieldName:'Sterilization_limitStr', hideDefaultActions: true,wrapText:true,initialWidth:115}, |
| | | {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:250}, |
| | | {label:'采购单价' ,type:'number',fieldName:'intraTradeList', hideDefaultActions: true,wrapText:true,initialWidth:120,typeAttributes:{minimumFractionDigits: 2},cellAttributes: { alignment: "right" }} |
| | | ]; |
| | | label = {helpText}; |
| | | |
| | | // 获取参数 |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | this.eSetId = currentPageReference.state?.EsetId; |
| | | } |
| | | console.log('CurrentPageReference:'+this.eSetId); |
| | | } |
| | | |
| | | renderedCallback(){ |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | console.log("Custom styles loaded"); |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error loading custom styles"); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //初始化 |
| | | connectedCallback(){ |
| | | init({eSetIdStr : this.eSetId}) |
| | | .then(result=>{ |
| | | this.showPage = true; |
| | | this.isNoteStay = result.isNoteStay; |
| | | if(result.result == 'Success'){ |
| | | this.coc = result.coc; |
| | | if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){ |
| | | this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name; |
| | | } |
| | | console.log('this.coc:'+JSON.stringify(this.coc)); |
| | | this.accountid = result.accountid; |
| | | this.orderallcount = result.orderallcount; |
| | | this.arrivetoorder = result.arrivetoorder; |
| | | this.consumableorderdetailsCount = result.consumableorderdetailsCount; |
| | | this.consumableorderdetailsRecords = result.consumableorderdetailsRecords; |
| | | for(var i in this.consumableorderdetailsRecords){ |
| | | if(this.consumableorderdetailsRecords[i].esd != null){ |
| | | this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id; |
| | | if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){ |
| | | this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c; |
| | | } |
| | | // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName; |
| | | this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c; |
| | | this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c; |
| | | console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c); |
| | | } |
| | | if(this.consumableorderdetailsRecords[i].Prod != null){ |
| | | this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c; |
| | | } |
| | | } |
| | | this.showSpinner = false; |
| | | }else { |
| | | this.showSpinner = false; |
| | | console.log("error:"+result.errorMsg); |
| | | this.showMyToast('初始化失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | .catch(error=>{ |
| | | this.showSpinner = false; |
| | | this.showPage = true; |
| | | console.log("error:"+error); |
| | | this.showMyToast('初始化失败',error,'error'); |
| | | }) |
| | | } |
| | | |
| | | proSale(){ |
| | | this.showSpinner = true; |
| | | proSale({ |
| | | cocStr : JSON.stringify(this.coc), |
| | | orderallcountParm : this.orderallcount, |
| | | consumableorderdetailsCountParm : this.consumableorderdetailsCount |
| | | }) |
| | | .then(result=>{ |
| | | if(result.result == 'Success'){ |
| | | var url = result.url; |
| | | const config = { |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }; |
| | | this[NavigationMixin.Navigate](config); |
| | | }else { |
| | | this.showSpinner = false; |
| | | console.log("error:"+error); |
| | | this.showMyToast('出库失败',result.errorMsg,'error'); |
| | | } |
| | | }) |
| | | .catch(error=>{ |
| | | this.showPage = true; |
| | | this.showSpinner = false; |
| | | console.log("error:"+error); |
| | | this.showMyToast('出库失败',error,'error'); |
| | | }) |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if(variant == 'success'){ |
| | | iconName = 'utility:check'; |
| | | }else{ |
| | | iconName = 'utility:error'; |
| | | } |
| | | if(message != ''){ |
| | | content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; |
| | | }else{ |
| | | content = '<h2><strong>'+title+'<strong/></h2>'; |
| | | } |
| | | this.template.querySelector('c-common-toast'). |
| | | showToast(variant,content,iconName,10000); |
| | | // var mode; |
| | | // if(this.isNoteStay){ |
| | | // mode ='sticky'; |
| | | // }else{ |
| | | // mode = 'dismissable'; |
| | | // } |
| | | // const evt = new ShowToastEvent({ |
| | | // title: title, |
| | | // message: message, |
| | | // variant: variant, |
| | | // mode: mode |
| | | // }); |
| | | // this.dispatchEvent(evt); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightningCommunity__Page</target> |
| | | <target>lightningCommunity__Default</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| New file |
| | |
| | | <template> |
| | | <template if:true={showSpinner}> |
| | | <lightning-spinner size="medium" variant="brand"></lightning-spinner> |
| | | </template> |
| | | <c-common-toast></c-common-toast> |
| | | <div style="border: 1px solid #D4D4D4;border-radius:5px;"> |
| | | |
| | | <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <div> |
| | | <!-- <p style="font-size: 18px;"><strong>取消拆盒</strong></p> --> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>取消拆盒</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </div> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="取消拆盒确认" title="取消拆盒确认" onclick={saveConfirm}></lightning-button></td> --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="取消拆盒确认" onclick={saveConfirm}>取消拆盒确认</button> |
| | | </div> |
| | | </div> |
| | | <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;"> |
| | | <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 16px"> |
| | | <strong>BarCode录入</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </div> |
| | | |
| | | <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> --> |
| | | <table> |
| | | <colgroup> |
| | | <col width="160px" /> |
| | | <col width="100px" /> |
| | | <col width="10px" /> |
| | | <col width="70px" /> |
| | | <col width="100px" /> |
| | | <col width="10px" /> |
| | | <col width="90px" /> |
| | | <col width="100px" /> |
| | | <col width="10px" /> |
| | | <col width="85px" /> |
| | | <col width="100px" /> |
| | | <col width="10px" /> |
| | | <col width="70px" /> |
| | | <col width="100px" /> |
| | | </colgroup> |
| | | <tbody> |
| | | <tr> |
| | | <td></td> |
| | | <td align="right" class="searchName">BarCode</td> |
| | | <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label="" |
| | | onchange={handleChange}></lightning-textarea></td> |
| | | <td align="right"></td> |
| | | <td></td> |
| | | <td style="width: 200px;"> |
| | | <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="获取明细" onclick={getDetails}>获取明细</button> |
| | | <!-- <lightning-button variant="brand" class='lexstyle' label="获取明细" title="获取明细" onclick={getDetails} |
| | | ></lightning-button> --> |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <!-- </div> --> |
| | | </div> |
| | | |
| | | <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> |
| | | <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>取消拆盒明细</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </div> |
| | | <div style="padding:10px;"> |
| | | |
| | | <!-- <div style="height: 300px;"> --> |
| | | <!-- <template if:true={showTable}> --> |
| | | <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns} |
| | | onrowselection={getSelectedRows} hide-checkbox-column="true" |
| | | selected-rows={selectedRows} class="wrapped-header-datatable"> |
| | | </c-lex-custom-lightning-datatable> |
| | | <!-- </template> --> |
| | | <!-- </div> --> |
| | | |
| | | </div> |
| | | </div> |
| | | <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px"> |
| | | <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> |
| | | <table> |
| | | <tr> |
| | | <td> |
| | | <lightning-layout> |
| | | <lightning-layout-item padding="around-small"> |
| | | <p style="font-size: 18px"> |
| | | <strong>错误明细</strong> |
| | | </p> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | </div> |
| | | |
| | | <div style="padding:10px;"> |
| | | <lightning-datatable |
| | | key-field="id" data={errorDetail} columns={column} |
| | | onrowselection={getSelectedRows} hide-checkbox-column="true" |
| | | selected-rows={selectedRows} class="wrapped-header-datatable"> |
| | | </lightning-datatable> |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | |
| | | </div> |
| | | |
| | | </template> |
| New file |
| | |
| | | import { LightningElement, wire, api, track } from 'lwc'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import oninit from "@salesforce/apex/LexCancelRemoveBoxController.init"; |
| | | import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails" |
| | | import saveConfirm from '@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm'; |
| | | |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | const columns = [ |
| | | { |
| | | label: '消耗品名称', |
| | | fieldName: 'Name__c', |
| | | hideDefaultActions: true, |
| | | wrapText:true |
| | | // initialWidth: 350, |
| | | |
| | | }, |
| | | { |
| | | label: '规格', |
| | | fieldName: 'ProductPacking_list_manual__c', |
| | | hideDefaultActions: true, |
| | | cellAttributes: { alignment: "right" }, |
| | | initialWidth: 50, |
| | | |
| | | }, |
| | | { |
| | | label: 'CFDA状态', |
| | | fieldName: 'CFDA_Status__c', |
| | | hideDefaultActions: true, |
| | | initialWidth: 200, |
| | | |
| | | }, |
| | | { |
| | | label: '注册证编码号', |
| | | fieldName: 'Report_Product_Approbation__c', |
| | | hideDefaultActions: true, |
| | | initialWidth: 200, |
| | | }, |
| | | { |
| | | label: '注册证效期', |
| | | fieldName: 'Report_Product_Expiration__c', |
| | | hideDefaultActions: true, |
| | | // initialWidth: 250, |
| | | }, |
| | | { |
| | | label: 'BarCode', |
| | | fieldName: 'Bar_Code__c', |
| | | hideDefaultActions: true, |
| | | initialWidth: 400, |
| | | } |
| | | ]; |
| | | |
| | | const column = [ |
| | | { |
| | | label: '消耗品名称', |
| | | fieldName: 'Name__c', |
| | | hideDefaultActions: true, |
| | | |
| | | }, |
| | | { |
| | | label: 'BarCode', |
| | | fieldName: 'Bar_Code__c', |
| | | hideDefaultActions: true, |
| | | |
| | | } |
| | | , |
| | | { |
| | | label: '错误原因', |
| | | fieldName: 'ErrorReason', |
| | | hideDefaultActions: true, |
| | | } |
| | | ]; |
| | | |
| | | |
| | | export default class LexCancelRemoveBox extends LightningElement { |
| | | columns = columns; |
| | | column = column; |
| | | @track selectedRows = []; |
| | | @track data = []; |
| | | @track errorDetail = []; |
| | | |
| | | // 显示 |
| | | @track showTable = false |
| | | @track showSpinner = false; |
| | | |
| | | //数据构成 |
| | | @track accountName |
| | | @track userWorkLocation |
| | | @track agencyProType |
| | | @track barcode = '' |
| | | @track saveFLGbln = false |
| | | @track dataSize = 0; |
| | | |
| | | renderedCallback() { |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | console.log("Custom styles loaded"); |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error loading custom styles"); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | connectedCallback() { |
| | | console.log('初始化'); |
| | | // this.showTable = false; |
| | | oninit().then((result) => { |
| | | result = JSON.parse(JSON.stringify(result)); |
| | | console.log('result =' + JSON.stringify(result)); |
| | | if (result.status = 'Success') { |
| | | console.log('result'); |
| | | this.agencyProType = result.entity.agencyProType; |
| | | this.userWorkLocation = result.entity.userWorkLocation; |
| | | this.accountName = result.entity.accountName; |
| | | // this.data = JSON.parse(result.entity.codPageRecords); |
| | | // this.showTable = true; |
| | | } else { |
| | | this.showMyToast('初始化失败',result.msg,'error'); |
| | | } |
| | | }).catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | |
| | | //录入 |
| | | getDetails() { |
| | | this.showSpinner = true; |
| | | searchDeatail({ |
| | | accountName: this.accountName, |
| | | userWorkLocation: this.userWorkLocation, |
| | | agencyProType: this.agencyProType, |
| | | barcode: this.barcode |
| | | }).then((result) => { |
| | | result = JSON.parse(JSON.stringify(result)); |
| | | console.log('result =' + JSON.stringify(result)); |
| | | if (result.status == 'Success') { |
| | | console.log('成功'); |
| | | this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy); |
| | | this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror); |
| | | this.dataSize = result.entity.dataSize; |
| | | for (let i in this.data) { |
| | | this.data[i]['Name__c'] = this.data[i].Prod.Name__c; |
| | | this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c; |
| | | this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c; |
| | | this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c; |
| | | this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c; |
| | | this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c; |
| | | } |
| | | // this.showTable = true; |
| | | for (let i in this.errorDetail) { |
| | | this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c; |
| | | this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c; |
| | | this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason; |
| | | } |
| | | // this.showTables = true; |
| | | this.showSpinner = false; |
| | | } else{ |
| | | this.showMyToast('获取失败',result.msg,'error'); |
| | | this.showSpinner = false; |
| | | } |
| | | }).catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | |
| | | } |
| | | //获取当前输入值 |
| | | handleChange(event) { |
| | | let value = event.detail.value; |
| | | console.log('value' + value); |
| | | this.barcode = value; |
| | | console.log('this.barcode' + this.barcode); |
| | | } |
| | | |
| | | |
| | | saveConfirm() { |
| | | let msg = "确认取消拆盒吗"; |
| | | if (this.dataSize>0) { |
| | | if (confirm(msg) == true) { |
| | | this.CancelRemoveBox(); |
| | | } |
| | | } else { |
| | | this.CancelRemoveBox(); |
| | | } |
| | | } |
| | | CancelRemoveBox(){ |
| | | this.showSpinner = true; |
| | | saveConfirm({ |
| | | saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data), |
| | | accountName: this.accountName, |
| | | userWorkLocation: this.userWorkLocation, |
| | | agencyProType: this.agencyProType |
| | | }).then((result) => { |
| | | result = JSON.parse(JSON.stringify(result)); |
| | | console.log('result保存 = ' + JSON.stringify(result)); |
| | | if (result.status == 'Success') { |
| | | this.saveFLGbln = result.entity.saveFLGbln; |
| | | // this.showSpinner = false; |
| | | if(this.saveFLGbln){ |
| | | this.showMyToast(result.msg,'','success'); |
| | | this.showSpinner = false; |
| | | |
| | | |
| | | } |
| | | } else { |
| | | this.showMyToast('取消拆盒失败',result.msg,'error'); |
| | | this.showSpinner = false; |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | |
| | | } |
| | | showMyToast(title, message, variant) { |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if(variant == 'success'){ |
| | | iconName = 'utility:check'; |
| | | }else{ |
| | | iconName = 'utility:error'; |
| | | } |
| | | if(message != ''){ |
| | | content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; |
| | | }else{ |
| | | content = '<h2><strong>'+title+'<strong/></h2>'; |
| | | } |
| | | this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js-meta.xml
force-app/main/default/lwc/lexConsumable/lexConsumable.css
force-app/main/default/lwc/lexConsumable/lexConsumable.html
force-app/main/default/lwc/lexConsumable/lexConsumable.js
force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css
force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml
force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customAttachmentType.html
force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html
force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml
force-app/main/default/lwc/lexInventory/lexInventory.css
force-app/main/default/lwc/lexInventory/lexInventory.html
force-app/main/default/lwc/lexInventory/lexInventory.js
force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml
force-app/main/default/lwc/lexLookup/LexLookup.css
force-app/main/default/lwc/lexLookup/lexLookup.html
force-app/main/default/lwc/lexLookup/lexLookup.js
force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml
force-app/main/default/lwc/lexNewOrder/lexNewOrder.html
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js-meta.xml
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js-meta.xml
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml
force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js-meta.xml
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml
force-app/main/default/lwc/lexTopPage/lexTopPage.css
force-app/main/default/lwc/lexTopPage/lexTopPage.html
force-app/main/default/lwc/lexTopPage/lexTopPage.js
force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml
force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html
force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html
force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html
force-app/main/default/lwc/myCustomTypeDatatable/customName.html
force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html
force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html
force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html
force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml
force-app/main/default/lwc/navigateToRecord/navigateToRecord.html
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml
force-app/main/default/lwc/paginator/paginator.css
force-app/main/default/lwc/paginator/paginator.html
force-app/main/default/lwc/paginator/paginator.js
force-app/main/default/lwc/paginator/paginator.js-meta.xml
force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml
force-app/main/default/triggers/ContentDocumentLink.trigger
force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml
force-app/main/default/triggers/ContentDocumentTrigger.trigger
force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
force-app/main/default/triggers/ContentVersionTrigger.trigger
force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml |