| | |
| | | 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 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; |
| | | |
| | |
| | | //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; |
| | | // 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; |
| | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | |
| | | System.debug('pandiandetailsMap====>'+pandiandetailsMap); |
| | | initStandardController(); |
| | | makepagerecords(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[1]; |
| | | sortOrder = new String[]{' ',' ','↓'}; |
| | | // 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; |
| | | accountid = Useracc.Accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__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<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, |
| | |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName]; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size())); |
| | | //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 == '盒'){ |
| | |
| | | } |
| | | //consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | listCut(); |
| | | |
| | | |
| | | |
| | | system.debug('ConsumableorderdetailsRecordsview'+ConsumableorderdetailsRecordsview); |
| | | System.debug('ConsumableorderdetailsRecordsview==>'+ConsumableorderdetailsRecordsview); |
| | | // data.put('ConsumableorderdetailsRecordsview',ConsumableorderdetailsRecordsview); |
| | | |
| | | // for(ConsumableorderdetailsInfo con: ConsumableorderdetailsRecordsview){ |
| | | // consumableorderdetailsviewRecords.add(con); |
| | | // } |
| | | System.debug('consumableorderdetailsviewRecords===>'+consumableorderdetailsviewRecords); |
| | | System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords); |
| | | |
| | | |
| | | |
| | | 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; |
| | |
| | | //========20160311======ADD_End================================== |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC){ |
| | | 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); |
| | |
| | | |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | |
| | | // consumableorderdetailsRecords = consumableorderdetailsRecordsLWC; |
| | | System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords); |
| | | System.debug('agencyProType===>'+sqlagencyProType); |
| | | System.debug('accountName===>'+accountName); |
| | | |
| | | |
| | | |
| | | /* BarCodelist做成 */ |
| | |
| | | } |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | res.code = 400; |
| | | res.status = 'fail'; |
| | | res.msg = 'barcode为空'; |
| | | return res; |
| | | // return; |
| | | |
| | | //分页 |
| | | 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; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | 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 単位 |
| | |
| | | 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)); |
| | |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | data.put('pandiandetailsMap',JSON.serialize(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; |
| | | } |
| | | |
| | | public static ResponseBodyLWC saveConfirm(Boolean iSinventory,String consumableorderdetailsRecordsLWC) { |
| | | save(iSinventory,consumableorderdetailsRecordsLWC); |
| | | // LexInventoryController.oinoi |
| | | return null; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC) { |
| | | 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>(); |
| | |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | return new ResponseBodyLWC('Error',500, '请先点【BarCode录入】', ''); |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | // return null; |
| | | } |
| | |
| | | ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407 |
| | | } |
| | | |
| | | }catch (Exception ex) { |
| | | }catch (Exception e) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(ex); |
| | | return null; |
| | | // 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); |
| | |
| | | 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) { |
| | | |