代码更新

This commit is contained in:
2023-02-10 11:23:28 +08:00
parent 62c4c711a0
commit 94661cc115
9 changed files with 288 additions and 44 deletions

View File

@@ -465,6 +465,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 锁住点位
JSONObject jsonPoint = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
jsonPoint.put("lock_type", "99");
jsonPoint.put("vehicle_code", vehicle_code);
WQLObject.getWQLObject("sch_base_point").update(jsonPoint);
}
result.put("status", HttpStatus.OK.value());

View File

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
@@ -55,6 +56,7 @@ public class PdaCheckServiceImpl implements PdaCheckService {
@Override
public JSONObject checkQueryDtl(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
JSONObject map = new JSONObject();
@@ -64,8 +66,16 @@ public class PdaCheckServiceImpl implements PdaCheckService {
JSONArray resultJSONArray = WQL.getWO("PDA_CHECK").addParamMap(map).process().getResultJSONArray(0);
// 已盘点数: 不等于生成状态
JSONArray unCheckNumArr = WQLObject.getWQLObject("ST_IVT_CheckDtl").query("check_code = '" + whereJson.getString("check_code") + "' and status <> '1'").getResultJSONArray(0);
// 未盘点数:等于生成状态
JSONArray checkNumArr = WQLObject.getWQLObject("ST_IVT_CheckDtl").query("check_code = '" + whereJson.getString("check_code") + "' and status = '1'").getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("check_num", unCheckNumArr.size());
jo.put("uncheck_num", checkNumArr.size());
jo.put("message", "查询成功!");
return jo;
}

View File

@@ -129,12 +129,14 @@
dtl.check_optname,
dtl.check_time,
dtl.remark,
sub.quanlity_in_box,
dtl.check_id,
dtl.checkdtl_id
FROM
ST_IVT_CheckDtl dtl
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = dtl.storagevehicle_code
WHERE
dtl.status = '1'

View File

@@ -87,6 +87,13 @@ public class CheckController {
checkService.insertDtl(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/allInsert")
@Log("新增全部在库木箱")
@ApiOperation("新增全部在库木箱")
public ResponseEntity<Object> allInsert(@RequestBody JSONObject whereJson){
checkService.allInsert(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@GetMapping("/getStructIvt")
@Log("查询可盘点库存")
@ApiOperation("查询可盘点库存")

View File

@@ -114,4 +114,9 @@ public interface CheckService {
* 处理确认
*/
void disposeConfirm(JSONObject whereJson);
/**
* 新增全部在库木箱
*/
void allInsert(JSONObject whereJson);
}

View File

@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -215,11 +216,26 @@ public class CheckServiceImpl implements CheckService {
@Override
public JSONArray getOutBillDtl(Map whereJson) {
whereJson.put("flag", "2");
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
.addParamMap((HashMap) whereJson)
.process()
.getResultJSONArray(0);
String type = MapUtil.getStr(whereJson, "type");
JSONArray jo = new JSONArray();
if (ObjectUtil.isNotEmpty(type)) {
if (StrUtil.equals(type, "1")){
// 1-已盘点
whereJson.put("flag", "22");
jo = WQL.getWO("QST_IVT_CHECK").addParamMap((HashMap) whereJson).process().getResultJSONArray(0);
} else {
// 1-未盘点
whereJson.put("flag", "222");
jo = WQL.getWO("QST_IVT_CHECK").addParamMap((HashMap) whereJson).process().getResultJSONArray(0);
}
} else {
whereJson.put("flag", "2");
jo = WQL.getWO("QST_IVT_CHECK")
.addParamMap((HashMap) whereJson)
.process()
.getResultJSONArray(0);
}
return jo;
}
@@ -666,51 +682,30 @@ public class CheckServiceImpl implements CheckService {
for (int i = 0; i < rows.size(); i++) {
JSONObject jo = rows.getJSONObject(i);
Map<String, Object> map = new LinkedHashMap<>();
map.put("盘点单号", jo.getString("check_code"));
map.put("明细序号", jo.getString("seq_no"));
map.put("库区编码", jo.getString("sect_code"));
map.put("库区名称", jo.getString("sect_name"));
map.put("货位编码", jo.getString("struct_code"));
map.put("货位名称", jo.getString("struct_name"));
map.put("载具号", jo.getString("storagevehicle_code"));
map.put("物料编码", jo.getString("material_code"));
map.put("物料名称", jo.getString("material_name"));
map.put("桶数", jo.getString("base_qty"));
map.put("盘点桶数", jo.getString("fac_qty"));
map.put("单位", jo.getString("qty_unit_name"));
String check_result = jo.getString("check_result");
if (check_result.equals("0")) {
map.put("盘点结果", "正常");
} else if (check_result.equals("1")) {
map.put("盘点结果", "盘亏");
} else if (check_result.equals("2")) {
map.put("盘点结果", "盘盈");
}
String status = jo.getString("status");
if (status.equals("01")) {
if (StrUtil.equals(status, "1")) {
map.put("状态", "生成");
} else if (status.equals("04")) {
} else if (StrUtil.equals(status, "2")) {
map.put("状态", "盘点中");
} else if (status.equals("05")) {
} else if (StrUtil.equals(status, "3")) {
map.put("状态", "已盘点");
} else if (status.equals("06")) {
} else if (StrUtil.equals(status, "4")) {
map.put("状态", "异常处理中");
} else if (status.equals("07")) {
} else if (StrUtil.equals(status, "5")) {
map.put("状态", "异常处理完成");
} else if (status.equals("99")) {
} else if (StrUtil.equals(status, "99")) {
map.put("状态", "确认完成");
}
map.put("异常处理人", jo.getString("process_optname"));
map.put("异常处理时间", jo.getString("process_time"));
String process_type = jo.getString("process_type");
if (process_type.equals("0")) {
map.put("异常处理方式", "账务为准");
} else if (process_type.equals("1")) {
map.put("异常处理方式", "实物为准");
}
map.put("盘点库区", jo.getString("sect_name"));
map.put("盘点货位", jo.getString("struct_name"));
map.put("箱号", jo.getString("storagevehicle_code"));
map.put("净重", jo.getString("base_qty"));
map.put("物料编码", jo.getString("material_code"));
map.put("物料名称", jo.getString("material_name"));
map.put("备注", jo.getString("remark"));
list.add(map);
}
//FileUtil.downloadExcel(list, response);
FileUtil.downloadExcel(list, response);
}
@Override
@@ -757,5 +752,60 @@ public class CheckServiceImpl implements CheckService {
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void allInsert(JSONObject jsonObject) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
Long deptId = SecurityUtils.getDeptId();
// 查找库内所有在库木箱
JSONArray dtlArr = WQL.getWO("QST_IVT_CHECK").addParam("flag", "11").addParam("stor_id", jsonObject.getString("stor_id")).process().getResultJSONArray(0);
// 插入主表
JSONObject jsonMst = new JSONObject();
jsonMst.put("check_id", IdUtil.getSnowflake(1, 1).nextId());
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("dtl_num", dtlArr.size());
jsonMst.put("create_mode", "01");
jsonMst.put("is_nok", "0");
jsonMst.put("input_optid", currentUserId);
jsonMst.put("input_optname", nickName);
jsonMst.put("input_time", DateUtil.now());
jsonMst.put("remark", jsonObject.getString("remark"));
jsonMst.put("status", "1");
jsonMst.put("sysdeptid", deptId);
jsonMst.put("syscompanyid", deptId);
mstTab.insert(jsonMst);
// 插入明细
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i);
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", i + 1);
jsonDtl.put("sect_id", json.getLongValue("sect_id"));
jsonDtl.put("sect_name", json.getString("sect_name"));
jsonDtl.put("struct_id", json.getLongValue("struct_id"));
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("qty_unit_id", json.getLongValue("measure_unit_id"));
jsonDtl.put("qty_unit_name", json.getString("qty_unit_name"));
jsonDtl.put("status", "1");
JSONObject jsonSub = WQL.getWO("PDA_CHECK").addParam("flag", "4").addParam("storagevehicle_code", json.getString("storagevehicle_code")).process().uniqueResult(0);
jsonDtl.put("base_qty", jsonSub.getDoubleValue("net_weight"));
dtlTab.insert(jsonDtl);
}
}
}

View File

@@ -141,6 +141,56 @@
ENDQUERY
ENDIF
IF 输入.flag = "22"
QUERY
SELECT
CheckDtl.*,
struct.struct_code,
struct.sect_code,
mb.material_code,
mb.material_name,
user1.person_name AS process_optname
FROM
ST_IVT_CheckDtl CheckDtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
WHERE
CheckDtl.status <> '1'
OPTION 输入.check_id <> ""
CheckDtl.check_id = 输入.check_id
ENDOPTION
order by CheckDtl.seq_no
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "222"
QUERY
SELECT
CheckDtl.*,
struct.struct_code,
struct.sect_code,
mb.material_code,
mb.material_name,
user1.person_name AS process_optname
FROM
ST_IVT_CheckDtl CheckDtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
WHERE
CheckDtl.status = '1'
OPTION 输入.check_id <> ""
CheckDtl.check_id = 输入.check_id
ENDOPTION
order by CheckDtl.seq_no
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
PAGEQUERY
SELECT
@@ -433,3 +483,33 @@
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "11"
QUERY
SELECT
MAX(attr.sect_id) AS sect_id,
MAX(attr.sect_name) AS sect_name,
MAX(attr.struct_id) AS struct_id,
MAX(attr.struct_name) AS struct_name,
MAX(attr.storagevehicle_code) AS storagevehicle_code,
MAX(mater.material_id) AS material_id,
MAX(mater.base_unit_id) AS qty_unit_id,
'KG' AS qty_unit_name
FROM
st_ivt_structivt ivt
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,'') <> ''
AND attr.lock_type = '1'
OPTION 输入.stor_id <> ""
attr.stor_id = 输入.stor_id
ENDOPTION
group by attr.struct_code
ENDSELECT
ENDQUERY
ENDIF