备件手持
This commit is contained in:
@@ -288,6 +288,7 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
work_task.put("status", "99");
|
||||
work_task.put("end_id", currentUserId);
|
||||
work_task.put("end_name", nickName);
|
||||
work_task.put("finish_type", "01");
|
||||
work_task.put("end_time", now);
|
||||
}
|
||||
WQLObject.getWQLObject("PDM_BI_WorkTask").update(work_task);
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
mu.unit_name,
|
||||
task.create_time AS start_time,
|
||||
task.end_time,
|
||||
( CASE WHEN task.STATUS = '99' THEN '1' WHEN task.STATUS IN ( '20', '30' ) THEN '2' ELSE '3' END ) AS color_flag
|
||||
( CASE WHEN task.STATUS = '99' THEN '1' WHEN task.STATUS = '30' THEN '2' ELSE '3' END ) AS color_flag
|
||||
FROM
|
||||
pdm_bi_formula task
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = task.material_id
|
||||
@@ -168,7 +168,7 @@
|
||||
mu.unit_name,
|
||||
task.create_time AS start_time,
|
||||
task.end_time,
|
||||
( CASE WHEN task.STATUS = '99' THEN '1' WHEN task.STATUS IN ( '20', '30' ) THEN '2' ELSE '3' END ) AS color_flag
|
||||
( CASE WHEN task.STATUS = '99' THEN '1' WHEN task.STATUS = '30' THEN '2' ELSE '3' END ) AS color_flag
|
||||
FROM
|
||||
pdm_bi_formula task
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = task.material_id
|
||||
|
||||
@@ -10,11 +10,11 @@ import org.nl.annotation.Log;
|
||||
import org.nl.pda.sb.service.SparePartService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -23,23 +23,121 @@ import java.util.Map;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持工序任务")
|
||||
@Api(tags = "手持设备")
|
||||
@RequestMapping("api/pda/sb/")
|
||||
@Slf4j
|
||||
public class SparePartController {
|
||||
private final SparePartService sparePartService;
|
||||
|
||||
@PostMapping("/queryReturnDis")
|
||||
@Log("扫描工艺指令卡")
|
||||
@ApiOperation("扫描工艺指令卡")
|
||||
@Log("领用还回查询")
|
||||
@ApiOperation("领用还回查询")
|
||||
public ResponseEntity<Object> queryReturnDis(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryReturnDis(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmReturn")
|
||||
@Log("扫描工艺指令卡")
|
||||
@ApiOperation("扫描工艺指令卡")
|
||||
@Log("确认入库")
|
||||
@ApiOperation("确认入库")
|
||||
public ResponseEntity<Object> confirmReturn(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.confirmReturn(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryIODtl")
|
||||
@Log("出入库单查询")
|
||||
@ApiOperation("出入库单查询")
|
||||
public ResponseEntity<Object> queryIODtl(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryIODtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryIODis")
|
||||
@Log("备品备件扫描")
|
||||
@ApiOperation("备品备件扫描")
|
||||
public ResponseEntity<Object> queryIODis(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryIODis(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmDis")
|
||||
@Log("确认")
|
||||
@ApiOperation("确认")
|
||||
public ResponseEntity<Object> confirmDis(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.confirmDis(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryMaintenance")
|
||||
@Log("查询设备保养执行")
|
||||
@ApiOperation("查询设备保养执行")
|
||||
public ResponseEntity<Object> queryMaintenance(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryMaintenance(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/maintOpeate")
|
||||
@Log("设备保养单操作")
|
||||
@ApiOperation("设备保养单操作")
|
||||
public ResponseEntity<Object> maintOpeate(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.maintOpeate(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryMaintenanceDtl")
|
||||
@Log("保养明细查询")
|
||||
@ApiOperation("保养明细查询")
|
||||
public ResponseEntity<Object> queryMaintenanceDtl(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryMaintenanceDtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/dtlConfirm")
|
||||
@Log("确认")
|
||||
@ApiOperation("确认")
|
||||
public ResponseEntity<Object> dtlConfirm(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.dtlConfirm(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/errorType")
|
||||
@Log("故障类型")
|
||||
@ApiOperation("故障类型")
|
||||
public ResponseEntity<Object> errorType(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.errorType(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/errorLevel")
|
||||
@Log("故障等级")
|
||||
@ApiOperation("故障等级")
|
||||
public ResponseEntity<Object> errorLevel(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.errorLevel(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/repairs")
|
||||
@Log("报修")
|
||||
@ApiOperation("报修")
|
||||
public ResponseEntity<Object> repairs(@RequestParam Map map, HttpServletRequest request) {
|
||||
return new ResponseEntity<>(sparePartService.repairs(map,request),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryRepairs")
|
||||
@Log("查询设备维修执行")
|
||||
@ApiOperation("查询设备维修执行")
|
||||
public ResponseEntity<Object> queryRepairs(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryRepairs(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/repairOpeate")
|
||||
@Log("设备保养单操作")
|
||||
@ApiOperation("设备保养单操作")
|
||||
public ResponseEntity<Object> repairOpeate(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.repairOpeate(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryRepairDtl")
|
||||
@Log("维修明细查询")
|
||||
@ApiOperation("维修明细查询")
|
||||
public ResponseEntity<Object> queryRepairDtl(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryRepairDtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/repaireDtlConfirm")
|
||||
@Log("确认")
|
||||
@ApiOperation("确认")
|
||||
public ResponseEntity<Object> repaireDtlConfirm(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.repaireDtlConfirm(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.nl.pda.sb.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SparePartService {
|
||||
@@ -12,4 +16,32 @@ public interface SparePartService {
|
||||
Map<String, Object> queryReturnDis(Map jsonObject);
|
||||
|
||||
Map<String, Object> confirmReturn(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryIODtl(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryIODis(Map jsonObject);
|
||||
|
||||
Map<String, Object> confirmDis(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryMaintenance(Map jsonObject);
|
||||
|
||||
Map<String, Object> maintOpeate(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryMaintenanceDtl(Map jsonObject);
|
||||
|
||||
Map<String, Object> dtlConfirm(Map jsonObject);
|
||||
|
||||
Map<String, Object> errorType(Map jsonObject);
|
||||
|
||||
Map<String, Object> errorLevel(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryRepairs(Map jsonObject);
|
||||
|
||||
Map<String, Object> repairOpeate(Map jsonObject);
|
||||
|
||||
Map<String, Object> queryRepairDtl(Map jsonObject);
|
||||
|
||||
Map<String, Object> repaireDtlConfirm(Map jsonObject);
|
||||
|
||||
Map<String, Object> repairs(Map map, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.st.service.StorattrService;
|
||||
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.impl.SparePartInServiceImpl;
|
||||
import org.nl.wms.sb.repair.service.DevicerepairmstService;
|
||||
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;
|
||||
@@ -34,8 +37,12 @@ import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -47,6 +54,12 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
private final StorattrService storattrService;
|
||||
@Autowired
|
||||
private final SparePartInServiceImpl sparePartInService;
|
||||
@Autowired
|
||||
private final SparePartOutService sparePartOutService;
|
||||
@Autowired
|
||||
private final DevicemaintenancemstService devicemaintenancemstService;
|
||||
@Autowired
|
||||
private final DevicerepairmstService devicerepairmstService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryReturnDis(Map jsonObject) {
|
||||
@@ -61,20 +74,25 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
throw new PdaRequestException("备品备件不能为空!");
|
||||
}
|
||||
|
||||
JSONObject spare_bom = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").query("sparepart_only_id = '"+sparepart_only_id+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(spare_bom)){
|
||||
JSONObject spare_bom = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").query("sparepart_only_id = '" + sparepart_only_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(spare_bom)) {
|
||||
throw new PdaRequestException("该备件未查询到设备档案BOM备件表!");
|
||||
}
|
||||
|
||||
String device_id = spare_bom.getString("devicerecord_id");
|
||||
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag","1").addParam("device_id",device_id).addParam("sparepart_only_id",sparepart_only_id).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo)){
|
||||
if (ObjectUtil.isEmpty(spare_bom)){
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "1").addParam("device_id", device_id).addParam("sparepart_only_id", sparepart_only_id).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
if (ObjectUtil.isEmpty(spare_bom)) {
|
||||
throw new PdaRequestException("该备件未查询到相关领用出库记录!");
|
||||
}
|
||||
}
|
||||
return row;
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("row", row);
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,7 +106,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
|
||||
JSONArray rows= jo.getJSONArray("rows");
|
||||
JSONArray rows = jo.getJSONArray("rows");
|
||||
String device_code = rows.getJSONObject(0).getString("device_code");
|
||||
String device_id = rows.getJSONObject(0).getString("device_id");
|
||||
String device_name = rows.getJSONObject(0).getString("device_name");
|
||||
@@ -96,38 +114,38 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
if (!row.getString("device_code").equals(device_code)){
|
||||
if (!row.getString("device_code").equals(device_code)) {
|
||||
throw new PdaRequestException("关联设备需相同!");
|
||||
}
|
||||
JSONObject dis_jo = new JSONObject();
|
||||
//判断该分配是否存在明细
|
||||
JSONObject dtl = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"' AND material_id = '"+row.getString("material_id")+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dtl)){
|
||||
JSONObject dtl = dtl_wql.query("iostorinv_id = '" + iostorinv_id + "' AND material_id = '" + row.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dtl)) {
|
||||
//插入一条入库明细
|
||||
dtl = new JSONObject();
|
||||
dtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
dtl.put("iostorinv_id", iostorinv_id);
|
||||
JSONArray dtl_rows = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
JSONArray dtl_rows = dtl_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
dtl.put("seq_no", (dtl_rows.size() + 1) + "");
|
||||
dtl.put("bill_status", "99");
|
||||
dtl.put("material_id",row.getString("material_id"));
|
||||
dtl.put("pcsn",row.getString("pcsn"));
|
||||
dtl.put("qty_unit_id",row.getString("qty_unit_id"));
|
||||
dtl.put("qty_unit_name",row.getString("qty_unit_name"));
|
||||
dtl.put("source_billdtl_id",row.getString("source_billdtl_id"));
|
||||
dtl.put("base_billdtl_id",row.getString("source_billdtl_id"));
|
||||
dtl.put("source_bill_type",row.getString("source_bill_type"));
|
||||
dtl.put("base_bill_type",row.getString("source_bill_type"));
|
||||
dtl.put("source_bill_code",row.getString("source_bill_code"));
|
||||
dtl.put("base_bill_code",row.getString("source_bill_code"));
|
||||
dtl.put("source_bill_table",row.getString("source_bill_table"));
|
||||
dtl.put("base_bill_table",row.getString("source_bill_table"));
|
||||
dtl.put("plan_qty","1");
|
||||
dtl.put("real_qty","1");
|
||||
dtl.put("material_id", row.getString("material_id"));
|
||||
dtl.put("pcsn", row.getString("pcsn"));
|
||||
dtl.put("qty_unit_id", row.getString("qty_unit_id"));
|
||||
dtl.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
dtl.put("source_billdtl_id", row.getString("source_billdtl_id"));
|
||||
dtl.put("base_billdtl_id", row.getString("source_billdtl_id"));
|
||||
dtl.put("source_bill_type", row.getString("source_bill_type"));
|
||||
dtl.put("base_bill_type", row.getString("source_bill_type"));
|
||||
dtl.put("source_bill_code", row.getString("source_bill_code"));
|
||||
dtl.put("base_bill_code", row.getString("source_bill_code"));
|
||||
dtl.put("source_bill_table", row.getString("source_bill_table"));
|
||||
dtl.put("base_bill_table", row.getString("source_bill_table"));
|
||||
dtl.put("plan_qty", "1");
|
||||
dtl.put("real_qty", "1");
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(dtl);
|
||||
}else {
|
||||
dtl.put("plan_qty",dtl.getDoubleValue("plan_qty")+1);
|
||||
dtl.put("real_qty",dtl.getDoubleValue("real_qty")+1);
|
||||
} else {
|
||||
dtl.put("plan_qty", dtl.getDoubleValue("plan_qty") + 1);
|
||||
dtl.put("real_qty", dtl.getDoubleValue("real_qty") + 1);
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").update(dtl);
|
||||
}
|
||||
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
@@ -141,7 +159,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
dis_jo.put("qty_unit_id", dtl.getString("qty_unit_id"));
|
||||
dis_jo.put("qty_unit_name", dtl.getString("qty_unit_name"));
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_attachment = '1'").uniqueResult(0);
|
||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("stor_id = '"+stor.getString("stor_id")+"' order by sect_code").uniqueResult(0);
|
||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("stor_id = '" + stor.getString("stor_id") + "' order by sect_code").uniqueResult(0);
|
||||
dis_jo.put("sect_id", struct.getString("sect_id"));
|
||||
dis_jo.put("sect_code", struct.getString("sect_code"));
|
||||
dis_jo.put("sect_name", struct.getString("sect_name"));
|
||||
@@ -152,7 +170,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
dis_wql.insert(dis_jo);
|
||||
|
||||
//更新设备bom
|
||||
WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").delete("sparepart_only_id = '"+row.getString("sparepart_only_id")+"' AND devicerecord_id = '"+device_id+"'");
|
||||
WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").delete("sparepart_only_id = '" + row.getString("sparepart_only_id") + "' AND devicerecord_id = '" + device_id + "'");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -164,7 +182,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
String bill_code = CodeUtil.getNewCode("IO_CODE");
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("buss_type","0008");
|
||||
io_mst.put("buss_type", "0008");
|
||||
io_mst.put("io_type", "0");
|
||||
io_mst.put("bill_type", "000801");
|
||||
io_mst.put("biz_date", DateUtil.today());
|
||||
@@ -174,9 +192,9 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
io_mst.put("stor_id", stor_id);
|
||||
io_mst.put("stor_code", stor_code);
|
||||
io_mst.put("stor_name", stor_name);
|
||||
JSONArray dis_num = dis_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
JSONArray dis_num = dis_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
io_mst.put("total_qty", dis_num.size());
|
||||
JSONArray dtl_num = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
JSONArray dtl_num = dtl_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
io_mst.put("detail_count", dtl_num.size());
|
||||
io_mst.put("bill_status", "40");
|
||||
io_mst.put("create_mode", "01");
|
||||
@@ -201,6 +219,438 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
|
||||
//完成主表
|
||||
sparePartInService.confirmMst(iostorinv_id);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryIODtl(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
String io_flag = jo.getString("io_flag");
|
||||
String flag = "";
|
||||
if (io_flag.equals("0")) {
|
||||
flag = "2";
|
||||
} else {
|
||||
flag = "3";
|
||||
}
|
||||
JSONArray rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", flag).process().getResultJSONArray(0);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("rows", rows);
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryIODis(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
String sparepart_only_id = jo.getString("sparepart_only_id");
|
||||
String iostorinvdtl_id = jo.getString("iostorinvdtl_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "4");
|
||||
map.put("sparepart_only_id", sparepart_only_id);
|
||||
map.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("content", row);
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> confirmDis(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
String io_flag = jo.getString("io_flag");
|
||||
if (io_flag.equals("0")) {
|
||||
sparePartInService.disConfirm(jo);
|
||||
} else {
|
||||
sparePartOutService.disConfirm(jo);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryMaintenance(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
String maintenance_flag = jo.getString("maintenance_flag");
|
||||
String device_code = jo.getString("device_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "5");
|
||||
map.put("maintenance_flag", maintenance_flag);
|
||||
map.put("device_code", device_code);
|
||||
JSONObject rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("rows", rows);
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> maintOpeate(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject row = jo.getJSONObject("row");
|
||||
// 1、开始保养;2、结束保养;3、通过;4、不通过
|
||||
String operate = jo.getString("operate");
|
||||
if (operate.equals("1")) {
|
||||
if (!row.getString("invstatus").equals("02")) {
|
||||
throw new PdaRequestException("只能对提交状态的单据开始保养");
|
||||
}
|
||||
devicemaintenancemstService.startMaintain(row);
|
||||
}
|
||||
if (operate.equals("2")) {
|
||||
if (!row.getString("invstatus").equals("03")) {
|
||||
throw new PdaRequestException("只能对开始状态的单据结束保养");
|
||||
}
|
||||
devicemaintenancemstService.endMaintain(row);
|
||||
}
|
||||
if (operate.equals("3")) {
|
||||
if (!row.getString("invstatus").equals("04")) {
|
||||
throw new PdaRequestException("只能对结束状态的单据通过");
|
||||
}
|
||||
devicemaintenancemstService.confirmMaintain(row);
|
||||
}
|
||||
if (operate.equals("4")) {
|
||||
if (!row.getString("invstatus").equals("04")) {
|
||||
throw new PdaRequestException("只能对结束状态的单据不通过");
|
||||
}
|
||||
String maint_id = row.getString("maint_id");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceDtl");
|
||||
WQLObject mainMstTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceMst"); // 保养单主表
|
||||
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 设备档案表
|
||||
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 设备声明周期表
|
||||
|
||||
JSONObject jsonMst = mstTab.query("maint_id = '" + maint_id + "'").uniqueResult(0);
|
||||
|
||||
// 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 BadRequestException("保养项目未完成");
|
||||
}
|
||||
}
|
||||
|
||||
// 2.保养人,保养时间不能为空
|
||||
String update_optname = jsonMst.getString("update_optname");
|
||||
String update_time = jsonMst.getString("update_time");
|
||||
if (ObjectUtil.isEmpty(update_optname) || ObjectUtil.isEmpty(update_time)) {
|
||||
throw new BadRequestException("保养人或保养时间不能为空");
|
||||
}
|
||||
|
||||
// 更新保养单主表
|
||||
JSONObject jsonMainMst = mainMstTab.query("maint_id = '" + row.getString("maint_id") + "'").uniqueResult(0);
|
||||
jsonMainMst.put("invstatus", "03");
|
||||
jsonMainMst.put("real_start_date", DateUtil.now());
|
||||
mainMstTab.update(jsonMainMst);
|
||||
|
||||
// 更新设备档案表
|
||||
JSONObject jsonFile = fileTab.query("devicerecord_id ='" + jsonMainMst.getString("devicerecord_id") + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonFile)) {
|
||||
throw new BadRequestException("此设备档案不存在");
|
||||
}
|
||||
jsonFile.put("status", "40");
|
||||
fileTab.update(jsonFile);
|
||||
|
||||
// 插入设备声明周期表
|
||||
JSONObject jsonLife = new JSONObject();
|
||||
jsonLife.put("devicechangedtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonLife.put("devicerecord_id", jsonMainMst.get("devicerecord_id"));
|
||||
jsonLife.put("changetype", "20");
|
||||
jsonLife.put("change_id", currentUserId);
|
||||
jsonLife.put("change_name", nickName);
|
||||
jsonLife.put("change_time", DateUtil.now());
|
||||
jsonLife.put("change_reason", "保养开始");
|
||||
jsonLife.put("invsid", jsonMainMst.get("maint_id"));
|
||||
jsonLife.put("invcode", jsonMainMst.getString("maint_code"));
|
||||
jsonLife.put("create_id", currentUserId);
|
||||
jsonLife.put("create_name", nickName);
|
||||
jsonLife.put("create_time", DateUtil.now());
|
||||
lifeTab.insert(jsonLife);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryMaintenanceDtl(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject row = jo.getJSONObject("row");
|
||||
JSONArray rows = devicemaintenancemstService.getDtl(row);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("rows", rows);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> dtlConfirm(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject form = jo.getJSONObject("form");
|
||||
JSONArray rows = jo.getJSONArray("rows");
|
||||
String maint_id = form.getString("maint_id");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceDtl");
|
||||
|
||||
// 更新主表
|
||||
JSONObject jsonMst = mstTab.query("maint_id ='" + maint_id + "'").uniqueResult(0);
|
||||
jsonMst.put("update_optname", SecurityUtils.getNickName());
|
||||
jsonMst.put("update_time", DateUtil.now());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 更新明细表
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject json = rows.getJSONObject(i);
|
||||
JSONObject jsonDtl = dtlTab.query("maint_dtl_id = '" + json.getString("maint_dtl_id") + "'").uniqueResult(0);
|
||||
jsonDtl.put("isfinish", json.getString("isfinish"));
|
||||
dtlTab.update(jsonDtl);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> errorType(Map jsonObject) {
|
||||
JSONArray ja = WQLObject.getWQLObject("EM_BI_DeviceFaultClass").query("is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray rows = new JSONArray();
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("value", jo.getString("device_faultclass_id"));
|
||||
row.put("label", jo.getString("device_faultclass_id"));
|
||||
row.put("solutions", jo.getString("solutions"));
|
||||
rows.add(row);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("rows", rows);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> errorLevel(Map jsonObject) {
|
||||
JSONObject level_jo = WQLObject.getWQLObject("sys_dict").query("name = 'EM_FAULT_LEVEL'").uniqueResult(0);
|
||||
JSONArray ja = WQLObject.getWQLObject("sys_dict_detail").query("dict_id = '" + level_jo.getString("dict_id") + "'").getResultJSONArray(0);
|
||||
JSONArray rows = new JSONArray();
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("value", jo.getString("value"));
|
||||
row.put("label", jo.getString("label"));
|
||||
rows.add(row);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("rows", rows);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryRepairs(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
String maintenance_flag = jo.getString("maintenance_flag");
|
||||
String device_code = jo.getString("device_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "6");
|
||||
map.put("maintenance_flag", maintenance_flag);
|
||||
map.put("device_code", device_code);
|
||||
JSONObject rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("rows", rows);
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> repairOpeate(Map jsonObject) {
|
||||
{
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject row = jo.getJSONObject("row");
|
||||
// 1、开始维修;2、委外维修;3、结束维修;4、通过;5、不通过
|
||||
String operate = jo.getString("operate");
|
||||
if (operate.equals("1")) {
|
||||
if (!row.getString("invstatus").equals("02")) {
|
||||
throw new PdaRequestException("只能对提交状态的单据开始维修");
|
||||
}
|
||||
devicerepairmstService.startRepair(row);
|
||||
}
|
||||
if (operate.equals("2")) {
|
||||
if (!row.getString("invstatus").equals("02")) {
|
||||
throw new PdaRequestException("只能对开始状态的单据进行委外维修");
|
||||
}
|
||||
devicerepairmstService.outRepair(row);
|
||||
}
|
||||
if (operate.equals("3")) {
|
||||
if (!row.getString("invstatus").equals("03") && !row.getString("invstatus").equals("04")) {
|
||||
throw new PdaRequestException("只能对开始状态或委外维修的单据结束维修");
|
||||
}
|
||||
devicerepairmstService.endRepair(row);
|
||||
}
|
||||
if (operate.equals("4")) {
|
||||
if (!row.getString("invstatus").equals("06")) {
|
||||
throw new PdaRequestException("只能对开始状态的单据进行通过");
|
||||
}
|
||||
devicerepairmstService.confirmRepair(row);
|
||||
}
|
||||
if (operate.equals("5")) {
|
||||
if (!row.getString("invstatus").equals("06")) {
|
||||
throw new PdaRequestException("只能对开始状态的单据进行不通过");
|
||||
}
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
WQLObject reMstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); // 设备维修单主表
|
||||
WQLObject planMstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairPlanMst"); // 设备维修计划主表
|
||||
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 档案表
|
||||
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 设备生命周期表
|
||||
|
||||
// 1. 更新设备维修单主表
|
||||
JSONObject jsonReMst = reMstTab.query("repair_id = '" + row.getString("repair_id") + "'").uniqueResult(0);
|
||||
jsonReMst.put("invstatus", "03");
|
||||
jsonReMst.put("real_start_date", DateUtil.now());
|
||||
reMstTab.update(jsonReMst);
|
||||
// 2.更新设备档案表
|
||||
JSONObject jsonFile = fileTab.query("devicerecord_id = '" + row.getString("devicerecord_id") + "' and is_delete= '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonFile)) {
|
||||
throw new BadRequestException("此设备没有档案");
|
||||
}
|
||||
jsonFile.put("status", "30");
|
||||
fileTab.update(jsonFile);
|
||||
// 3.插入生命周期表
|
||||
JSONObject jsonLife = new JSONObject();
|
||||
jsonLife.put("devicechangedtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonLife.put("devicerecord_id", jsonReMst.get("devicerecord_id"));
|
||||
jsonLife.put("changetype", "30");
|
||||
jsonLife.put("change_id", currentUserId);
|
||||
jsonLife.put("change_name", nickName);
|
||||
jsonLife.put("change_time", DateUtil.now());
|
||||
jsonLife.put("change_reason", "开始维修");
|
||||
jsonLife.put("invsid", jsonReMst.get("repair_id"));
|
||||
jsonLife.put("invcode", jsonReMst.getString("repair_code"));
|
||||
jsonLife.put("create_id", currentUserId);
|
||||
jsonLife.put("create_name", nickName);
|
||||
jsonLife.put("create_time", DateUtil.now());
|
||||
lifeTab.insert(jsonLife);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryRepairDtl(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject row = jo.getJSONObject("row");
|
||||
JSONArray rows = devicerepairmstService.getDtl(row);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("rows", rows);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> repaireDtlConfirm(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
JSONObject form = jo.getJSONObject("form");
|
||||
JSONArray rows = jo.getJSONArray("rows");
|
||||
String repair_id = form.getString("repair_id");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl");
|
||||
|
||||
// 更新主表
|
||||
JSONObject jsonMst = mstTab.query("repair_id ='" + repair_id + "'").uniqueResult(0);
|
||||
jsonMst.put("update_optname", SecurityUtils.getNickName());
|
||||
jsonMst.put("update_time", DateUtil.now());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 更新明细表
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject json = rows.getJSONObject(i);
|
||||
JSONObject jsonDtl = dtlTab.query("repair_dtl_id = '" + json.getString("repair_dtl_id") + "'").uniqueResult(0);
|
||||
jsonDtl.put("isfinish", json.getString("isfinish"));
|
||||
dtlTab.update(jsonDtl);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> repairs(Map map, HttpServletRequest request) {
|
||||
MultipartHttpServletRequest params=((MultipartHttpServletRequest) request);
|
||||
List<MultipartFile> files = ((MultipartHttpServletRequest) request)
|
||||
.getFiles("file");
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.device_id TYPEAS s_string
|
||||
输入.sparepart_only_id TYPEAS s_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.maintenance_flag TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -75,5 +77,166 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mb.material_spec,
|
||||
detail.label AS source_type_name,
|
||||
mst.bill_code,
|
||||
mst.device_code,
|
||||
detail.label AS source_bill_type_name,
|
||||
IFNULL( a.assign_qty, 0 ) AS finish_qty,
|
||||
(
|
||||
dtl.plan_qty - IFNULL( a.assign_qty, 0 )) AS need_qty
|
||||
FROM
|
||||
em_bi_iostorinvdtl dtl
|
||||
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 sys_dict_detail detail ON detail.`value` = dtl.source_bill_type
|
||||
LEFT JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
||||
AND dict.`name` LIKE 'ST_INV_TYPE%'
|
||||
LEFT JOIN ( SELECT count(*) AS assign_qty, dis.iostorinvdtl_id FROM em_bi_iostorinvdis dis WHERE dis.work_status = '99' GROUP BY dis.iostorinvdtl_id ) a ON a.iostorinvdtl_id = dtl.iostorinvdtl_id
|
||||
WHERE
|
||||
mst.bill_type = '000701'
|
||||
AND ( mst.bill_status = '30' OR mst.bill_status = '40' )
|
||||
AND mst.is_delete = '0'
|
||||
AND dtl.bill_status = '40'
|
||||
order by
|
||||
bill_code,material_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mb.material_spec,
|
||||
detail.label AS source_type_name,
|
||||
mst.bill_code,
|
||||
mst.device_code,
|
||||
detail.label AS source_bill_type_name,
|
||||
IFNULL( a.assign_qty, 0 ) AS finish_qty,
|
||||
(
|
||||
dtl.plan_qty - IFNULL( a.assign_qty, 0 )) AS need_qty
|
||||
FROM
|
||||
em_bi_iostorinvdtl dtl
|
||||
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 sys_dict_detail detail ON detail.`value` = dtl.source_bill_type
|
||||
LEFT JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
||||
AND dict.`name` LIKE 'ST_INV_TYPE%'
|
||||
LEFT JOIN ( SELECT count(*) AS assign_qty, dis.iostorinvdtl_id FROM em_bi_iostorinvdis dis WHERE dis.work_status = '99' GROUP BY dis.iostorinvdtl_id ) a ON a.iostorinvdtl_id = dtl.iostorinvdtl_id
|
||||
WHERE
|
||||
mst.bill_type IN ('011001','010901')
|
||||
AND mst.bill_status IN ('10','20','30','40')
|
||||
AND mst.is_delete = '0'
|
||||
AND dtl.bill_status IN ('10','20','30','40')
|
||||
ORDER BY
|
||||
bill_code,
|
||||
material_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
( CASE WHEN dis.work_status = '01' THEN '生成' WHEN dis.work_status = '99' THEN '完成' END ) AS status_name,
|
||||
dis.sparepart_only_id,
|
||||
mb.material_name,
|
||||
dis.pcsn,
|
||||
dis.real_qty,
|
||||
dis.qty_unit_name,
|
||||
dis.struct_name,
|
||||
dis.iostorinvdis_id,
|
||||
dis.iostorinv_id,
|
||||
dis.iostorinvdtl_id
|
||||
FROM
|
||||
em_bi_iostorinvdis dis
|
||||
INNER JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
WHERE
|
||||
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
|
||||
AND
|
||||
dis.sparepart_only_id = 输入.sparepart_only_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
mst.maint_code,
|
||||
file.device_code,
|
||||
file.device_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.maint_id,
|
||||
mst.invstatus
|
||||
FROM
|
||||
em_bi_devicemaintenancemst mst
|
||||
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
OPTION 输入.maintenance_flag = "1"
|
||||
mst.invstatus IN ('02','03','04')
|
||||
ENDOPTION
|
||||
OPTION 输入.maintenance_flag = "2"
|
||||
mst.invstatus = '05'
|
||||
ENDOPTION
|
||||
AND
|
||||
file.device_code = 输入.device_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
SELECT
|
||||
mst.repair_code,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN mst.invstatus = '02' THEN
|
||||
'提交'
|
||||
WHEN mst.invstatus = '03' THEN
|
||||
'开始'
|
||||
WHEN mst.invstatus = '04' THEN
|
||||
'委外维修'
|
||||
WHEN mst.invstatus = '05' THEN
|
||||
'委外验收'
|
||||
WHEN mst.invstatus = '06' THEN
|
||||
'结束'
|
||||
WHEN mst.invstatus = '07' THEN
|
||||
'确认'
|
||||
END
|
||||
) AS status_name,
|
||||
mst.plan_start_date,
|
||||
mst.repair_id,
|
||||
mst.invstatus
|
||||
FROM
|
||||
EM_BI_DeviceRepairMst mst
|
||||
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
OPTION 输入.maintenance_flag = "1"
|
||||
mst.invstatus IN ('02','03','04','05','06')
|
||||
ENDOPTION
|
||||
OPTION 输入.maintenance_flag = "2"
|
||||
mst.invstatus = '07'
|
||||
ENDOPTION
|
||||
AND
|
||||
file.device_code = 输入.device_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user