代码更新

This commit is contained in:
2022-11-10 09:19:37 +08:00
parent 7859e6938e
commit d35dd61ac1
14 changed files with 899 additions and 17 deletions

View File

@@ -0,0 +1,60 @@
package org.nl.wms.pda.st.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pda.st.service.PdaCheckService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author liuxy
* @date 2022-05-25
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "手持盘点")
@RequestMapping("/api/pda/check")
@Slf4j
public class PdaCheckController {
private final PdaCheckService pdaCheckService;
@PostMapping("/checkQuery")
@Log("盘点单查询")
@ApiOperation("盘点单查询")
public ResponseEntity<Object> checkQuery(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.checkQuery(whereJson),HttpStatus.OK);
}
@PostMapping("/checkQueryDtl")
@Log("盘点单明细查询")
@ApiOperation("盘点单明细查询")
public ResponseEntity<Object> checkQueryDtl(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.checkQueryDtl(whereJson),HttpStatus.OK);
}
@PostMapping("/saveCheck")
@Log("保存")
@ApiOperation("保存")
public ResponseEntity<Object> saveCheck(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.saveCheck(whereJson),HttpStatus.OK);
}
@PostMapping("/confirmCheck")
@Log("确认")
@ApiOperation("确认")
public ResponseEntity<Object> confirmCheck(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(pdaCheckService.confirmCheck(whereJson),HttpStatus.OK);
}
}

View File

@@ -0,0 +1,40 @@
package org.nl.wms.pda.st.service;
import com.alibaba.fastjson.JSONObject;
/**
* @description 服务接口
* @author liuxy
* @date 2022-05-25
**/
public interface PdaCheckService {
/**
* 盘点单查询
* @param whereJson /
* @return JSONObject /
*/
JSONObject checkQuery(JSONObject whereJson);
/**
* 盘点单明细查询
* @param whereJson /
* @return JSONObject /
*/
JSONObject checkQueryDtl(JSONObject whereJson);
/**
* 保存
* @param whereJson /
* @return JSONObject /
*/
JSONObject saveCheck(JSONObject whereJson);
/**
* 确认
* @param whereJson /
* @return JSONObject /
*/
JSONObject confirmCheck(JSONObject whereJson);
}

View File

