修改
This commit is contained in:
@@ -110,10 +110,7 @@ public class SparePartController {
|
|||||||
@PostMapping("/repairs")
|
@PostMapping("/repairs")
|
||||||
@Log("报修")
|
@Log("报修")
|
||||||
@ApiOperation("报修")
|
@ApiOperation("报修")
|
||||||
public ResponseEntity<Object> repairs(@RequestParam("file") MultipartFile file, @RequestParam Map map, HttpServletRequest request) {
|
public ResponseEntity<Object> repairs(@RequestParam Map map, HttpServletRequest request) {
|
||||||
MultipartHttpServletRequest params=((MultipartHttpServletRequest) request);
|
|
||||||
List<MultipartFile> files = ((MultipartHttpServletRequest) request)
|
|
||||||
.getFiles("file");
|
|
||||||
return new ResponseEntity<>(sparePartService.repairs(map,request),HttpStatus.OK);
|
return new ResponseEntity<>(sparePartService.repairs(map,request),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.nl.pda.sb.service.impl;
|
package org.nl.pda.sb.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@@ -12,33 +11,22 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.domain.LocalStorage;
|
import org.nl.domain.LocalStorage;
|
||||||
import org.nl.exception.BadRequestException;
|
|
||||||
import org.nl.ext.acs.service.WmsToAcsService;
|
|
||||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||||
import org.nl.modules.system.service.DictDetailService;
|
import org.nl.modules.system.service.DictDetailService;
|
||||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.pda.exception.PdaRequestException;
|
import org.nl.pda.exception.PdaRequestException;
|
||||||
import org.nl.pda.pdm.service.PdmWorkTaskService;
|
|
||||||
import org.nl.pda.sb.service.SparePartService;
|
import org.nl.pda.sb.service.SparePartService;
|
||||||
import org.nl.pda.st.vehicle.service.impl.EmptyVehicleServiceImpl;
|
|
||||||
import org.nl.service.LocalStorageService;
|
import org.nl.service.LocalStorageService;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
import org.nl.utils.SpringContextHolder;
|
|
||||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
|
||||||
import org.nl.wms.basedata.st.service.StorattrService;
|
import org.nl.wms.basedata.st.service.StorattrService;
|
||||||
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
||||||
import org.nl.wms.sb.core.service.SparePartInService;
|
|
||||||
import org.nl.wms.sb.core.service.SparePartOutService;
|
import org.nl.wms.sb.core.service.SparePartOutService;
|
||||||
import org.nl.wms.sb.core.service.impl.SparePartInServiceImpl;
|
import org.nl.wms.sb.core.service.impl.SparePartInServiceImpl;
|
||||||
import org.nl.wms.sb.repair.service.DevicerepairmstService;
|
import org.nl.wms.sb.repair.service.DevicerepairmstService;
|
||||||
import org.nl.wms.sb.upkeep.service.DevicemaintenancemstService;
|
import org.nl.wms.sb.upkeep.service.DevicemaintenancemstService;
|
||||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
|
||||||
import org.nl.wms.st.core.task.InTask;
|
|
||||||
import org.nl.wms.st.vehicle.task.ProductTask;
|
|
||||||
import org.nl.wql.WQL;
|
import org.nl.wql.WQL;
|
||||||
import org.nl.wql.core.bean.WQLObject;
|
import org.nl.wql.core.bean.WQLObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -313,9 +301,12 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
rows = new JSONArray();
|
rows = new JSONArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONObject content = new JSONObject();
|
||||||
|
content.put("rows",rows);
|
||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("rows", rows);
|
returnjo.put("rows", rows);
|
||||||
|
returnjo.put("content", content);
|
||||||
returnjo.put("desc", "查询成功!");
|
returnjo.put("desc", "查询成功!");
|
||||||
return returnjo;
|
return returnjo;
|
||||||
}
|
}
|
||||||
@@ -340,6 +331,16 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
if (!row.getString("invstatus").equals("03")) {
|
if (!row.getString("invstatus").equals("03")) {
|
||||||
throw new PdaRequestException("只能对开始状态的单据结束保养");
|
throw new PdaRequestException("只能对开始状态的单据结束保养");
|
||||||
}
|
}
|
||||||
|
String maint_id = row.getString("maint_id");
|
||||||
|
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceDtl");
|
||||||
|
// 1.明细中的是否完成 :必须为全部完成
|
||||||
|
JSONArray dtlArr = dtlTab.query("maint_id = '" + maint_id + "'").getResultJSONArray(0);
|
||||||
|
for (int i = 0; i < dtlArr.size(); i++) {
|
||||||
|
JSONObject json = dtlArr.getJSONObject(i);
|
||||||
|
if (StrUtil.equals(json.getString("isfinish"), "0")) {
|
||||||
|
throw new PdaRequestException("保养项目未完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
devicemaintenancemstService.endMaintain(row);
|
devicemaintenancemstService.endMaintain(row);
|
||||||
}
|
}
|
||||||
if (operate.equals("3")) {
|
if (operate.equals("3")) {
|
||||||
@@ -369,7 +370,7 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
for (int i = 0; i < dtlArr.size(); i++) {
|
for (int i = 0; i < dtlArr.size(); i++) {
|
||||||
JSONObject json = dtlArr.getJSONObject(i);
|
JSONObject json = dtlArr.getJSONObject(i);
|
||||||
if (StrUtil.equals(json.getString("isfinish"), "0")) {
|
if (StrUtil.equals(json.getString("isfinish"), "0")) {
|
||||||
throw new BadRequestException("保养项目未完成");
|
throw new PdaRequestException("保养项目未完成");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +378,7 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
String update_optname = jsonMst.getString("update_optname");
|
String update_optname = jsonMst.getString("update_optname");
|
||||||
String update_time = jsonMst.getString("update_time");
|
String update_time = jsonMst.getString("update_time");
|
||||||
if (ObjectUtil.isEmpty(update_optname) || ObjectUtil.isEmpty(update_time)) {
|
if (ObjectUtil.isEmpty(update_optname) || ObjectUtil.isEmpty(update_time)) {
|
||||||
throw new BadRequestException("保养人或保养时间不能为空");
|
throw new PdaRequestException("保养人或保养时间不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新保养单主表
|
// 更新保养单主表
|
||||||
@@ -389,7 +390,7 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
// 更新设备档案表
|
// 更新设备档案表
|
||||||
JSONObject jsonFile = fileTab.query("devicerecord_id ='" + jsonMainMst.getString("devicerecord_id") + "' and is_delete = '0'").uniqueResult(0);
|
JSONObject jsonFile = fileTab.query("devicerecord_id ='" + jsonMainMst.getString("devicerecord_id") + "' and is_delete = '0'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonFile)) {
|
if (ObjectUtil.isEmpty(jsonFile)) {
|
||||||
throw new BadRequestException("此设备档案不存在");
|
throw new PdaRequestException("此设备档案不存在");
|
||||||
}
|
}
|
||||||
jsonFile.put("status", "40");
|
jsonFile.put("status", "40");
|
||||||
fileTab.update(jsonFile);
|
fileTab.update(jsonFile);
|
||||||
@@ -562,7 +563,7 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
devicerepairmstService.startRepair(row);
|
devicerepairmstService.startRepair(row);
|
||||||
}
|
}
|
||||||
if (operate.equals("2")) {
|
if (operate.equals("2")) {
|
||||||
if (!row.getString("invstatus").equals("02")) {
|
if (!row.getString("invstatus").equals("03")) {
|
||||||
throw new PdaRequestException("只能对开始状态的单据进行委外维修");
|
throw new PdaRequestException("只能对开始状态的单据进行委外维修");
|
||||||
}
|
}
|
||||||
devicerepairmstService.outRepair(row);
|
devicerepairmstService.outRepair(row);
|
||||||
@@ -599,7 +600,7 @@ public class SparePartServiceImpl implements SparePartService {
|
|||||||
// 2.更新设备档案表
|
// 2.更新设备档案表
|
||||||
JSONObject jsonFile = fileTab.query("devicerecord_id = '" + row.getString("devicerecord_id") + "' and is_delete= '0'").uniqueResult(0);
|
JSONObject jsonFile = fileTab.query("devicerecord_id = '" + row.getString("devicerecord_id") + "' and is_delete= '0'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonFile)) {
|
if (ObjectUtil.isEmpty(jsonFile)) {
|
||||||
throw new BadRequestException("此设备没有档案");
|
throw new PdaRequestException("此设备没有档案");
|
||||||
}
|
}
|
||||||
jsonFile.put("status", "30");
|
jsonFile.put("status", "30");
|
||||||
fileTab.update(jsonFile);
|
fileTab.update(jsonFile);
|
||||||
|
|||||||
@@ -180,7 +180,7 @@
|
|||||||
mst.maint_code,
|
mst.maint_code,
|
||||||
file.device_code,
|
file.device_code,
|
||||||
file.device_name,
|
file.device_name,
|
||||||
( CASE WHEN mst.invstatus = '02' THEN '提交' WHEN mst.invstatus = '03' THEN '开始' WHEN mst.invstatus = '04' THEN '确认' END ) AS status_name,
|
( CASE WHEN mst.invstatus = '02' THEN '提交' WHEN mst.invstatus = '03' THEN '开始' WHEN mst.invstatus = '04' THEN '结束' END ) AS status_name,
|
||||||
mst.plan_start_date,
|
mst.plan_start_date,
|
||||||
mst.maint_id,
|
mst.maint_id,
|
||||||
mst.invstatus
|
mst.invstatus
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
mst.invstatus IN ('02','03','04')
|
mst.invstatus IN ('02','03','04')
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.maintenance_flag = "2"
|
OPTION 输入.maintenance_flag = "2"
|
||||||
mst.invstatus = '05'
|
mst.invstatus = '04'
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
AND
|
AND
|
||||||
file.device_code = 输入.device_code
|
file.device_code = 输入.device_code
|
||||||
@@ -226,7 +226,8 @@
|
|||||||
) AS status_name,
|
) AS status_name,
|
||||||
mst.plan_start_date,
|
mst.plan_start_date,
|
||||||
mst.repair_id,
|
mst.repair_id,
|
||||||
mst.invstatus
|
mst.invstatus,
|
||||||
|
file.devicerecord_id
|
||||||
FROM
|
FROM
|
||||||
EM_BI_DeviceRepairMst mst
|
EM_BI_DeviceRepairMst mst
|
||||||
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.devicerecord_id
|
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.devicerecord_id
|
||||||
@@ -236,7 +237,7 @@
|
|||||||
mst.invstatus IN ('02','03','04','05','06')
|
mst.invstatus IN ('02','03','04','05','06')
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.maintenance_flag = "2"
|
OPTION 输入.maintenance_flag = "2"
|
||||||
mst.invstatus = '07'
|
mst.invstatus = '06'
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
AND
|
AND
|
||||||
file.device_code = 输入.device_code
|
file.device_code = 输入.device_code
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class SparePartInServiceImpl implements SparePartInService {
|
|||||||
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl");
|
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl");
|
||||||
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis");
|
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis");
|
||||||
|
|
||||||
String iostorinvdtl_id = whereJson.getString("iostorinvdtl_id");
|
String iostorinvdtl_id = whereJson.getJSONObject("dtl_row").getString("iostorinvdtl_id");
|
||||||
|
|
||||||
JSONObject dtl_jo = dtl_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
|
JSONObject dtl_jo = dtl_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
|
||||||
if (!dtl_jo.getString("bill_status").equals("40")) {
|
if (!dtl_jo.getString("bill_status").equals("40")) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class SparePartReturnServiceImpl implements SparePartReturnService {
|
|||||||
if (!StrUtil.isEmpty(out_code)) {
|
if (!StrUtil.isEmpty(out_code)) {
|
||||||
map.put("out_code", out_code + "%");
|
map.put("out_code", out_code + "%");
|
||||||
}
|
}
|
||||||
String in_code = (String) whereJson.get("end_time");
|
String in_code = (String) whereJson.get("in_code");
|
||||||
if (!StrUtil.isEmpty(in_code)) {
|
if (!StrUtil.isEmpty(in_code)) {
|
||||||
map.put("in_code", in_code + "%");
|
map.put("in_code", in_code + "%");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,18 +169,25 @@
|
|||||||
mb.material_code,
|
mb.material_code,
|
||||||
mb.material_name,
|
mb.material_name,
|
||||||
mb.material_spec,
|
mb.material_spec,
|
||||||
detail.label AS source_type_name,
|
(
|
||||||
|
case when base_bill_type = '010901' then '领用出库'
|
||||||
|
when base_bill_type IN ('01','02') then '维修单'
|
||||||
|
else ''
|
||||||
|
end
|
||||||
|
) AS source_type_name,
|
||||||
mst.bill_code,
|
mst.bill_code,
|
||||||
detail.label AS source_bill_type_name,
|
(
|
||||||
|
case when base_bill_type = '010901' then '领用出库'
|
||||||
|
when base_bill_type IN ('01','02') then '维修单'
|
||||||
|
else ''
|
||||||
|
end
|
||||||
|
) AS source_bill_type_name,
|
||||||
IFNULL(a.assign_qty,0) AS assign_qty,
|
IFNULL(a.assign_qty,0) AS assign_qty,
|
||||||
(dtl.plan_qty - IFNULL(a.assign_qty,0)) AS unassign_qty
|
(dtl.plan_qty - IFNULL(a.assign_qty,0)) AS unassign_qty
|
||||||
FROM
|
FROM
|
||||||
em_bi_iostorinvdtl dtl
|
em_bi_iostorinvdtl dtl
|
||||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||||
LEFT JOIN em_bi_iostorinv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
LEFT JOIN em_bi_iostorinv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
||||||
LEFT JOIN sys_dict_detail detail ON detail.`value` = dtl.source_bill_type
|
|
||||||
INNER JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
|
||||||
AND dict.`name` LIKE 'EM_DEVICE_WX_INVTYPE%'
|
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
count(*) AS assign_qty,
|
count(*) AS assign_qty,
|
||||||
@@ -194,10 +201,6 @@
|
|||||||
) a ON a.iostorinvdtl_id = dtl.iostorinvdtl_id
|
) a ON a.iostorinvdtl_id = dtl.iostorinvdtl_id
|
||||||
where
|
where
|
||||||
mst.bill_code = 输入.bill_code
|
mst.bill_code = 输入.bill_code
|
||||||
|
|
||||||
UNION
|
|
||||||
|
|
||||||
|
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
Reference in New Issue
Block a user