| | |
| | | public String QuotationGread; //报价等级(new) |
| | | public String detectionResult; //检测结果 |
| | | public String cus_dn; //DN号 |
| | | //修理增加OTS运单号字段 thh 20220308 start |
| | | public String OTSRepairOrder; |
| | | //修理增加OTS运单号字段 thh 20220308 end |
| | | |
| | | //送修物流 |
| | | public String deliveryLogisticsMode; //送修物流方式 |
| | | public String engineerSendDate; //工程师修理品寄送日 |
| | |
| | | RcSorcDate__c, |
| | | SorcAcceptDate__c, |
| | | SorcOgzDate__c, |
| | | RcOgzDate__c, |
| | | Returns_Product_waySAP__c, |
| | | DnNO__c, |
| | | OgzAcceptDate__c, |
| | | DeliveryLogisticsAnnotation__c, |
| | | Department_Class__r.Management_Code__c |
| | | Department_Class__r.Management_Code__c, |
| | | Repair_Ordered_DateTime__c, |
| | | Repair_Inspection_DateTime__c, |
| | | repair_cancel_dateTime__c, |
| | | RcSorcDateTime__c, |
| | | SorcAcceptDateTime__c, |
| | | OgzAcceptDateTime__c, |
| | | part_arrangement_complete_DateTime__c, |
| | | Repair_Start_DateTime__c, |
| | | Repair_Completed_DateTime__c, |
| | | Repair_Final_Inspection_DateTime__c, |
| | | Repair_Shipped_DateTime__c, |
| | | Repair_Discount_approval_DateTime_form__c, |
| | | Agreed_DateTime__c, |
| | | //修理增加OTS运单号字段 thh 20220308 start |
| | | OTSRepairOrder__c |
| | | //修理增加OTS运单号字段 thh 20220308 end |
| | | from Repair__c where id in: repairOrderIdList |
| | | ]; |
| | | } |
| | |
| | | // 备品出借记录 查找备品出借一览明细的 产品型号 |
| | | Map < id, List < SparePartsLendingRecord >> rentalMap = getrentalMap(repairIdList); |
| | | |
| | | String downSDt = ''; |
| | | String downEDt = ''; |
| | | String upSDt = ''; |
| | | String upEDt = ''; |
| | | |
| | | |
| | | for (Repair__c repair: repairList) { |
| | |
| | | info.FaultDesc = reasonMap.get(repair.id); //故障描述List |
| | | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| | | info.deliveryLogisticsMode = repair.DeliveryLogisticsMode__c; //送修物流方式======自己写字段 |
| | | info.engineerSendDate = NFMUtil.formatDate2StrDateTime(repair.engineerSendDate__c); // 工程师修理品寄送日 |
| | | //update wangweipeng 2022/02/16 start |
| | | //info.engineerSendDate = NFMUtil.formatDate2StrDateTime(repair.engineerSendDate__c); // 工程师修理品寄送日 |
| | | info.engineerSendDate = NFMUtil.formatDateTime2Str(repair.engineerSendDate__c); // 工程师修理品寄送日 |
| | | //update wangweipeng 2022/02/16 end |
| | | info.deliveryLogisticsNo = repair.DeliveryLogisticsNo__c; //送修物流单号======自己写字段 |
| | | info.returnLogisticsMode = repair.ReturnLogisticsMode__c; //返送物流方式======自己写字段 |
| | | info.DeliveryLogisticsAnnotation = repair.DeliveryLogisticsAnnotation__c; //送修物流信息备注 |
| | |
| | | info.returnLogisticsSendTime = NFMUtil.formatDateTime2Str(repair.ReturnOrderSendTime__c); //返送物流发送时间======自己写字段 |
| | | info.returnLogisticsReceiveTime = NFMUtil.formatDateTime2Str(repair.ReturnLogisticsReceiveTime__c); //返送物流签收时间======自己写字段 |
| | | info.repairproductsRevDate = NFMUtil.formatDate2StrDateTime(repair.On_Site_Repair_Order_Date__c); //故障品接收日 |
| | | info.FSErepairApplyDate = NFMUtil.formatDate2StrDateTime(repair.FSE_ApplyForRepair_Day__c); //FSE修理申请日======自己写字段 |
| | | //update wangweipeng 2022/02/16 start |
| | | //info.FSErepairApplyDate = NFMUtil.formatDate2StrDateTime(repair.FSE_ApplyForRepair_Day__c); //FSE修理申请日======自己写字段 |
| | | info.FSErepairApplyDate = NFMUtil.formatDateTime2Str(repair.FSE_ApplyForRepair_time__c); // FSE修理申请时间 |
| | | //update wangweipeng 2022/02/16 end |
| | | info.logisticsSendDate = NFMUtil.formatDateTime2Str(repair.LogisticsSendTime__c); //物流发送日======自己写字段 |
| | | info.logisticsReceiveDate = NFMUtil.formatDateTime2Str(repair.LogisticsReceiveTime__c); //物流接收日======自己写字段 |
| | | info.SAPrepairApplyDate = NFMUtil.formatDate2StrDateTime(repair.SAP_Transfer_day__c); //SAP修理申请日======自己写字段 |
| | | info.RCacceptanceDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Ordered_Date__c); //修理品RC受理日 |
| | | info.inspectionDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Inspection_Date__c); //修理检测日 |
| | | info.FirstQuotationDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Firstestimated_Date_formula__c); //初次报价日 |
| | | //update wangweipeng 2022/02/16 start |
| | | //info.SAPrepairApplyDate = NFMUtil.formatDate2StrDateTime(repair.SAP_Transfer_day__c); //SAP修理申请日======自己写字段 |
| | | info.SAPrepairApplyDate = NFMUtil.formatDateTime2Str(repair.SAP_Transfer_time__c); // SAP修理申请时间 |
| | | //info.RCacceptanceDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Ordered_Date__c); //修理品RC受理日 |
| | | info.RCacceptanceDate = NFMUtil.formatDateTime2Str(repair.Repair_Ordered_DateTime__c); //4.修理品RC受理日(小程序) |
| | | //info.inspectionDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Inspection_Date__c); //修理检测日 |
| | | info.inspectionDate = NFMUtil.formatDateTime2Str(repair.Repair_Inspection_DateTime__c); //5.修理检测日(小程序) |
| | | info.FirstQuotationDate = NFMUtil.formatDate2StrDateNewTime(repair.Repair_Firstestimated_Date_formula__c); //初次报价日 |
| | | //info.priceApprovalDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Discount_approval_Date_formula__c); //减价申请批准日 |
| | | info.priceApprovalDate = NFMUtil.formatDateTime2Str(repair.Repair_Discount_approval_DateTime_form__c); //减价申请批准日(小程序) |
| | | info.quotationDate = NFMUtil.formatDate2StrDateNewTime(repair.Repair_Quotation_date__c); //报价日 |
| | | //info.cancelRepairDate = NFMUtil.formatDate2StrDateTime(repair.repair_cancel_date__c); //修理取消日 |
| | | info.cancelRepairDate = NFMUtil.formatDateTime2Str(repair.repair_cancel_dateTime__c); //修理取消日(小程序) |
| | | //info.userAgreeDAte = NFMUtil.formatDate2StrDateTime(repair.Agreed_Date__c); //用户同意日 |
| | | info.userAgreeDAte = NFMUtil.formatDateTime2Str(repair.Agreed_DateTime__c); //7.用户同意日(小程序) |
| | | //info.partsCompleteDate = NFMUtil.formatDate2StrDateTime(repair.part_arrangement_complete__c); //零件齐备完毕日 |
| | | info.partsCompleteDate = NFMUtil.formatDateTime2Str(repair.part_arrangement_complete_DateTime__c); //零件齐备完毕日 |
| | | //info.repairStartDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Start_Date__c); //修理开始日 |
| | | info.repairStartDate = NFMUtil.formatDateTime2Str(repair.Repair_Start_DateTime__c); //8.修理开始日(小程序) |
| | | //info.repairCompleteDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Completed_Date__c); //修理完成日 |
| | | info.repairCompleteDate = NFMUtil.formatDateTime2Str(repair.Repair_Completed_DateTime__c); //9.修理完成日(小程序) |
| | | //info.finalTestDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Final_Inspection_Date__c); //最终检测日 |
| | | info.finalTestDate = NFMUtil.formatDateTime2Str(repair.Repair_Final_Inspection_DateTime__c); //10.最终检测日(小程序) |
| | | //update wangweipeng 2022/02/16 end |
| | | info.planQuotationDate = NFMUtil.formatDateTime2Str(repair.PlanQuotationTime__c); //计划报价日======自己写字段 |
| | | info.ActualQuotationDate = NFMUtil.formatDateTime2Str(repair.ActualQuotationStartTime__c); //实际报价日======自己写字段 |
| | | info.quotationDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Quotation_date__c); //报价日 |
| | | info.priceApprovalDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Discount_approval_Date_formula__c); //减价申请批准日 |
| | | info.finalQuotationPrice = repair.Discount_Price_formula__c; //最终报价金额======自己写字段 |
| | | info.userAgreeDAte = NFMUtil.formatDate2StrDateTime(repair.Agreed_Date__c); //用户同意日 |
| | | info.partsCompleteDate = NFMUtil.formatDate2StrDateTime(repair.part_arrangement_complete__c); //零件齐备完毕日 |
| | | info.repairStartDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Start_Date__c); //修理开始日 |
| | | info.repairCompleteExpectedDate = NFMUtil.formatDate2StrDateTime(repair.Planned_Repair_Completed_Date__c); //修理完成预计日 |
| | | info.repairCompleteDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Completed_Date__c); //修理完成日 |
| | | info.finalTestDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Final_Inspection_Date__c); //最终检测日 |
| | | |
| | | info.RCreturnDate = null; //RC修理品返送日 |
| | | info.ReturnsProductWay = null; //返品方式 |
| | | if (repair.Repair_Shipped_Date__c != null && String.isNotBlank(repair.Returns_Product_waySAP__c)) { |
| | | info.RCreturnDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Shipped_Date__c); //RC修理品返送日 |
| | | //info.RCreturnDate = NFMUtil.formatDate2StrDateTime(repair.Repair_Shipped_Date__c); //RC修理品返送日 |
| | | info.RCreturnDate = NFMUtil.formatDateTime2Str(repair.Repair_Shipped_DateTime__c); //RC修理品返送日 wangweipeng 2022/02/16 |
| | | info.ReturnsProductWay = repair.Returns_Product_waySAP__c; //返品方式 |
| | | } |
| | | |
| | |
| | | info.payCompleteDate = NFMUtil.formatDate2StrDateTime(repair.Received_Date__c); //回款完毕日 |
| | | info.incomeReckoninDate = NFMUtil.formatDate2StrDateTime(repair.Facility_Return_Receipt_Collection_Date__c); //收入计入日 |
| | | info.abandonPayDate = NFMUtil.formatDate2StrDateTime(repair.BaddebtsDate__c); //放弃回款日 |
| | | info.cancelRepairDate = NFMUtil.formatDate2StrDateTime(repair.repair_cancel_date__c); //修理取消日 |
| | | info.repairOrderCompleteDate = NFMUtil.formatDate2StrDateTime(repair.RepairOrder_Complete_Day__c); //修理单完成日 |
| | | info.applySpareEquip = repair.if_Rental_Apply__c; //是否申请备品======自己写字段 |
| | | info.supplySpareEquip = repair.Offer_Rental_New__c + ''; //是否提供备品 |
| | | info.SparePartsLendingRecord = rentalMap.get(repair.Id); |
| | | |
| | | //update wangweipeng 2022/02/16 start |
| | | //info.RcSorcDate = NFMUtil.formatDate2StrDateTime(repair.RcSorcDate__c);//RC转SORC日 |
| | | info.RcSorcDate = NFMUtil.formatDateTime2Str(repair.RcSorcDateTime__c);//RC转SORC日(小程序) |
| | | //info.SorcAcceptDate = NFMUtil.formatDate2StrDateTime(repair.SorcAcceptDate__c);//SORC受理日 |
| | | info.SorcAcceptDate = NFMUtil.formatDateTime2Str(repair.SorcAcceptDateTime__c);//SORC受理日(小程序) |
| | | //info.OgzAcceptDate = NFMUtil.formatDate2StrDateTime(repair.OgzAcceptDate__c);//OGZ受理日 |
| | | info.OgzAcceptDate = NFMUtil.formatDateTime2Str(repair.OgzAcceptDateTime__c);//OGZ受理日(小程序) |
| | | //update wangweipeng 2022/02/16 end |
| | | |
| | | info.RcSorcDate = NFMUtil.formatDate2StrDateTime(repair.RcSorcDate__c); |
| | | info.SorcAcceptDate = NFMUtil.formatDate2StrDateTime(repair.SorcAcceptDate__c); |
| | | info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c); |
| | | info.OgzAcceptDate = NFMUtil.formatDate2StrDateTime(repair.OgzAcceptDate__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) { |
| | |
| | | |
| | | 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 > (); |
| | |
| | | rprIdMap.put(rpr.Id, rpr.Id); |
| | | } |
| | | } |
| | | |
| | | // 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.Discount_Price_formula__c != null) && 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 |
| | | // 测试环境测试用,上线前请注掉 |
| | | if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) { |
| | | if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //报价日、初次报价日、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 |
| | | |
| | | } |