代码更新

This commit is contained in:
2023-01-06 18:26:47 +08:00
parent 153721b600
commit fd55d71261
16 changed files with 781 additions and 324 deletions

View File

@@ -43,6 +43,13 @@ public class PdaCheckController {
return new ResponseEntity<>(pdaCheckService.checkQueryDtl(whereJson),HttpStatus.OK);
}
@PostMapping("/checkQueryDetails")
@Log("盘点单明细详情")
@ApiOperation("盘点单明细详情")
public ResponseEntity<Object> checkQueryDetails(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.checkQueryDetails(whereJson),HttpStatus.OK);
}
@PostMapping("/saveCheck")
@Log("保存")
@ApiOperation("保存")
@@ -57,6 +64,20 @@ public class PdaCheckController {
return new ResponseEntity<>(pdaCheckService.confirmCheck(whereJson),HttpStatus.OK);
}
@PostMapping("/exception")
@Log("异常")
@ApiOperation("异常")
public ResponseEntity<Object> exception(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.exception(whereJson),HttpStatus.OK);
}
@PostMapping("/normal")
@Log("正常")
@ApiOperation("正常")
public ResponseEntity<Object> normal(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.normal(whereJson),HttpStatus.OK);
}
@PostMapping("/getStor")
@Log("获取人员对应仓库下拉框")
@ApiOperation("获取人员对应仓库下拉框")

View File

@@ -44,4 +44,24 @@ public interface PdaCheckService {
* @return JSONObject /
*/
JSONObject getStor();
/**
* 获取人员对应仓库下拉框
* @return JSONObject /
*/
JSONObject checkQueryDetails(JSONObject whereJson);
/**
* 异常
* @param whereJson /
* @return JSONObject /
*/
JSONObject exception(JSONObject whereJson);
/**
* 正常
* @param whereJson /
* @return JSONObject /
*/
JSONObject normal(JSONObject whereJson);
}

View File

@@ -2,11 +2,14 @@
package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
@@ -141,4 +144,109 @@ public class PdaCheckServiceImpl implements PdaCheckService {
return jo;
}
@Override
public JSONObject checkQueryDetails(JSONObject whereJson) {
JSONObject map = new JSONObject();
map.put("flag", "3");
map.put("storagevehicle_code", whereJson.getString("storagevehicle_code"));
JSONArray resultJSONArray = WQL.getWO("PDA_CHECK").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("message", "查询成功!");
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject exception(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONArray rows = whereJson.getJSONArray("check_rows");
String check_code = "";
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
check_code = json.getString("check_code");
JSONObject jsonDtl = wo_dtl.query("checkdtl_id = '" + json.getString("checkdtl_id") + "'").uniqueResult(0);
jsonDtl.put("check_result", "2");
jsonDtl.put("status", "4");
jsonDtl.put("is_process", "0");
jsonDtl.put("remark", json.getString("remark"));
jsonDtl.put("check_optid", currentUserId);
jsonDtl.put("check_optname", nickName);
jsonDtl.put("check_time", now);
wo_dtl.update(jsonDtl);
}
JSONArray jsonDtlArr = wo_dtl.query("check_code = '" + check_code + "' and check_result = '2'").getResultJSONArray(0);
JSONObject jsonMst = wo_mst.query("check_code = '" + check_code + "'").uniqueResult(0);
jsonMst.put("status", "3");
if (ObjectUtil.isNotEmpty(jsonDtlArr)) {
jsonMst.put("is_nok", "1");
}
wo_mst.update(jsonMst);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject normal(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONArray rows = whereJson.getJSONArray("check_rows");
String check_code = "";
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
check_code = json.getString("check_code");
JSONObject jsonDtl = wo_dtl.query("checkdtl_id = '" + json.getString("checkdtl_id") + "'").uniqueResult(0);
jsonDtl.put("check_result", "1");
jsonDtl.put("is_process", "1");
jsonDtl.put("status", "3");
jsonDtl.put("remark", json.getString("remark"));
jsonDtl.put("check_optid", currentUserId);
jsonDtl.put("check_optname", nickName);
jsonDtl.put("check_time", now);
wo_dtl.update(jsonDtl);
}
JSONArray jsonDtlArr = wo_dtl.query("check_code = '" + check_code + "' and check_result = '1'").getResultJSONArray(0);
JSONArray jsonDtlArr2 = wo_dtl.query("check_code = '" + check_code + "'").getResultJSONArray(0);
JSONObject jsonMst = wo_mst.query("check_code = '" + check_code + "'").uniqueResult(0);
jsonMst.put("status", "3");
if (jsonDtlArr.size() == jsonDtlArr2.size()) {
jsonMst.put("status", "99");
jsonMst.put("confirm_optid", currentUserId);
jsonMst.put("confirm_optname", nickName);
jsonMst.put("confirm_time", now);
}
wo_mst.update(jsonMst);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;
}
}

