| | |
| | | main(rowData_Id); |
| | | } |
| | | global static void main(String rowData_Id) { |
| | | |
| | | // WLIG-CCT9UG 20220512 lt start |
| | | Map<String, String> transferMap = new Map<String, String>(); |
| | | List<BatchIF_Transfer__c> transferList = [select Table__c, |
| | | Column__c, |
| | | External_value__c, |
| | | Internal_value__c |
| | | from BatchIF_Transfer__c |
| | | where Dropped_Flag__c = false |
| | | and (Table__c = 'NFM110') |
| | | ]; |
| | | for (BatchIF_Transfer__c t : transferList) { |
| | | transferMap.put(t.Column__c + t.External_value__c, t.Internal_value__c); |
| | | } |
| | | // WLIG-CCT9UG 20220512 lt end |
| | | |
| | | // 在进行NFM110处理时跳过消耗品明细2 arrived return 处理 HWAG-B3D9UV 2018/8/14 start |
| | | StaticParameter.ConsumableAssetHanderTrigger = true; |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | |
| | | // 修改虚拟合同生成逻辑 gzw 20210324 end |
| | | from Product2 |
| | | where ProductCode_Ext__c in :productCodeList]; |
| | | //修改 OER-SMART 产品不生成虚拟维修合同 |
| | | // and Category5__c = 'OER-SMART' |
| | | Map<String, Product2> prdsMap = new Map<String, Product2>(); |
| | | for (Product2 prd : prdList) { |
| | | prdsMap.put(prd.ProductCode_Ext__c, prd); |
| | |
| | | List<Opportunity> oppList = [Select Id, Purchase_Type__c, Opportunity_No__c, Strategic_department_Class_Name__c, |
| | | Sales_Root__c, SAP_Province__c, Trade__c, Agency1__c, Agency1__r.Name, |
| | | Agency1__r.OCM_man_province_txt__c, Opportunity_Category__c |
| | | // ,SAP_Province__c //20230323 lt DB202303088261 两票制 add |
| | | From Opportunity Where Opportunity_No__c IN :inquiryNoList]; |
| | | // update by gzw 2020-04-27 start |
| | | Map<String, Opportunity> oppMap = new Map<String, Opportunity>(); |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | netProviston : netProviston * Decimal.valueOf(Label.Account_Exc); |
| | | } |
| | | // 20210108 gzw add 虚拟合同号追加 end |
| | | |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | // if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | // delAst.OSHFLG__c = true ; |
| | | // } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | |
| | | // CHAN-BGYE7C end |
| | | // CHAN-BJX9EQ Start |
| | | delAst.NMPA_Approbation_No__c = dnInfo.NMPA_NO; |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | // update by vivek srart 2020-02-13 |
| | | // orderdetInfo.Account_province_txt__c = accsMap.get(infoH.EndUserNo).OCM_man_province_txt__c; |
| | | // update by vivek end 2020-02-13 |
| | | orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | orderdetInfo.Sterilization_limit__c = null; |
| | | }else{ |
| | | orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | //orderdetInfo.Bar_Code__c = dnInfo.Barcode; |
| | | orderdetInfo.DeliveryNote__c = infoH.DeliveryNote; |
| | | // update by Gaozw start 20200514 |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | |
| | | rac.Asset_Model_No__c = prdSearch.Asset_Model_No__c; |
| | | rac.Consumable_order_minor__c = order.Id; |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = accsMap.get(infoH.EndUserNo).Id; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | | } else { |
| | |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | } |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | // WLIG-CCT9UG 20220512 lt start |
| | | //ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | ast.warrantyType__c = NFMUtil.getMapValue(transferMap, 'warrantyType__c', string.valueof(dnInfo.GuaranteeType), iflog); |
| | | // WLIG-CCT9UG 20220512 lt end |
| | | if (String.isNotBlank(dnInfo.MaintenancePrice)) { |
| | | Decimal mPrice = Decimal.valueOf(dnInfo.MaintenancePrice.trim()); |
| | | ast.Maintenance_Price_Year__c = oppMap.get(InquiryNoStr).Trade__c == '内貿'? |
| | |
| | | } |
| | | rac.Asset_Model_No__c = prdSearch.Asset_Model_No__c; |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = accsMap.get(infoH.EndUserNo).Id; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | ) { |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | /* 原代码 |
| | | iflog.ErrorLog__c += 'Warning! Asset' + '[' + dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '] Exist. This asset is skipped.\n'; |
| | |
| | | gPrice : gPrice * Decimal.valueOf(Label.Account_Exc); |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | } |
| | | ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | // WLIG-CCT9UG 20220512 lt start |
| | | //ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | ast.warrantyType__c = NFMUtil.getMapValue(transferMap, 'warrantyType__c', string.valueof(dnInfo.GuaranteeType), iflog); |
| | | // WLIG-CCT9UG 20220512 lt end |
| | | if (String.isNotBlank(dnInfo.MaintenancePrice)) { |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | Decimal mPrice = Decimal.valueOf(dnInfo.MaintenancePrice.trim()); |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | ) { |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | |
| | | //原代码: |
| | |
| | | gPrice : gPrice * Decimal.valueOf(Label.Account_Exc); |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | } |
| | | ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | // WLIG-CCT9UG 20220512 lt start |
| | | //ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | ast.warrantyType__c = NFMUtil.getMapValue(transferMap, 'warrantyType__c', string.valueof(dnInfo.GuaranteeType), iflog); |
| | | // WLIG-CCT9UG 20220512 lt end |
| | | if (String.isNotBlank(dnInfo.MaintenancePrice)) { |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | Decimal mPrice = Decimal.valueOf(dnInfo.MaintenancePrice.trim()); |
| | |
| | | // rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | // rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | // 自动修改最终用户 update by vivek end |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = oppMap.get(InquiryNoStr).Agency1__c; |
| | |
| | | |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | logstr += dnInfo.SorLMark == 'S' ? dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo : dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')'; |
| | | } else { |
| | |
| | | iflog.ErrorLog__c += 'Warning! Asset' + '[' + errMes + '] Exist. This asset is skipped.\n'; |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | // CHAN-BUY3GV end |
| | | // 原代码 |
| | |
| | | gPrice : gPrice * Decimal.valueOf(Label.Account_Exc); |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | } |
| | | ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | // WLIG-CCT9UG 20220512 lt start |
| | | //ast.warrantyType__c = dnInfo.GuaranteeType; |
| | | ast.warrantyType__c = NFMUtil.getMapValue(transferMap, 'warrantyType__c', string.valueof(dnInfo.GuaranteeType), iflog); |
| | | // WLIG-CCT9UG 20220512 lt end |
| | | if (String.isNotBlank(dnInfo.MaintenancePrice)) { |
| | | // 20210108 gzw add 虚拟合同号追加 start |
| | | Decimal mPrice = Decimal.valueOf(dnInfo.MaintenancePrice.trim()); |
| | |
| | | ast.Department_Class__c = olympus_return.ParentId; //'Olympus社内 其他' |
| | | ast.AccountID = olympus_return.Id; //'Olympus社内 其他 退货' |
| | | ast.Order_No__c = ''; |
| | | ast.Posting_Date__c = null; |
| | | // CHAN-CCR6MW gzw 【委托】【保有设备】保有设备发货日逻辑 start |
| | | // ast.Posting_Date__c = null; |
| | | ast.Posting_Date__c = Date.today(); |
| | | // CHAN-CCR6MW gzw 【委托】【保有设备】保有设备发货日逻辑 end |
| | | ast.DeliveryNote__c = ''; |
| | | ast.InstallDate = null; |
| | | ast.Guarantee_period_for_products__c = null; |