rev:维修单填报新增备件出库
This commit is contained in:
@@ -296,6 +296,7 @@ public class EmBiIostorinvOutServiceImpl extends ServiceImpl<EmBiIostorinvOutMap
|
||||
stIvtIostorinvYl.setDetail_count(rows.size());
|
||||
stIvtIostorinvYl.setRemark(whereJson.getString("remark"));
|
||||
stIvtIostorinvYl.setWorkshop_id(whereJson.getString("workshop_id"));
|
||||
stIvtIostorinvYl.setSource_id(whereJson.getString("source_id"));
|
||||
|
||||
return stIvtIostorinvYl;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.device_manage.ios.service.iostorInv.EmBiIostorinvOutService;
|
||||
import org.nl.wms.device_manage.repair.service.DevicerepairmstService;
|
||||
import org.nl.wms.device_manage.repair.service.dto.DevicerepairmstDto;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
|
||||
@@ -49,6 +50,9 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
// private final StorattrService storattrService;
|
||||
// private final SparePartOutServiceImpl sparePartOutService;
|
||||
|
||||
@Autowired
|
||||
private EmBiIostorinvOutService emBiIostorinvOutService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@@ -169,6 +173,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
jsonMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonMst.put("input_optid", currentUserId);
|
||||
jsonMst.put("input_optname", nickName);
|
||||
jsonMst.put("input_time", DateUtil.now());
|
||||
@@ -208,6 +213,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("estimaterepair_times", whereJson.getString("estimaterepair_times"));
|
||||
jsonMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
@@ -260,8 +266,8 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl");
|
||||
|
||||
JSONArray resultJSONArray = dtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(resultJSONArray)) throw new BadRequestException("维修项目为空");
|
||||
/* JSONArray resultJSONArray = dtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(resultJSONArray)) throw new BadRequestException("维修项目为空");*/
|
||||
|
||||
JSONObject json = mstTab.query("repair_id ='" + whereJson.getString("repair_id") + "'").uniqueResult(0);
|
||||
json.put("invstatus", "02");
|
||||
@@ -283,7 +289,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
JSONObject jsonReMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0);
|
||||
jsonReMst.put("invstatus", "03");
|
||||
jsonReMst.put("estimaterepair_times", whereJson.getString("estimaterepair_times"));
|
||||
jsonReMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
// jsonReMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonReMst.put("real_start_date", DateUtil.now());
|
||||
reMstTab.update(jsonReMst);
|
||||
// 2.更新设备档案表
|
||||
@@ -322,7 +328,9 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void endRepair(JSONObject whereJson) {
|
||||
public void endRepair(JSONObject whereJson2) {
|
||||
JSONObject whereJson = whereJson2.getJSONObject("form");
|
||||
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
@@ -374,6 +382,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
JSONObject jsonReMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0);
|
||||
jsonReMst.put("invstatus", "06");
|
||||
jsonReMst.put("real_end_date", DateUtil.now());
|
||||
jsonReMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", DateUtil.now());
|
||||
@@ -397,6 +406,28 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
jsonLife.put("create_name",nickName);
|
||||
jsonLife.put("create_time", DateUtil.now());
|
||||
lifeTab.insert(jsonLife);
|
||||
|
||||
// 5.判断是否需要新增备件出库单
|
||||
Boolean aSwitch = whereJson.getBoolean("switch");
|
||||
if (ObjectUtil.isEmpty(aSwitch)) aSwitch = false;
|
||||
if (aSwitch) {
|
||||
whereJson2.put("repair_code", jsonReMst.getString("repair_code"));
|
||||
this.createIos(whereJson2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createIos(JSONObject whereJson) {
|
||||
JSONObject mst = whereJson.getJSONObject("form2");
|
||||
JSONArray tableDataDtl = mst.getJSONArray("tableDataDtl");
|
||||
|
||||
// 准备参数
|
||||
mst.put("biz_date", DateUtil.now());
|
||||
mst.put("tableData", tableDataDtl);
|
||||
mst.put("source_id", whereJson.getString("repair_code"));
|
||||
mst.put("remark", "由维修单创建");
|
||||
|
||||
emBiIostorinvOutService.create(mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -407,19 +438,27 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
WQLObject reMstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); // 设备维修单主表
|
||||
WQLObject reDtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl"); // 设备维修单明细表
|
||||
WQLObject recordTab = WQLObject.getWQLObject("EM_BI_DeviceRepairRecord"); // 设备维修单情况记录表
|
||||
WQLObject itemTab = WQLObject.getWQLObject("em_bi_devicerepairitems"); // 设备维修项目表
|
||||
|
||||
// 1.更新维修主表
|
||||
JSONObject jsonReMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0);
|
||||
// jsonReMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonReMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonReMst.put("product_person_name", whereJson.getString("product_person_name"));
|
||||
jsonReMst.put("update_time", DateUtil.now());
|
||||
reMstTab.update(jsonReMst);
|
||||
// 2.更新明细表
|
||||
|
||||
// 2.删除所有明细重新插入
|
||||
reDtlTab.delete("repair_id = '"+whereJson.getString("repair_id")+"'");
|
||||
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonRedtl = reDtlTab.query("repair_dtl_id = '" + json.getString("repair_dtl_id") + "'").uniqueResult(0);
|
||||
jsonRedtl.put("isfinish", json.getString("isfinish"));
|
||||
reDtlTab.update(jsonRedtl);
|
||||
JSONObject jsonObject = tableData.getJSONObject(i);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("repair_dtl_id", org.nl.common.utils.IdUtil.getStringId());
|
||||
json.put("repair_id", whereJson.getString("repair_id"));
|
||||
json.put("repair_item_id", jsonObject.getString("repair_item_id"));
|
||||
json.put("isfinish", jsonObject.getString("isfinish"));
|
||||
reDtlTab.insert(json);
|
||||
}
|
||||
|
||||
// 3.插入设备维修单情况记录表
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -20,6 +21,8 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.device_manage.repair.service.DevicerepairrequestService;
|
||||
import org.nl.wms.device_manage.repair.service.dto.DevicerepairrequestDto;
|
||||
import org.nl.wms.masterdata_manage.service.em.EmBiRepairDeviceService;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
import org.nl.wms.system_manage.service.dept.ISysDeptService;
|
||||
import org.nl.wms.system_manage.service.user.ISysUserService;
|
||||
@@ -50,6 +53,9 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private EmBiRepairDeviceService emBiRepairDeviceService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
@@ -272,7 +278,15 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
|
||||
jsonRequest.put("process_time", DateUtil.now());
|
||||
requestTab.update(jsonRequest);
|
||||
|
||||
// 3.插入设备维修单主表
|
||||
// 3.判断此设备是否有对应的维修人
|
||||
List<EmBiRepairDevice> repairDeviceDaoList = emBiRepairDeviceService.list(
|
||||
new QueryWrapper<EmBiRepairDevice>().lambda()
|
||||
.eq(EmBiRepairDevice::getDevice_code, jsonFile.getString("device_code"))
|
||||
);
|
||||
|
||||
if (repairDeviceDaoList.size() > 1) throw new BadRequestException("此设备对应维修人员超过2人,请检查!");
|
||||
|
||||
// 4.插入设备维修单主表
|
||||
JSONObject jsonReMst = new JSONObject();
|
||||
jsonReMst.put("repair_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonReMst.put("repair_code", CodeUtil.getNewCode("REPAIR_CODE"));
|
||||
@@ -292,6 +306,10 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
|
||||
jsonReMst.put("input_time", DateUtil.now());
|
||||
jsonReMst.put("sysdeptid", 1);
|
||||
jsonReMst.put("syscompanyid",1);
|
||||
if (ObjectUtil.isNotEmpty(repairDeviceDaoList)){
|
||||
SysUser userDao = iSysUserService.getById(repairDeviceDaoList.get(0).getUser_id());
|
||||
jsonReMst.put("update_optname", userDao.getPerson_name());
|
||||
}
|
||||
reMstTab.insert(jsonReMst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,4 +48,10 @@ public class DevicePairQueryController {
|
||||
return new ResponseEntity<>(devicePairQueryService.getDeviceInfo(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getIosMst")
|
||||
@ApiOperation("获取备件出库单信息")
|
||||
public ResponseEntity<Object> getIosMst(@RequestBody JSONObject whereJson){
|
||||
return new ResponseEntity<>(devicePairQueryService.getIosMst(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,4 +32,7 @@ public interface DevicePairQueryService {
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject getDeviceInfo(JSONObject whereJson);
|
||||
|
||||
JSONObject getIosMst(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,13 +5,17 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.device_manage.ios.service.iostorInv.EmBiIostorinvOutService;
|
||||
import org.nl.wms.device_manage.ios.service.iostorInv.dao.EmBiostorinv;
|
||||
import org.nl.wms.device_manage.stat.service.DevicePairQueryService;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
import org.nl.wms.system_manage.service.dept.ISysDeptService;
|
||||
@@ -33,6 +37,9 @@ public class DevicePairQueryServiceImpl implements DevicePairQueryService {
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private EmBiIostorinvOutService emBiIostorinvOutService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
|
||||
@@ -194,4 +201,13 @@ public class DevicePairQueryServiceImpl implements DevicePairQueryService {
|
||||
json.put("tableData2", relArr);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getIosMst(JSONObject whereJson) {
|
||||
EmBiostorinv dao = emBiIostorinvOutService.getOne(
|
||||
new QueryWrapper<EmBiostorinv>().lambda()
|
||||
.eq(EmBiostorinv::getSource_id, whereJson.getString("repair_code"))
|
||||
);
|
||||
return JSON.parseObject(JSONObject.toJSONString(dao));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user