@@ -0,0 +1,100 @@
package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.pda.st.service.PdaCheckService;
import org.nl.wms.st.instor.service.CheckService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author liuxy
* @description 服务实现
* @date 2022-05-25
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class PdaCheckServiceImpl implements PdaCheckService {
private final CheckService checkService;
@Override
public JSONObject checkQuery(JSONObject whereJson) {
String check_code = whereJson.getString("check_code");
JSONObject map = new JSONObject();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(check_code)) map.put("check_code","%"+check_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
public JSONObject checkQueryDtl(JSONObject whereJson) {
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("check_code", whereJson.getString("check_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 saveCheck(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
JSONObject jsonMst = wo_mst.query("check_code = '" + whereJson.getString("check_code") + "'").uniqueResult(0);
JSONArray dtlArr = wo_dtl.query("check_code = '" + whereJson.getString("check_code") + "'").getResultJSONArray(0);
JSONObject param = new JSONObject();
param.put("form",jsonMst);
param.put("rows",dtlArr);
checkService.saveCheck(param);
JSONObject result = new JSONObject();
result.put("message", "保存成功!");
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject confirmCheck(JSONObject whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
JSONObject jsonMst = wo_mst.query("check_code = '" + whereJson.getString("check_code") + "'").uniqueResult(0);
JSONArray dtlArr = wo_dtl.query("check_code = '" + whereJson.getString("check_code") + "'").getResultJSONArray(0);
JSONObject param = new JSONObject();
param.put("form",jsonMst);
param.put("rows",dtlArr);
checkService.confirm(param);
JSONObject result = new JSONObject();
result.put("message", "确认成功!");
return result;
}
}

View File

@@ -0,0 +1,139 @@
[交易说明]
交易名: 手持盘点
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.check_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
check_code,
(
CASE
check_type
WHEN '1' THEN '计划盘点'
WHEN '2' THEN '临时盘点'
END
) AS check_type,
stor_name,
dtl_num,
(
CASE
status
WHEN '1' THEN '生成'
WHEN '2' THEN '审核'
WHEN '3' THEN '盘点中'
WHEN '99' THEN '完成'
END
) AS status,
(
CASE
is_nok
WHEN '0' THEN '正常'
WHEN '1' THEN '异常'
END
) AS status,
input_optname,
input_time,
confirm_optname,
confirm_time,
check_id
FROM
ST_IVT_CheckMst
WHERE
is_delete = '0'
AND status in ('1','3')
OPTION 输入.check_code <> ""
check_code like 输入.check_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
dtl.check_code,
(
CASE
dtl.status
WHEN '1' THEN '生成'
WHEN '2' THEN '盘点中'
WHEN '3' THEN '已盘点'
WHEN '4' THEN '异常处理中'
WHEN '5' THEN '异常处理完成'
WHEN '99' THEN '确认完成'
END
) AS status,
dtl.sect_name,
dtl.struct_name,
dtl.storagevehicle_code,
mater.material_code,
mater.material_name,
dtl.base_qty,
dtl.fac_qty,
dtl.qty_unit_name,
(
CASE
dtl.check_result
WHEN '1' THEN '正常'
WHEN '2' THEN '盘亏'
WHEN '3' THEN '盘盈'
END
) AS check_result,
dtl.check_optname,
dtl.check_time,
dtl.check_id,
dtl.checkdtl_id
FROM
ST_IVT_CheckDtl dtl
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
WHERE
1=1
OPTION 输入.check_code <> ""
dtl.check_code = 输入.check_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -16,6 +16,7 @@ import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.TaskService;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
import org.nl.wms.st.inbill.service.impl.RawAssistIStorServiceImpl;
import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl;
@@ -87,7 +88,7 @@ public class OutTask extends AbstractAcsTask {
taskTab.update(jsonTask);
// 调用标识完成
CheckOutBillServiceImpl checkOutBillService = new CheckOutBillServiceImpl(null);
CheckOutBillServiceImpl checkOutBillService = new CheckOutBillServiceImpl(null,null,null);
checkOutBillService.finishTask(jsonTask);
}
}

View File

@@ -163,4 +163,9 @@ public interface CheckOutBillService {
* 获取全部出入库业务类型
*/
JSONArray getType();
/**
* 发货信息保存
*/
void moneySubmit(JSONObject whereJson);
}

View File

@@ -305,9 +305,9 @@ public class CheckServiceImpl implements CheckService {
} else if (fac_qty < base_qty) {
jo.put("check_result", "2");
} else {
jo.put("status", "99");
jo.put("check_result", "1");
}
jo.put("status", "99");
wo_dtl.insert(jo);
}
jo_mst.put("dtl_num", rows.size());

View File

@@ -194,4 +194,11 @@ public class CheckOutBillController {
public ResponseEntity<Object> getType() {
return new ResponseEntity<>(checkOutBillService.getType(),HttpStatus.OK);
}
@PostMapping("/moneySubmit")
@Log("发货信息保存")
@ApiOperation("发货信息保存")
public ResponseEntity<Object> moneySubmit(@RequestBody JSONObject whereJson) {
checkOutBillService.moneySubmit(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -15,11 +15,16 @@ import org.nl.modules.system.util.CodeUtil;
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.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.dto.TaskDto;
import org.nl.wms.sch.tasks.OutTask;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.service.HandMoveStorService;
import org.nl.wms.st.instor.service.impl.HandMoveStorServiceImpl;
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;
@@ -35,8 +40,9 @@ import java.util.*;
@Slf4j
public class CheckOutBillServiceImpl implements CheckOutBillService {
@Autowired
private final StorPublicService storPublicService;
private final RawAssistIStorService rawAssistIStorService;
private final HandMoveStorService handMoveStorService;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
@@ -962,6 +968,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
// 库存表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
String struct_id = whereJson.getString("struct_id");
String point_code = whereJson.getString("point_code"); // 终点
@@ -1112,9 +1120,52 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "99");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");
mapParam.put("stor_name", "成品仓库");
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
// TODO 创建移库单
// 查询移入货位
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag","6")
.addParam("struct_id",json.getString("struct_id"))
.process().uniqueResult(0);
// 移库单明细
JSONObject jsonMoveDtl = new JSONObject();
jsonMoveDtl.put("is_task", "2");
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
jsonMoveDtl.put("quality_scode", "01");
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
jsonMoveDtl.put("source_billdtl_id", dis.getLongValue("iostorinvdis_id"));
// 生成任务
JSONObject param2 = new JSONObject();
@@ -1122,12 +1173,22 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
param2.put("vehicle_code", json.getString("storagevehicle_code"));
param2.put("task_name", "task_name");
param2.put("point_code1", json.getString("point_code"));
param2.put("point_code2", ""); // TODO 移入仓位
param2.put("point_code2", jsonMove.getString("struct_code"));
param2.put("task_group_id", jsonTask.getLongValue("task_group_id")); // 任务组
param2.put("sort_seq", jsonTask.getIntValue("sort_seq") + i + 1); // 任务组顺序号
outTask.createTask(param2);
}
String move_task_id = outTask.createTask(param2);
// 回显移库明细任务id
jsonMoveDtl.put("task_id", move_task_id);
table.add(jsonMoveDtl);
// 更新任务处理类
JSONObject jsonTaskMove = wo_Task.query("task_id = '" + move_task_id + "'").uniqueResult(0);
jsonTaskMove.put("handle_class", HandMoveStorAcsTask.class.getName());
wo_Task.update(jsonTaskMove);
}
mapParam.put("tableData", table);
// 调用移库单新增方法
handMoveStorService.insertDtl2(mapParam);
}
} else {
JSONObject map = new JSONObject();
@@ -1172,9 +1233,52 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "99");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");
mapParam.put("stor_name", "成品仓库");
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
// TODO 创建移库单
// 查询移入货位
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag","6")
.addParam("struct_id",json.getString("struct_id"))
.process().uniqueResult(0);
// 移库单明细
JSONObject jsonMoveDtl = new JSONObject();
jsonMoveDtl.put("is_task", "2");
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
jsonMoveDtl.put("quality_scode", "01");
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
jsonMoveDtl.put("source_billdtl_id", dis.getLongValue("iostorinvdis_id"));
// 生成任务
JSONObject param2 = new JSONObject();
@@ -1182,15 +1286,25 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
param2.put("vehicle_code", json.getString("storagevehicle_code"));
param2.put("task_name", "task_name");
param2.put("point_code1", json.getString("point_code"));
param2.put("point_code2", ""); // TODO 移入仓位
param2.put("point_code2", jsonMove.getString("struct_code"));
param2.put("task_group_id", jsonTask.getLongValue("task_group_id")); // 任务组
param2.put("sort_seq", jsonTask.getIntValue("sort_seq") + i + 1); // 任务组顺序号
outTask.createTask(param2);
String move_task_id = outTask.createTask(param2);
// 回显移库明细任务id
jsonMoveDtl.put("task_id", move_task_id);
table.add(jsonMoveDtl);
// 更新任务处理类
JSONObject jsonTaskMove = wo_Task.query("task_id = '" + move_task_id + "'").uniqueResult(0);
jsonTaskMove.put("handle_class", HandMoveStorAcsTask.class.getName());
wo_Task.update(jsonTaskMove);
}
mapParam.put("tableData", table);
// 调用移库单新增方法
handMoveStorService.insertDtl2(mapParam);
}
// 下发
outTask.immediateNotifyAcs();
}
}
@@ -1719,6 +1833,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
return jsonArr;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void moneySubmit(JSONObject whereJson) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv");
mstTab.update(whereJson);
}
/**
* 更新主表状态
*

View File

@@ -67,9 +67,20 @@
IF 输入.flag = "1"
PAGEQUERY
SELECT
ios.*
ios.*,
dis.num
FROM
ST_IVT_IOStorInv ios
LEFT JOIN (
SELECT
count(d.struct_id) AS num,
d.iostorinv_id
FROM
ST_IVT_IOStorInvDis d
WHERE
1=1
group by d.struct_id
) AS dis ON ios.iostorinv_id = dis.iostorinv_id
WHERE
io_type = '1'
and ios.is_delete='0'
@@ -116,7 +127,9 @@
iosdtl.*,
ios.bill_code,
mb.material_code,
mb.material_name
mb.material_name,
mb.material_spec,
mb.material_model
FROM
ST_IVT_IOStorInvDtl iosdtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = iosdtl.material_id

View File

@@ -14,6 +14,7 @@
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.struct_id TYPEAS s_string
输入.struct_code TYPEAS s_string
输入.sect_id TYPEAS s_string
输入.out_order_seq TYPEAS s_string
@@ -245,6 +246,31 @@
order by attr.out_order_seq ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
ivt.struct_id,
ivt.material_id,
sum(ivt.canuse_qty) AS canuse_qty,
max(ivt.pcsn) AS pcsn,
ivt.qty_unit_id,
unit.unit_name
FROM
ST_IVT_StructIvt ivt
LEFT JOIN md_pb_measureunit unit ON ivt.qty_unit_id = unit.measure_unit_id
WHERE
1=1
OPTION 输入.struct_id <> ""
ivt.struct_id = 输入.struct_id
ENDOPTION
group by ivt.struct_id
ENDSELECT
ENDQUERY
ENDIF