View File

@@ -17,6 +17,7 @@
输入.check_code TYPEAS s_string
输入.in_stor_id TYPEAS f_string
输入.stor_id TYPEAS s_string
输入.storagevehicle_code TYPEAS s_string
[临时表]
@@ -122,12 +123,12 @@
CASE
dtl.check_result
WHEN '1' THEN '正常'
WHEN '2' THEN '盘亏'
WHEN '3' THEN '盘盈'
WHEN '2' THEN '异常'
END
) AS check_result,
dtl.check_optname,
dtl.check_time,
dtl.remark,
dtl.check_id,
dtl.checkdtl_id
@@ -135,7 +136,7 @@
ST_IVT_CheckDtl dtl
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
WHERE
1=1
dtl.status = '1'
OPTION 输入.check_code <> ""
dtl.check_code = 输入.check_code
@@ -144,3 +145,44 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
sub.container_name,
sub.sap_pcsn,
sub.net_weight,
(
CASE
sub.status
WHEN '0' THEN '生成'
WHEN '1' THEN '包装'
WHEN '2' THEN '入库'
WHEN '3' THEN '出库'
END
) AS status,
sub.sale_order_name,
sub.customer_name,
sub.customer_description,
sub.width,
sub.thickness,
sub.length,
sub.width_standard,
sub.thickness_request,
sub.quality_guaran_period,
sub.date_of_production,
sub.date_of_fg_inbound
FROM
st_ivt_structivt ivt
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
LEFT JOIN pdm_bi_subpackagerelation sub ON ivt.pcsn = sub.container_name AND sub.package_box_sn = attr.storagevehicle_code
WHERE
1=1
OPTION 输入.storagevehicle_code <> ""
sub.package_box_sn = 输入.storagevehicle_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -31,6 +31,20 @@ public class CheckController {
return new ResponseEntity<>(checkService.pageQuery(whereJson,page), HttpStatus.OK);
}
@GetMapping("/getDtlView")
@Log("查询盘点单明细详情")
@ApiOperation("查询盘点单明细详情")
public ResponseEntity<Object> getDtlView(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(checkService.getDtlView(whereJson,page), HttpStatus.OK);
}
@GetMapping("/getExceptionDispose")
@Log("查询盘点单明细异常")
@ApiOperation("查询盘点单明细异常")
public ResponseEntity<Object> getExceptionDispose(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(checkService.getExceptionDispose(whereJson,page), HttpStatus.OK);
}
@GetMapping("/getOutBillDtl")
@Log("查询移库单")
@ApiOperation("查询移库单")
@@ -125,4 +139,11 @@ public class CheckController {
public void download(HttpServletResponse response,@RequestParam Map whereJson) throws IOException {
checkService.download(checkService.getOutBillDtl(whereJson), response);
}
@PostMapping("/disposeConfirm")
@Log("处理确认")
@ApiOperation("处理确认")
public ResponseEntity<Object> disposeConfirm(@RequestBody JSONObject whereJson) {
checkService.disposeConfirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -18,6 +18,24 @@ public interface CheckService {
*/
Map<String, Object> pageQuery(Map whereJson, Pageable page);
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> getDtlView(Map whereJson, Pageable page);
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> getExceptionDispose(Map whereJson, Pageable page);
/**
* 多选删除
* @param ids /
@@ -91,4 +109,9 @@ public interface CheckService {
* @throws IOException
*/
void download(JSONArray rows, HttpServletResponse response) throws IOException;
/**
* 处理确认
*/
void disposeConfirm(JSONObject whereJson);
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.st.instor.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -59,6 +60,40 @@ public class CheckServiceImpl implements CheckService {
return jo;
}
@Override
public Map<String, Object> getDtlView(Map whereJson, Pageable page) {
String box_no = MapUtil.getStr(whereJson, "box_no");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
JSONObject map = new JSONObject();
map.put("box_no",box_no);
map.put("flag","9");
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", "%"+pcsn+"%");
if (ObjectUtil.isNotEmpty(sap_pcsn)) map.put("sap_pcsn", "%"+sap_pcsn+"%");
JSONObject json = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "sub.container_name ASC");
return json;
}
@Override
public Map<String, Object> getExceptionDispose(Map whereJson, Pageable page) {
String box_no = MapUtil.getStr(whereJson, "box_no");
String check_code = MapUtil.getStr(whereJson, "check_code");
JSONObject map = new JSONObject();
map.put("check_code",check_code);
map.put("flag","10");
if (ObjectUtil.isNotEmpty(box_no)) map.put("box_no", "%"+box_no+"%");
JSONObject json = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "dtl.seq_no ASC");
return json;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
@@ -149,11 +184,9 @@ public class CheckServiceImpl implements CheckService {
jsonDtl.put("struct_name", json.getString("struct_name"));
jsonDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
jsonDtl.put("material_id", json.getLongValue("material_id"));
jsonDtl.put("base_qty", json.getDoubleValue("base_qty"));
jsonDtl.put("qty_unit_id", json.getLongValue("measure_unit_id"));
jsonDtl.put("qty_unit_name", json.getString("qty_unit_name"));
jsonDtl.put("status", "1");
jsonDtl.put("fac_qty", json.getDoubleValue("fac_qty"));
dtlTab.insert(jsonDtl);
}
}
@@ -266,6 +299,9 @@ public class CheckServiceImpl implements CheckService {
if (StrUtil.isNotEmpty(map.get("struct_code"))) {
map.put("struct_code", "%" + map.get("struct_code") + "%");
}
if (StrUtil.isNotEmpty(map.get("box_no"))) {
map.put("box_no", "%" + map.get("box_no") + "%");
}
JSONObject jo = WQL.getWO("QST_IVT_CHECK")
.addParam("flag", "3")
.addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "struct.struct_code");
@@ -282,64 +318,58 @@ public class CheckServiceImpl implements CheckService {
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 in ('1','3') and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
if (jo_mst == null) {
throw new BadRequestException("盘点单状态异常!");
}
wo_dtl.delete("status in ('1','2') and check_id='" + form.getString("check_id") + "'");
//定义需要需要更新的的点位集合
String check_id = form.getString("check_id");
JSONObject jsonMst = wo_mst.query("check_id = '" + check_id + "'").uniqueResult(0);
// 更新明细
for (int i = 0; i < rows.size(); i++) {
JSONObject jo = rows.getJSONObject(i);
String status = jo.getString("status");
double base_qty = jo.getDoubleValue("base_qty");
jo.put("seq_no", "" + (i + 1));
//已盘点过的明细不再处理
if ("3,4,5,99".contains(status)) {
wo_dtl.update(jo);
continue;
}
jo.put("status", "3");
jo.put("check_optid", currentUserId);
jo.put("check_optname", nickName);
jo.put("check_time", now);
double fac_qty = jo.getDoubleValue("fac_qty");
//判断盈亏
if (fac_qty > base_qty) {
jo.put("check_result", "3");
} else if (fac_qty < base_qty) {
jo.put("check_result", "2");
JSONObject json = rows.getJSONObject(i);
JSONObject jsonDtl = wo_dtl.query("checkdtl_id = '" + json.getString("checkdtl_id") + "'").uniqueResult(0);
String check_result = json.getString("check_result");
if (ObjectUtil.isEmpty(check_result)) {
jsonDtl.put("check_result","1");
jsonDtl.put("is_process","0");
jsonDtl.put("status","3");
} else {
jo.put("check_result", "1");
jsonDtl.put("check_result",check_result);
if (StrUtil.equals(check_result, "1")) {
jsonDtl.put("is_process","1");
jsonDtl.put("status","3");
} else {
jsonDtl.put("is_process","0");
jsonDtl.put("status","4");
}
}
jo.put("status", "99");
wo_dtl.insert(jo);
}
jo_mst.put("dtl_num", rows.size());
jo_mst.put("status", "3");
jo_mst.put("is_nok", "0");
JSONArray ja_nok = wo_dtl.query("check_result <>'1' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
if (ja_nok.size() != 0) {
jo_mst.put("is_nok", "1");
jsonDtl.put("remark", json.getString("remark"));
jsonDtl.put("check_optid", currentUserId);
jsonDtl.put("check_optname", nickName);
jsonDtl.put("check_time", now);
wo_dtl.update(jsonDtl);
}
JSONArray ja = wo_dtl.query("status in ('99') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
//说明全部确认
if (ja.size() == jo_mst.getInteger("dtl_num")) {
HashMap<String, String> mapdtl = new HashMap<>();
// 更新主表: 明细全部为正常 -1 主表为正常
JSONArray jsonDtlArr = wo_dtl.query("check_id = '" + check_id + "' and check_result = '2'").getResultJSONArray(0);
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);
if (jsonDtlArr.size() == 0) {
// 更新主表为正常
jsonMst.put("is_nok", "0");
jsonMst.put("status", "99");
} else {
jsonMst.put("is_nok", "1");
jsonMst.put("status", "3");
}
wo_mst.update(jo_mst);
jsonMst.put("confirm_optid", currentUserId);
jsonMst.put("confirm_optname", nickName);
jsonMst.put("confirm_time", now);
wo_mst.update(jsonMst);
}
@Override
@@ -683,5 +713,49 @@ public class CheckServiceImpl implements CheckService {
//FileUtil.downloadExcel(list, response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void disposeConfirm(JSONObject whereJson) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst");
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl");
JSONArray rows = whereJson.getJSONArray("rows");
String currentUserId = SecurityUtils.getCurrentUserId();
String check_id = "";
// 更新明细
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
String is_process = json.getString("is_process");
check_id = json.getString("check_id");
if (StrUtil.equals(is_process, "1")) {
continue;
}
JSONObject jsonDtl = dtlTab.query("checkdtl_id = '" + json.getString("checkdtl_id") + "'").uniqueResult(0);
jsonDtl.put("is_process", "1");
jsonDtl.put("status", "5");
jsonDtl.put("process_optid", currentUserId);
jsonDtl.put("process_time", DateUtil.now());
dtlTab.update(jsonDtl);
}
// 如果异常是否处理都为是则更新全部明细状态为完成,更新主表为完成
JSONArray jsonDtlArr = dtlTab.query("check_id = '" + check_id + "' and is_process = '0'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(jsonDtlArr)) {
JSONObject map = new JSONObject();
map.put("status", "99");
// 更新明细为完成
dtlTab.update(map,"check_id = '"+check_id+"'");
// 更新主表为完成
mstTab.update(map,"check_id = '"+check_id+"'");
}
}
}

View File

@@ -27,6 +27,7 @@
输入.material_id TYPEAS s_string
输入.quality_scode TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.sap_pcsn TYPEAS s_string
输入.ivt_level TYPEAS s_string
输入.is_active TYPEAS s_string
输入.sect_id TYPEAS s_string
@@ -38,6 +39,7 @@
输入.struct_code TYPEAS s_string
输入.ids TYPEAS f_string
输入.storagevehicle_code TYPEAS s_string
输入.box_no TYPEAS s_string
输入.deptIds TYPEAS f_string
输入.in_stor_id TYPEAS f_string
[临时表]
@@ -173,6 +175,10 @@
struct.struct_code like 输入.struct_code
ENDOPTION
OPTION 输入.box_no <> ""
struct.storagevehicle_code like 输入.box_no
ENDOPTION
OPTION 输入.stor_id <> ""
struct.stor_id = 输入.stor_id
ENDOPTION
@@ -349,6 +355,7 @@
CheckDtl.process_type,
CheckDtl.process_optid,
CheckDtl.process_time,
CheckDtl.remark,
struct.struct_code,
struct.sect_code,
mb.material_code,
@@ -374,3 +381,55 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "9"
PAGEQUERY
SELECT
sub.*
FROM
st_ivt_structivt ivt
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
LEFT JOIN pdm_bi_subpackagerelation sub ON ivt.pcsn = sub.container_name AND sub.package_box_sn = attr.storagevehicle_code
WHERE
1=1
OPTION 输入.box_no <> ""
sub.package_box_sn = 输入.box_no
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn like 输入.sap_pcsn
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "10"
PAGEQUERY
SELECT
dtl.*,
mater.material_code,
mater.material_name
FROM
ST_IVT_CheckDtl dtl
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
WHERE
dtl.check_result = '2'
and dtl.status in ('4','5')
OPTION 输入.box_no <> ""
dtl.storagevehicle_code like 输入.box_no
ENDOPTION
OPTION 输入.check_code <> ""
dtl.check_code = 输入.check_code
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF