opt:整理判断相关业务代码,去除启用的代码

This commit is contained in:
zds
2024-10-23 11:16:39 +08:00
parent 5f77d68859
commit e02d3ff026
6 changed files with 3 additions and 580 deletions

View File

@@ -24,48 +24,35 @@ public class CheckController {
@GetMapping
@Log("查询盘点单")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(checkService.pageQuery(whereJson, page), HttpStatus.OK);
}
@GetMapping("/getDtlView")
@Log("查询盘点单明细详情")
public ResponseEntity<Object> getDtlView(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(checkService.getDtlView(whereJson, page), HttpStatus.OK);
}
@GetMapping("/getExceptionDispose")
@Log("查询盘点单明细异常")
public ResponseEntity<Object> getExceptionDispose(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(checkService.getExceptionDispose(whereJson, page), HttpStatus.OK);
}
@GetMapping("/getOutBillDtl")
@Log("查询移库单")
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson) {
return new ResponseEntity<>(checkService.getOutBillDtl(whereJson), HttpStatus.OK);
}
@GetMapping("/getOutBillDtl2")
@Log("查询盘点单明细2")
public ResponseEntity<Object> getOutBillDtl2(@RequestParam Map whereJson) {
return new ResponseEntity<>(checkService.getOutBillDtl2(whereJson), HttpStatus.OK);
}
@GetMapping("/getOutBillDis")
@Log("查询移库单")
public ResponseEntity<Object> getOutBillDis(@RequestParam Map whereJson) {
return new ResponseEntity<>(checkService.getOutBillDis(whereJson), HttpStatus.OK);
}
@Log("删除移库单")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
checkService.deleteAll(ids);
@@ -74,7 +61,6 @@ public class CheckController {
@PutMapping
@Log("修改盘点单")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
checkService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -82,7 +68,6 @@ public class CheckController {
@PostMapping()
@Log("新增盘点单")
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson) {
checkService.insertDtl(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
@@ -90,7 +75,6 @@ public class CheckController {
@PostMapping("/allInsert")
@Log("新增全部在库木箱")
public ResponseEntity<Object> allInsert(@RequestBody JSONObject whereJson) {
checkService.allInsert(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
@@ -98,59 +82,17 @@ public class CheckController {
@GetMapping("/getStructIvt")
@Log("查询可盘点库存")
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(checkService.getStructIvt(whereJson, page), HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("盘点确定")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
checkService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping("/getInvTypes")
@Log("查询单据字段")
public ResponseEntity<Object> getInvTypes() {
return new ResponseEntity<>(checkService.getInvTypes(), HttpStatus.OK);
}
@PostMapping("/handdown")
@Log("移库单手动下发")
public ResponseEntity<Object> handdown(@RequestBody JSONObject whereJson) {
checkService.handdown(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/saveCheck")
@Log("盘点保存")
public ResponseEntity<Object> saveCheck(@RequestBody JSONObject whereJson) {
checkService.saveCheck(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/process0")
@Log("财务为准")
public ResponseEntity<Object> process0(@RequestBody JSONObject whereJson) {
checkService.process0(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/process1")
@Log("实物为准")
public ResponseEntity<Object> process1(@RequestBody JSONObject whereJson) {
checkService.process1(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
checkService.download(checkService.getOutBillDtl(whereJson), response);
@@ -158,7 +100,6 @@ public class CheckController {
@PostMapping("/disposeConfirm")
@Log("处理确认")
public ResponseEntity<Object> disposeConfirm(@RequestBody JSONObject whereJson) {
checkService.disposeConfirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -166,7 +107,6 @@ public class CheckController {
@PostMapping("/confirmBtn")
@Log("强制确认")
public ResponseEntity<Object> confirmBtn(@RequestBody JSONObject whereJson) {
checkService.confirmBtn(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -174,7 +114,6 @@ public class CheckController {
@PostMapping("/repairSubmit")
@Log("补录明细")
public ResponseEntity<Object> repairSubmit(@RequestBody JSONObject whereJson) {
checkService.repairSubmit(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);

View File

@@ -60,13 +60,6 @@ public interface CheckService {
JSONArray getOutBillDtl2(Map whereJson);
/**
* 查询出库单明细
*
* @param whereJson /
* @return
*/
JSONArray getOutBillDis(Map whereJson);
/**
* 修改出库单
@@ -90,20 +83,6 @@ public interface CheckService {
*/
void confirm(JSONObject whereJson);
/**
* 查询单据字段
*
* @return
*/
JSONArray getInvTypes();
/**
* 移库单手动下发
*
* @param whereJson /
*/
void handdown(JSONObject whereJson);
/**
* 盘点保存
*
@@ -111,20 +90,6 @@ public interface CheckService {
*/
void saveCheck(JSONObject whereJson);
/**
* 财务为准
*
* @param whereJson /
*/
void process0(JSONObject whereJson);
/**
* 财务为准
*
* @param whereJson /
*/
void process1(JSONObject whereJson);
/**
* 导出
*

View File

@@ -17,14 +17,10 @@ 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.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.service.CheckService;
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
@@ -37,14 +33,10 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
@Slf4j
public class CheckServiceImpl implements CheckService {
@Autowired
private StorPublicService storPublicService;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_checkdtl");
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "1");
if (StrUtil.isNotEmpty(map.get("check_code"))) {
@@ -223,30 +215,6 @@ public class CheckServiceImpl implements CheckService {
}
}
/**
* 根据传进来的载具物料明细,查询载具所有库存记录,并生成移库明细
*
* @param rows
*/
@Transactional(rollbackFor = Exception.class)
void insertDtlByRows(JSONObject jo_mst, ArrayList<HashMap> rows) {
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
//定义需要需要插入的库存集合
HashSet<String> set = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
HashMap<String, String> row = rows.get(i);
set.add(row.get("struct_id"));
String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
row.put("checkdtl_id", checkdtl_id);
row.put("check_code", jo_mst.getString("check_code"));
row.put("check_id", jo_mst.getString("check_id"));
row.put("seq_no", (i + 1) + "");
row.put("is_down", "0");
wo_dtl.insert(row);
}
}
@Override
public JSONArray getOutBillDtl(Map whereJson) {
@@ -283,15 +251,6 @@ public class CheckServiceImpl implements CheckService {
return jo;
}
@Override
public JSONArray getOutBillDis(Map whereJson) {
whereJson.put("flag", "4");
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
.addParamMap((HashMap) whereJson)
.process()
.getResultJSONArray(0);
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
@@ -422,61 +381,6 @@ public class CheckServiceImpl implements CheckService {
wo_mst.update(jsonMst);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void handdown(JSONObject whereJson) {
//移库单主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
//移库单明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
HandMoveStorAcsTask handMoveStorAcsTask = new HandMoveStorAcsTask();
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String moveinv_id = whereJson.getString("moveinv_id");
//查询当前移库单所有载具的任务
JSONArray ja = WQL.getWO("QST_IVT_HANDMOVESTOR")
.addParam("flag", "4")
.addParam("moveinv_id", moveinv_id)
.process().getResultJSONArray(0);
if (ja.size() == 0) {
throw new BadRequestException("当前移库单无可下发任务!");
}
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
String task_id = jo.getString("task_id");
String taskdtl_id = whereJson.getString("taskdtl_id");
JSONObject result = handMoveStorAcsTask.notifyAcs(taskdtl_id);
if (ObjectUtil.isNotEmpty(result)) {
String status = result.getString("status");
if ("200".equals(status)) {
HashMap<String, String> map = new HashMap<>();
//更新分配表
map.put("is_issued", "1");
wo_dtl.update(map, "is_issued='0' and task_id='" + task_id + "'");
//更新任务为已下发
map.put("task_status", "02");
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
map.put("update_time", now);
wo_Task.update(map, "task_status='01' and taskdtl_id='" + taskdtl_id + "'");
} else {
throw new BadRequestException("任务下发失败,请稍后重试!");
}
} else {
throw new BadRequestException("任务下发失败,请稍后重试!");
}
}
HashMap<String, String> map = new HashMap<>();
map.put("bill_status", "20");
wo_mst.update(map, "moveinv_id='" + moveinv_id + "'");
}
@Override
public void saveCheck(JSONObject whereJson) {
//主表
@@ -534,177 +438,6 @@ public class CheckServiceImpl implements CheckService {
wo_mst.update(jo_mst);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void process0(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
JSONObject form = whereJson.getJSONObject("form");
JSONObject row = whereJson.getJSONObject("row");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject jo_mst = wo_mst.query("status <>'99' and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
if (jo_mst == null) {
throw new BadRequestException("盘点单状态异常!");
}
row.put("status", "07");
row.put("process_optid", currentUserId);
row.put("process_type", "0");
row.put("is_process", "1");
row.put("process_time", now);
wo_dtl.update(row);
JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
//说明全部确认
if (ja.size() == jo_mst.getInteger("dtl_num")) {
HashMap<String, String> mapdtl = new HashMap<>();
mapdtl.put("status", "99");
wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'");
jo_mst.put("status", "99");
jo_mst.put("confirm_optid", currentUserId);
jo_mst.put("confirm_optname", nickName);
jo_mst.put("confirm_time", now);
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
//锁定起点点位、仓位
JSONObject from_start = new JSONObject();
from_start.put("lock_type", "00");
from_start.put("struct_id", jo.getString("struct_id"));
storPublicService.updateStructAndPoint(from_start);
}
}
wo_mst.update(jo_mst);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void process1(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
//明细表
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_CheckDtlDis");
JSONObject form = whereJson.getJSONObject("row");
JSONArray rows = whereJson.getJSONArray("rows");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject jo_mst = wo_mst.query("status <>'99' and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
if (jo_mst == null) {
throw new BadRequestException("盘点单状态异常!");
}
HashMap<String, String> map = new HashMap<>();
map.put("status", "07");
map.put("process_optid", currentUserId + "");
map.put("process_type", "1");
map.put("is_process", "1");
map.put("process_time", now);
wo_dtl.update(map, "status not in('07','99') and storagevehicle_code='" + form.getString("storagevehicle_code") + "' and check_id='" + form.getString("check_id") + "'");
for (int i = 0; i < rows.size(); i++) {
JSONObject jo = rows.getJSONObject(i);
String checkdtldis_id = IdUtil.getSnowflake(1, 1).nextId() + "";
jo.put("checkdtldis_id", checkdtldis_id);
jo.put("check_id", jo_mst.getString("check_id"));
jo.put("check_code", jo_mst.getString("check_code"));
jo.put("sect_id", form.getString("sect_id"));
jo.put("struct_id", form.getString("struct_id"));
jo.put("struct_name", form.getString("struct_name"));
jo.put("sect_name", form.getString("sect_name"));
wo_dis.insert(jo);
}
//判断是否要生成损单
JSONArray ja_sun = WQL.getWO("QST_IVT_CHECK")
.addParam("storagevehicle_code", form.getString("storagevehicle_code"))
.addParam("check_id", form.getString("check_id"))
.addParam("flag", "6")
.process()
.getResultJSONArray(0);
if (ja_sun.size() > 0) {
JSONObject mapMst = new JSONObject();
mapMst.put("mol_inv_type", "42");
mapMst.put("create_mode", "02");
mapMst.put("mol_type", "0");
mapMst.put("stor_id", ja_sun.getJSONObject(0).getString("stor_id"));
mapMst.put("sect_id", ja_sun.getJSONObject(0).getString("sect_id"));
mapMst.put("sect_name", ja_sun.getJSONObject(0).getString("sect_name"));
mapMst.put("struct_id", ja_sun.getJSONObject(0).getString("struct_id"));
mapMst.put("struct_name", ja_sun.getJSONObject(0).getString("struct_name"));
mapMst.put("tableData", ja_sun);
}
//判断是否要生成溢单
JSONArray ja_yi = WQL.getWO("QST_IVT_CHECK")
.addParam("storagevehicle_code", form.getString("storagevehicle_code"))
.addParam("check_id", form.getString("check_id"))
.addParam("flag", "5")
.process()
.getResultJSONArray(0);
if (ja_yi.size() > 0) {
JSONObject mapMst = new JSONObject();
mapMst.put("mol_inv_type", "42");
mapMst.put("create_mode", "02");
mapMst.put("mol_type", "1");
mapMst.put("stor_id", ja_yi.getJSONObject(0).getString("stor_id"));
mapMst.put("sect_id", ja_yi.getJSONObject(0).getString("sect_id"));
mapMst.put("sect_name", ja_yi.getJSONObject(0).getString("sect_name"));
mapMst.put("struct_id", ja_yi.getJSONObject(0).getString("struct_id"));
mapMst.put("struct_name", ja_yi.getJSONObject(0).getString("struct_name"));
mapMst.put("tableData", ja_yi);
}
JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
//说明全部确认
if (ja.size() == jo_mst.getInteger("dtl_num")) {
HashMap<String, String> mapdtl = new HashMap<>();
mapdtl.put("status", "99");
wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'");
jo_mst.put("status", "99");
jo_mst.put("confirm_optid", currentUserId);
jo_mst.put("confirm_optname", nickName);
jo_mst.put("confirm_time", now);
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
//锁定起点点位、仓位
JSONObject from_start = new JSONObject();
from_start.put("lock_type", "00");
from_start.put("struct_id", jo.getString("struct_id"));
storPublicService.updateStructAndPoint(from_start);
}
//确认损益单
JSONArray ja_sunyi = WQL.getWO("QST_IVT_CHECK")
.addParam("check_code", form.getString("check_code"))
.addParam("flag", "7")
.process()
.getResultJSONArray(0);
for (int i = 0; i < ja_sunyi.size(); i++) {
JSONObject jo = ja_sunyi.getJSONObject(i);
}
}
wo_mst.update(jo_mst);
}
@Override
public JSONArray getInvTypes() {
//查询单据字段类型
JSONArray ja = WQL.getWO("ST_PUB_QUERY_01")
.addParam("flag", "4")
.process()
.getResultJSONArray(0);
return ja;
}
@Override
public void download(JSONArray rows, HttpServletResponse response) throws IOException {
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");