盘点修改

This commit is contained in:
2023-04-10 16:10:06 +08:00
parent 230ed4ea3d
commit d39fe395e7
7 changed files with 250 additions and 8 deletions

View File

@@ -160,4 +160,11 @@ public class CheckController {
checkService.confirmBtn(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/repairSubmit")
@Log("补录明细")
@ApiOperation("补录明细")
public ResponseEntity<Object> repairSubmit(@RequestBody JSONObject whereJson) {
checkService.repairSubmit(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -124,4 +124,9 @@ public interface CheckService {
* 强制确认
*/
void confirmBtn(JSONObject whereJson);
/**
* 补录明细
*/
void repairSubmit(JSONObject whereJson);
}

View File

@@ -797,13 +797,23 @@ public class CheckServiceImpl implements CheckService {
public void allInsert(JSONObject jsonObject) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 仓库表
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
Long deptId = SecurityUtils.getDeptId();
JSONObject jsonStor = storTab.query("stor_id = '" + jsonObject.getString("stor_id") + "'").uniqueResult(0);
// 查找库内所有在库木箱
JSONArray dtlArr = WQL.getWO("QST_IVT_CHECK").addParam("flag", "11").addParam("stor_id", jsonObject.getString("stor_id")).process().getResultJSONArray(0);
JSONArray dtlArr = WQL.getWO("QST_IVT_CHECK").addParam("flag", "11")
.addParam("stor_id", jsonObject.getString("stor_id"))
.addParam("sect_id", jsonObject.getString("sect_id"))
.process().getResultJSONArray(0);
if (dtlArr.size() == 0) {
throw new BadRequestException("此库区没有要盘点的木箱");
}
// 插入主表
JSONObject jsonMst = new JSONObject();
@@ -811,8 +821,8 @@ public class CheckServiceImpl implements CheckService {
jsonMst.put("check_code", CodeUtil.getNewCode("PD_CODE"));
jsonMst.put("buss_type", jsonObject.getString("check_type"));
jsonMst.put("check_type", jsonObject.getString("check_type"));
jsonMst.put("stor_id", jsonObject.getLongValue("stor_id"));
jsonMst.put("stor_name", jsonObject.getString("stor_name"));
jsonMst.put("stor_id", jsonStor.getLongValue("stor_id"));
jsonMst.put("stor_name", jsonStor.getString("stor_name"));
jsonMst.put("dtl_num", dtlArr.size());
jsonMst.put("create_mode", "01");
jsonMst.put("is_nok", "0");
@@ -859,4 +869,40 @@ public class CheckServiceImpl implements CheckService {
mstTab.update(jsonMst);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void repairSubmit(JSONObject whereJson) {
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
WQLObject mstTab = WQLObject.getWQLObject("st_ivt_checkmst");
WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_checkdtl");
JSONObject jsonMst = mstTab.query("check_code = '" + whereJson.getString("check_code") + "'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + whereJson.getString("material_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料信息不存在!");
// 新增明细
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("checkdtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonDtl.put("check_id", jsonMst.getLongValue("check_id"));
jsonDtl.put("check_code", jsonMst.getString("check_code"));
jsonDtl.put("seq_no", jsonMst.getIntValue("dtl_num") + 1);
jsonDtl.put("sect_id", 111111);
jsonDtl.put("sect_name", "补录库区");
jsonDtl.put("struct_id", 111111);
jsonDtl.put("struct_name", "补录货位");
jsonDtl.put("storagevehicle_code", whereJson.getString("storagevehicle_code"));
jsonDtl.put("material_id", jsonMater.getLongValue("material_id"));
jsonDtl.put("qty_unit_id", jsonMater.getLongValue("base_unit_id"));
jsonDtl.put("qty_unit_name", "KG");
jsonDtl.put("status", "1");
jsonDtl.put("base_qty", whereJson.getDoubleValue("base_qty"));
jsonDtl.put("remark", whereJson.getString("remark"));
dtlTab.insert(jsonDtl);
// 更新主表
jsonMst.put("dtl_num", jsonMst.getIntValue("dtl_num") + 1);
mstTab.update(jsonMst);
}
}

View File

@@ -500,14 +500,17 @@
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
WHERE
attr.sect_code in ('XN01','XN11')
AND IFNULL(attr.storagevehicle_code,'') <> ''
IFNULL(attr.storagevehicle_code,'') <> ''
AND attr.lock_type = '1'
OPTION 输入.stor_id <> ""
attr.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.sect_id <> ""
attr.sect_id = 输入.sect_id
ENDOPTION
group by attr.struct_code
ENDSELECT