|
|
|
|
@@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|