diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java
index 99ca0a42..118bdea4 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java
@@ -63,6 +63,13 @@ public class RepairTaskDetails extends BaseEntity {
*/
@ApiModelProperty(value = "维修总量")
private int repairNum;
+
+ /**
+ * 维修方式: 1内部 2外部返厂 3报废
+ */
+ @ApiModelProperty(value = "维修方式: 1内部 2外部 3报废")
+ private Integer repairType;
+
/**
* 维修合格数量
*/
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
index 7a0dfc73..9af4f1f8 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
@@ -373,18 +373,20 @@ public class RepairServiceImpl implements RepairService {
throw new ServiceException("请选择返厂厂家");
}
- // 数量管理--外部返厂维修
+ // 数量管理--外部返厂维修 -- 记录表插入数据
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
- repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
- .setRepairType(outRepairType).setRepairNum(partList.get(0).getRepairNum()).setScrapNum(0)
- .setPartName(partList.get(0).getPartName()).setPartType(partList.get(0).getPartType())
- .setRepairContent(partList.get(0).getRepairContent()).setSupplierId(partList.get(0).getSupplierId())
- .setPartNum(partList.get(0).getPartNum()).setRepairer(loginUser.getUsername())
- .setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0)))
- .setCreateBy(loginUser.getUsername());
+ for (RepairPartDetails repairPartDetails : partList) {
+ repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
+ .setRepairType(outRepairType).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0)
+ .setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType())
+ .setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
+ .setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
+ .setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(new BigDecimal(0)))
+ .setCreateBy(loginUser.getUsername());
- // 新增【维修记录表】
- repairMapper.addRecord(repairApplyRecord);
+ // 新增【维修记录表】
+ repairMapper.addRecord(repairApplyRecord);
+ }
sfCosts = countPartCosts(partList, sfCosts);
// TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
@@ -503,10 +505,10 @@ public class RepairServiceImpl implements RepairService {
// 内部维修
if (bean.getRepairType() == inRepairType) {
+ RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
// 遍历配件列表,判断配件类型,收费还是不收费
for (RepairPartDetails partDetails : partList) {
// 维修记录表信息
- RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(bean.getRepairType());
if (manageType == manageTypeByCode) {
repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0);
@@ -547,6 +549,11 @@ public class RepairServiceImpl implements RepairService {
repairMapper.addRecord(repairApplyRecord);
}
}
+
+ BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0));
+ // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
+ // SQL: 新增【维修费用记录表】
+ repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1");
}
// 外部维修
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
index 45459e42..d183abf8 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
@@ -22,13 +22,15 @@
- insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,company_id)
- values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(),#{companyId});
+ insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,
+ create_by,create_time,company_id)
+ values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(),
+ #{companyId});
- insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status)
- values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0');
+ insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,repair_type)
+ values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.repairType});