| | |
| | | RcSorcDate__c, |
| | | SorcAcceptDate__c, |
| | | SorcOgzDate__c, |
| | | RcOgzDate__c, |
| | | Returns_Product_waySAP__c, |
| | | DnNO__c, |
| | | OgzAcceptDate__c, |
| | |
| | | // 备品出借记录 查找备品出借一览明细的 产品型号 |
| | | Map < id, List < SparePartsLendingRecord >> rentalMap = getrentalMap(repairIdList); |
| | | |
| | | String downSDt = ''; |
| | | String downEDt = ''; |
| | | String upSDt = ''; |
| | | String upEDt = ''; |
| | | |
| | | |
| | | for (Repair__c repair: repairList) { |
| | |
| | | info.OgzAcceptDate = NFMUtil.formatDateTime2Str(repair.OgzAcceptDateTime__c);//OGZ受理日(小程序) |
| | | //update wangweipeng 2022/02/16 end |
| | | |
| | | info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c); |
| | | // info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c);RcOgzDate__c |
| | | |
| | | //update zhangyuheng 2022/03/07 |
| | | info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.RcOgzDate__c); |
| | | |
| | | info.cus_dn = repair.DnNO__c; |
| | | //修理增加OTS运单号字段 thh 20220308 start |
| | | info.OTSRepairOrder = repair.OTSRepairOrder__c; |
| | | //修理增加OTS运单号字段 thh 20220308 end |
| | | |
| | | //报价日、初次报价日、RC修理品RC受理日(小程序)时间判断 zyh 20220315 start |
| | | downSDt = DownStartDt(); |
| | | downEDt = DownEndDt(); |
| | | upSDt = UpStartDt(); |
| | | upEDt = UpEndDt(); |
| | | //定义下班时间 |
| | | if (String.valueOf(info.FirstQuotationDate) >= String.valueOf(downSDt) && String.valueOf(info.FirstQuotationDate) <= String.valueOf(downEDt)) { |
| | | info.FirstQuotationDate = DownDt();//初次报价日 |
| | | } |
| | | if (String.valueOf(info.RCacceptanceDate) >= String.valueOf(downSDt) && String.valueOf(info.RCacceptanceDate) <= String.valueOf(downEDt)) { |
| | | info.RCacceptanceDate = DownDt();//4.修理品RC受理日 |
| | | } |
| | | if (String.valueOf(info.quotationDate) >= String.valueOf(downSDt) && String.valueOf(info.quotationDate) <= String.valueOf(downEDt)) { |
| | | info.quotationDate = DownDt();//报价日 |
| | | } |
| | | //定义上班时间 |
| | | if (String.valueOf(info.FirstQuotationDate) >= String.valueOf(upSDt) && String.valueOf(info.FirstQuotationDate) <= String.valueOf(upEDt)) { |
| | | info.FirstQuotationDate = UpDt();//初次报价日 |
| | | } |
| | | if (String.valueOf(info.RCacceptanceDate) >= String.valueOf(upSDt) && String.valueOf(info.RCacceptanceDate) <= String.valueOf(upEDt)) { |
| | | info.RCacceptanceDate = UpDt();//4.修理品RC受理日 |
| | | } |
| | | if (String.valueOf(info.quotationDate) >= String.valueOf(upSDt) && String.valueOf(info.quotationDate) <= String.valueOf(upEDt)) { |
| | | info.quotationDate = UpDt();//报价日 |
| | | } |
| | | //报价日、初次报价日、RC修理品RC受理日(小程序)时间判断 zyh 20220315 end |
| | | repairs.add(info); |
| | | System.debug('repairs1:' + repairs); |
| | | } |
| | | logstr += '\nend'; |
| | | if (repairs.size() > 0) { |
| | |
| | | logstr += ex.getMessage(); |
| | | iflog.ErrorLog__c += ex.getMessage() + '\n'; |
| | | iflog.ErrorLog__c += ex.getStackTraceString() + '\n'; |
| | | rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, ex, null); |
| | | if(!Test.isRunningTest()){ |
| | | rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, ex, null); |
| | | } |
| | | } |
| | | iflog.Log__c = logstr; |
| | | upsert iflog; |
| | |
| | | |
| | | public static Set < Id > NFM603_Ids = new Set < Id > (); |
| | | // public static Map<Id,Id> rprIdMap = new Map<Id,Id>(); |
| | | |
| | | |
| | | public static void NFM603Trigger(List < Repair__c > newList, Map < Id, Repair__c > newMap, List < Repair__c > oldList, Map < Id, Repair__c > oldMap) { |
| | | List < String > rprIds = new List < String > (); |
| | | Map < Id, Id > rprIdMap = new Map < Id, Id > (); |
| | |
| | | Repair__c oldrpr = oldMap.get(rpr.Id); |
| | | // 修理有报修子单号,并且 待发送AWS为false 发送给AWS |
| | | if (String.isNotBlank(rpr.RepairSubOrder__c) && !rpr.AwaitToSendAWS__c) { |
| | | if (((rpr.status__c == '0.申请完毕' || rpr.status__c == '1.受理完毕') && (oldrpr.SAP_Transfer_time__c == null && rpr.SAP_Transfer_time__c != null)) || (rpr.Address_type__c == 'X' && (rpr.Address_Type_Index__c != oldrpr.Address_Type_Index__c))) { |
| | | if (((rpr.status__c == '0.申请完毕' || rpr.status__c == '1.受理完毕') && (oldrpr.SAP_Transfer_time__c == null && rpr.SAP_Transfer_time__c != null)) || |
| | | (rpr.Address_type__c == 'X' && (rpr.Address_Type_Index__c != oldrpr.Address_Type_Index__c)) || |
| | | // 2022/4/6 zhangyuheng update start |
| | | (rpr.OTSRepairOrder__c != oldrpr.OTSRepairOrder__c) || // OTS订单号有值,发送AWS |
| | | // 2022/4/6 zhangyuheng update end |
| | | // 2022/4/7 zhangyuheng update start |
| | | (rpr.DeliveryLogisticsNo__c != oldrpr.DeliveryLogisticsNo__c) || // 送修物流单号有值,发送AWS |
| | | // ((rpr.Discount_Price_formula__c != oldrpr.Discount_Price_formula__c) && rpr.Repair_Firstestimated_Date_formula__c != null) || // 报价金额发生改变且初次报价日有值,发送AWS |
| | | ((rpr.Returns_Product_waySAP__c != oldrpr.Returns_Product_waySAP__c) && rpr.Repair_Shipped_DateTime__c != null) || // 送修方式发生改变且寄送日有值,发送AWS |
| | | // 2022/4/7 zhangyuheng update end |
| | | // 2022/4/18 zhangyuheng update start |
| | | (rpr.FSE_ApplyForRepair_time__c != oldrpr.FSE_ApplyForRepair_time__c) || // FSE申请修理日发生改变,发送AWS |
| | | (rpr.Repair_Ordered_DateTime__c != oldrpr.Repair_Ordered_DateTime__c) || // 4.修理品RC受理日(小程序)发生改变,发送AWS |
| | | (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) || // 初次报价日(不用)发生改变,发送AWS |
| | | (rpr.Repair_Shipped_DateTime__c != oldrpr.Repair_Shipped_DateTime__c) || // 11.RC修理品返送日(小程序)发生改变,发送AWS |
| | | (rpr.Repair_Final_Inspection_DateTime__c != oldrpr.Repair_Final_Inspection_DateTime__c) || // 10.最终检测日(小程序)发生改变,发送AWS |
| | | (rpr.Agreed_DateTime__c != oldrpr.Agreed_DateTime__c) || //7.用户同意日(小程序)发生改变,发送AWS |
| | | (rpr.Agreed_Date__c != oldrpr.Agreed_Date__c) || // 7.用户同意日发生改变,发送AWS |
| | | (rpr.engineerSendDate__c != oldrpr.engineerSendDate__c) //修理品寄送日发生改变,发送AWS |
| | | // 2022/4/18 zhangyuheng update start |
| | | ) { |
| | | |
| | | if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | rprIdMap.put(rpr.Id, rpr.Id); |
| | | } |
| | | } |
| | | // 测试环境测试用,上线前请注掉 |
| | | /*if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) { |
| | | // 2022/4/19 zhangyuheng update start |
| | | // 如果同期中的修理报价(Repair_Quotation_Id__c)为空,判断初次报价日和报价金额 |
| | | if (rpr.Repair_Quotation_Id__c != oldrpr.Repair_Quotation_Id__c) { |
| | | if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIds.add(rpr.Id); |
| | | rprIdMap.put(rpr.Id, rpr.Id); |
| | | } |
| | | } |
| | | if (rpr.Repair_Shipped_Date__c != oldrpr.Repair_Shipped_Date__c) { |
| | | if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | rprIdMap.put(rpr.Id, rpr.Id); |
| | | if (rpr.Repair_Quotation_Id__c == null) { |
| | | // 如果初次报价日(不用)或折扣后金额(不用)发生改变,发送AWS |
| | | if (rpr.Discount_Price__c != oldrpr.Discount_Price__c || rpr.Repair_Estimated_Date__c != oldrpr.Repair_Estimated_Date__c) { |
| | | if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | rprIdMap.put(rpr.Id, rpr.Id); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | // 如果同期中的修理报价(Repair_Quotation_Id__c)不为空,在RepairQuoteTrigger.ChangeRepair进行判断触发 |
| | | // 2022/4/19 zhangyuheng update end |
| | | |
| | | // 2022/4/6 zhangyuheng update start |
| | | //OTS订单号有值,发送AWS |
| | | // if ((oldrpr.OTSRepairOrder__c == null && String.isNotBlank(rpr.OTSRepairOrder__c)) || rpr.OTSRepairOrder__c != oldrpr.OTSRepairOrder__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 2022/4/6 zhangyuheng update end |
| | | // 2022/4/7 zhangyuheng update start |
| | | //送修物流单号有值,发送AWS |
| | | // if ((oldrpr.DeliveryLogisticsNo__c == null && String.isNotBlank(rpr.DeliveryLogisticsNo__c)) || rpr.DeliveryLogisticsNo__c != oldrpr.DeliveryLogisticsNo__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | //报价金额发生改变且初次报价日有值,发送AWS |
| | | // if ((rpr.Discount_Price_formula__c != oldrpr.Discount_Price_formula__c) && rpr.Repair_Firstestimated_Date_formula__c != null) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // if ((rpr.Returns_Product_waySAP__c != oldrpr.Returns_Product_waySAP__c) && rpr.Repair_Shipped_DateTime__c != null) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 2022/4/7 zhangyuheng update end |
| | | // 2022/4/18 zhangyuheng update start |
| | | // FSE申请修理日发生改变,发送AWS |
| | | // if (rpr.FSE_ApplyForRepair_time__c != oldrpr.FSE_ApplyForRepair_time__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 4.修理品RC受理日(小程序)发生改变,发送AWS |
| | | // if (rpr.Repair_Ordered_DateTime__c != oldrpr.Repair_Ordered_DateTime__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 初次报价日(不用)发生改变,发送AWS |
| | | // if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 11.RC修理品返送日(小程序)发生改变,发送AWS |
| | | // if (rpr.Repair_Shipped_DateTime__c != oldrpr.Repair_Shipped_DateTime__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 10.最终检测日(小程序)发生改变,发送AWS |
| | | // if (rpr.Repair_Final_Inspection_DateTime__c != oldrpr.Repair_Final_Inspection_DateTime__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 2022/4/18 zhangyuheng update end |
| | | // 测试环境测试用,上线前请注掉 |
| | | // if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // // rprIds.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // if (rpr.Repair_Shipped_Date__c != oldrpr.Repair_Shipped_Date__c) { |
| | | // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | | // NFM603Controller.NFM603_Ids.add(rpr.Id); |
| | | // rprIdMap.put(rpr.Id, rpr.Id); |
| | | // } |
| | | // } |
| | | // 测试环境测试用,上线前请注掉 |
| | | } |
| | | |
| | |
| | | iflog.Type__c = LOG_TYPE; |
| | | iflog.Log__c = 'callout start\n'; |
| | | insert iflog; |
| | | NFM603Controller.callout(iflog.Id, rprIds); |
| | | NFM603Controller.executefuture(iflog, rprIds); |
| | | } |
| | | } else { |
| | | if (Trigger.isUpdate) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //报价日、初次报价日、RC修理品RC受理日(小程序)时间方法 zyh 20220315 start |
| | | //下班开始时间 |
| | | public static String DownStartDt(){ |
| | | String timenow = Datetime.now().format('yyyyMMddHHmmss'); |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '173001'; |
| | | } |
| | | //下班结束时间 |
| | | public static String DownEndDt(){ |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '235959'; |
| | | } |
| | | //上班开始时间 |
| | | public static String UpStartDt(){ |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '000000'; |
| | | } |
| | | //上班结束时间 |
| | | public static String UpEndDt(){ |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '084459'; |
| | | } |
| | | //上班定义时间 |
| | | public static String UpDt(){ |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '090000'; |
| | | } |
| | | //下班定义时间 |
| | | public static String DownDt(){ |
| | | String dt = NFMUtil.formatDate2Str(Date.today()); |
| | | String rtn = null; |
| | | if (dt == null) { |
| | | return rtn; |
| | | } |
| | | rtn = String.valueOf(dt); |
| | | rtn = rtn.replaceAll('-', ''); |
| | | if (rtn >= '40001231') { |
| | | rtn = '99991231'; |
| | | } else if (rtn < '19000101') { |
| | | rtn = '19000101'; |
| | | } |
| | | return rtn + '170000'; |
| | | } |
| | | //报价日、初次报价日、RC修理品RC受理日(小程序)时间方法 zyh 20220315 end |
| | | |
| | | } |