add:增加RCS下发逻辑;
add:增加PC出库分配逻辑; opt:优化通用API通讯工具;
This commit is contained in:
@@ -24,6 +24,12 @@ public class TableDataInfo<T> implements Serializable {
|
||||
*/
|
||||
private long totalElements;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
@@ -62,6 +68,7 @@ public class TableDataInfo<T> implements Serializable {
|
||||
return rspData;
|
||||
}
|
||||
|
||||
|
||||
public static <T> TableDataInfo<T> build(List<T> list) {
|
||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.nl.config.thread;
|
||||
|
||||
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -27,16 +27,17 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author Zheng Jie
|
||||
* @date 2019年10月31日18:16:47
|
||||
*/
|
||||
@Configuration
|
||||
public class ThreadPoolExecutorUtil {
|
||||
|
||||
public static ThreadPoolExecutor getPoll(){
|
||||
AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
|
||||
@Bean(name = "meshandlerPool")
|
||||
public ThreadPoolExecutor meshandlerPool(){
|
||||
return new ThreadPoolExecutor(
|
||||
properties.getCorePoolSize(),
|
||||
properties.getMaxPoolSize(),
|
||||
properties.getKeepAliveSeconds(),
|
||||
8,
|
||||
32,
|
||||
30,
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(properties.getQueueCapacity()),
|
||||
new ArrayBlockingQueue<>(128),
|
||||
new TheadFactoryName()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,11 +12,21 @@ public class SysParamConstant {
|
||||
*/
|
||||
public final static String IS_CONNECT_ACS = "is_connect_acs";
|
||||
|
||||
/**
|
||||
* 是否连接RCS
|
||||
*/
|
||||
public final static String IS_CONNECT_RCS = "is_connect_rcs";
|
||||
|
||||
/**
|
||||
* ACS系统IP
|
||||
*/
|
||||
public final static String ACS_URL = "acs_url";
|
||||
|
||||
/**
|
||||
* RCS系统IP
|
||||
*/
|
||||
public final static String RCS_URL = "rcs_url";
|
||||
|
||||
/**
|
||||
* ERP系统IP
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -102,9 +101,16 @@ public interface IStructattrService extends IService<Structattr> {
|
||||
*/
|
||||
Structattr getByCode(String struct_code);
|
||||
|
||||
|
||||
/**
|
||||
* 获取仓位库存
|
||||
*/
|
||||
List<StructattrVechielDto> collectVechicle(Map query);
|
||||
|
||||
/**
|
||||
* 获取点位库存
|
||||
*/
|
||||
List<StructattrVechielDto> getRegionIvt(Map query);
|
||||
|
||||
/**
|
||||
* 出库规则
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.math.BigDecimal;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_pb_storagevehicleext")
|
||||
public class MdPbStoragevehicleext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -188,6 +188,12 @@ public class StructattrVechielDto extends GroupPlate {
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 物料规格
|
||||
*/
|
||||
private String material_spec;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
md_pb_groupplate ext
|
||||
INNER JOIN md_me_materialbase material ON material.material_id = ext.material_id
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = ext.material_id
|
||||
LEFT JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
<where>
|
||||
attr.lock_type = '0'
|
||||
AND attr.is_used = "1"
|
||||
AND ext.frozen_qty = 0
|
||||
AND ext.qty > 0
|
||||
AND ext.status ='02'
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id LIKE #{param.stor_id}
|
||||
@@ -126,12 +128,13 @@
|
||||
</select>
|
||||
|
||||
<select id="queryOutAllocation" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
|
||||
SELECT ex.*,st.sect_id,st.sect_code,st.sect_name,st.struct_id,st.struct_code,st.struct_name
|
||||
SELECT ex.*,st.sect_id,st.sect_code,st.sect_name,st.struct_id,st.struct_code,st.struct_name,mt.material_code
|
||||
FROM md_pb_groupplate ex LEFT JOIN st_ivt_structattr st on ex.storagevehicle_code = st.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mt on ex.material_id = mt.material_id
|
||||
<where>
|
||||
material_id = #{material_id}
|
||||
ex.material_id = #{material_id}
|
||||
AND
|
||||
ex.canuse_qty > 0
|
||||
ex.qty > 0
|
||||
AND
|
||||
st.lock_type = 0
|
||||
<if test="pcsn!= null and pcsn!= ''">
|
||||
@@ -139,7 +142,7 @@
|
||||
pcsn = #{pcsn}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ex.insert_time,ex.canuse_qty
|
||||
ORDER BY ex.create_time,ex.qty
|
||||
</select>
|
||||
|
||||
<select id="erpQueryIvt" resultType="com.alibaba.fastjson.JSONObject">
|
||||
|
||||
@@ -15,6 +15,18 @@ import java.util.Map;
|
||||
@Mapper
|
||||
public interface StructattrMapper extends BaseMapper<Structattr>{
|
||||
|
||||
|
||||
/**
|
||||
* 获取仓位库存
|
||||
*/
|
||||
List<StructattrVechielDto> collectVehicle(Map query);
|
||||
|
||||
|
||||
/**
|
||||
* 获取点位库存
|
||||
*/
|
||||
List<StructattrVechielDto> getRegionIvt(Map query);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
gro.group_id,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
ivt.*
|
||||
FROM
|
||||
st_ivt_structattr ivt
|
||||
LEFT JOIN md_pb_groupplate gro ON ivt.storagevehicle_code = gro.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gro.material_id
|
||||
<where>
|
||||
gro.frozen_qty = 0
|
||||
<if test="search != null and search != ''">
|
||||
and (mater.material_code LIKE '%${search}%'
|
||||
or mater.material_name LIKE '%${search}%')
|
||||
@@ -45,7 +47,57 @@
|
||||
</if>
|
||||
<if test="is_lock != null and is_lock != ''">
|
||||
and ivt.lock_type = '0'
|
||||
and gro.frozen_qty = 0
|
||||
|
||||
</if>
|
||||
<if test="order_by != null and order_by != ''">
|
||||
order by ${order_by}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getRegionIvt" resultType="org.nl.wms.basedata_manage.service.dao.StructattrVechielDto">
|
||||
SELECT
|
||||
gro.qty,
|
||||
gro.frozen_qty,
|
||||
gro.create_time,
|
||||
gro.qty_unit_name,
|
||||
gro.material_id,
|
||||
gro.pcsn,
|
||||
gro.group_id,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
po.point_code as struct_code,
|
||||
po.vehicle_code as storagevehicle_code
|
||||
FROM
|
||||
sch_base_point po
|
||||
LEFT JOIN md_pb_groupplate gro ON po.vehicle_code = gro.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gro.material_id
|
||||
<where>
|
||||
gro.frozen_qty = 0
|
||||
<if test="search != null and search != ''">
|
||||
and (mater.material_code LIKE '%${search}%'
|
||||
or mater.material_name LIKE '%${search}%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND gro.status = #{status}
|
||||
</if>
|
||||
<if test="material_id != null and material_id != ''">
|
||||
AND gro.material_id = #{material_id}
|
||||
</if>
|
||||
<if test="pcsn != null and pcsn != ''">
|
||||
AND gro.pcsn = #{pcsn}
|
||||
</if>
|
||||
<if test="region_code != null and region_code != ''">
|
||||
AND po.region_code = #{region_code}
|
||||
</if>
|
||||
<if test="vehicles != null and vehicles.size() > 0">
|
||||
AND po.vehicle_code in
|
||||
<foreach collection="vehicles" item="value" index="key" open="(" close=")" separator=",">
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="is_has_workder != null and is_has_workder != ''">
|
||||
and po.is_has_workder = '0'
|
||||
</if>
|
||||
<if test="order_by != null and order_by != ''">
|
||||
order by ${order_by}
|
||||
|
||||
@@ -2,13 +2,14 @@ package org.nl.wms.basedata_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/5
|
||||
*/
|
||||
@Data
|
||||
public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
public class MdPbStoragevehicleextDto extends GroupPlate {
|
||||
|
||||
/**
|
||||
* 库区标识
|
||||
@@ -45,4 +46,9 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -318,13 +318,22 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
|
||||
|
||||
/**
|
||||
* 库存查询
|
||||
* 获取仓位库存
|
||||
*/
|
||||
@Override
|
||||
public List<StructattrVechielDto> collectVechicle(Map query) {
|
||||
return this.baseMapper.collectVehicle(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取点位库存
|
||||
*/
|
||||
@Override
|
||||
public List<StructattrVechielDto> getRegionIvt(Map query) {
|
||||
return this.baseMapper.getRegionIvt(query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 出库分配
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface WmsToAcsService {
|
||||
* @return AcsResponse
|
||||
*/
|
||||
AcsResponse renotifyAcs(List<AcsTaskDto> list);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.nl.wms.ext.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.system.enums.SysParamConstant;
|
||||
import org.nl.wms.ext.enums.EXTConstant;
|
||||
import org.nl.wms.ext.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.ext.util.AcsUtil;
|
||||
import org.nl.wms.ext.util.NotifyUtil;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -24,6 +24,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public AcsResponse renotifyAcs(List<AcsTaskDto> list) {
|
||||
return AcsUtil.notifyAcs(EXTConstant.SEND_TASK_ACS_API, list);
|
||||
return NotifyUtil.apiNotify(EXTConstant.SEND_TASK_ACS_API, SysParamConstant.IS_CONNECT_ACS, SysParamConstant.ACS_URL, list, AcsResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package org.nl.wms.gateway.controller;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.gateway.service.GateWayService;
|
||||
import org.nl.wms.gateway.dto.InteracteDto;
|
||||
import org.nl.wms.gateway.service.IGateWayService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -26,7 +26,7 @@ import javax.annotation.Resource;
|
||||
public class GateWayController {
|
||||
|
||||
@Resource
|
||||
private GateWayService gateWayService;
|
||||
private IGateWayService gateWayService;
|
||||
@PostMapping("/apply")
|
||||
@SaIgnore
|
||||
@Log("外层服务请求wms")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.gateway.dto;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: gbx
|
||||
* @Description: 下发acs的反馈数据
|
||||
* @Date: 2025/07/08
|
||||
*/
|
||||
@Data
|
||||
public class RcsResponse {
|
||||
private String data;
|
||||
private int code;
|
||||
private String desc;
|
||||
private String responseDate;
|
||||
/**
|
||||
* 请求失败
|
||||
*
|
||||
* @param desc 错误信息
|
||||
* @return RcsResponse
|
||||
*/
|
||||
public static RcsResponse requestError(String desc) {
|
||||
RcsResponse result = new RcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setDesc(desc);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求成功带信息
|
||||
*
|
||||
* @param desc 详细信息
|
||||
* @param data 返回信息
|
||||
* @return RcsResponse
|
||||
*/
|
||||
public static RcsResponse requestOkMessage(String desc, String data) {
|
||||
RcsResponse result = new RcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_OK);
|
||||
result.setDesc(desc);
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
package org.nl.wms.gateway.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.system.enums.SysParamConstant;
|
||||
import org.nl.wms.ext.enums.EXTConstant;
|
||||
import org.nl.wms.ext.util.NotifyUtil;
|
||||
import org.nl.wms.gateway.dto.InteracteDto;
|
||||
import org.nl.wms.gateway.dto.RcsResponse;
|
||||
import org.nl.wms.gateway.service.IGateWayService;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* 网关执行实现层
|
||||
@@ -24,11 +35,17 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GateWayServiceImpl {
|
||||
public class GateWayServiceImpl implements IGateWayService {
|
||||
|
||||
|
||||
@Resource
|
||||
private Map<String, AbstractTask> applyTaskMap;
|
||||
@Autowired
|
||||
private GateWayServiceImpl gateWayServiceImpl;
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
public String applyTask(String service, String type, JSONObject data, InteracteDto<Map> param) {
|
||||
if ("InStorage".equals(service)) {
|
||||
@@ -51,4 +68,62 @@ public class GateWayServiceImpl {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject apply(InteracteDto<Map> param) {
|
||||
JSONObject jsonObject = new JSONObject(param.getData());
|
||||
//处理日志相关
|
||||
JSONObject result = new JSONObject();
|
||||
String service = param.getService();
|
||||
String type = param.getType();
|
||||
//根据服务拆分不同的业务
|
||||
if ("InStorage".equals(service)) {
|
||||
RedissonUtils.lock(() -> {
|
||||
String taskCode = gateWayServiceImpl.applyTask(param.getService(), type, jsonObject, param);
|
||||
result.put("taskCode", taskCode);
|
||||
}, param.getService() + param.getType(), null);
|
||||
}
|
||||
if ("Task".equals(service)) {
|
||||
iSchBaseTaskService.operation(jsonObject);
|
||||
}
|
||||
if ("DeviceInfo".equals(service)) {
|
||||
|
||||
}
|
||||
if ("Device".equals(service)) {
|
||||
Assert.noNullElements(new Object[]{jsonObject.getString("devicePoint"), jsonObject.getString("status")}, "请求参数不能为空");
|
||||
if (!"1207".equals(jsonObject.getString("devicePoint")) && !"1210".equals(jsonObject.getString("devicePoint"))) {
|
||||
throw new BadRequestException("您输入的拣选位不存在,请输入1207或1210拣选位!");
|
||||
}
|
||||
RedissonUtils.lock(() -> {
|
||||
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SchBasePoint::getIs_used, "0".equals(jsonObject.getString("status")) ? 0 : 1);
|
||||
iSchBasePointService.update(updateWrapper);
|
||||
}, param.getService() + param.getType(), null);
|
||||
}
|
||||
if ("ErrorInfo".equals(service)) {
|
||||
Assert.noNullElements(new Object[]{type, jsonObject.getString("msg")}, "请求参数不能为空");
|
||||
String msg = jsonObject.getString("msg").trim();
|
||||
//iSchBasePointService.sendErrorMsg(type,null, msg);
|
||||
}
|
||||
if ("ErrorTask".equals(service)) {
|
||||
AtomicReference<JSONObject> reference = new AtomicReference<>(new JSONObject());
|
||||
RedissonUtils.lock(() -> {
|
||||
// reference.set(iSchBaseTaskService.errorTask(jsonObject, param.getType()));
|
||||
}, param.getService() + param.getType(), null);
|
||||
return reference.get();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发Rcs任务
|
||||
*
|
||||
* @param list 任务集合
|
||||
* @return AcsResponse
|
||||
*/
|
||||
@Override
|
||||
public RcsResponse renotifyRcs(List<String> list) {
|
||||
return NotifyUtil.apiNotify(EXTConstant.SEND_TASK_ACS_API, SysParamConstant.IS_CONNECT_RCS, SysParamConstant.RCS_URL, list, RcsResponse.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
@@ -40,8 +41,11 @@ public class PdaIosInController {
|
||||
@PostMapping("/groupPlate")
|
||||
@Log("物料组盘确认")
|
||||
public ResponseEntity<Object> groupPlate(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code", "material_id","qty");
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(pdaIosInService.groupPlate(whereJson)),HttpStatus.OK);
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code", "material_id", "qty");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosInService.groupPlate(whereJson);
|
||||
}, "groupPlate" + whereJson.getString("vehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getPlateDtl")
|
||||
@@ -101,7 +105,10 @@ public class PdaIosInController {
|
||||
@Log("组盘入库确认")
|
||||
public ResponseEntity<Object> confirmIn(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code", "sect_id", "site_code");
|
||||
return new ResponseEntity<>(pdaIosInService.confirmIn(whereJson), HttpStatus.OK);
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosInService.confirmIn(whereJson);
|
||||
}, "confirmIn" + whereJson.getString("vehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +126,12 @@ public class PdaIosInController {
|
||||
@PostMapping("/confirmReturnMaterial")
|
||||
@Log("余料回库确认")
|
||||
public ResponseEntity<Object> confirmReturnMaterial(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "sect_code", "group_id", "vehicle_code", "material_code", "qty", "stor_id");
|
||||
return new ResponseEntity<>(pdaIosInService.confirmReturnMaterial(whereJson),HttpStatus.OK);
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "sect_id");
|
||||
JSONObject json = whereJson.getJSONObject("obj");
|
||||
json.put("sect_id", whereJson.getString("sect_id"));
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosInService.confirmReturnMaterial(whereJson);
|
||||
}, "confirmReturnMaterial" + json.getString("storagevehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,10 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -49,20 +48,12 @@ public class PdaIosOutController {
|
||||
@PostMapping("/getMaterialDtl")
|
||||
@Log("物料出库获取物料库存")
|
||||
public ResponseEntity<Object> getMaterialDtl(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "search");
|
||||
return new ResponseEntity<>(pdaIosOutService.getMaterialDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 货架与站点绑定或解绑
|
||||
*/
|
||||
@PostMapping("bindOrUnbind")
|
||||
@Log("货架与站点绑定或解绑")
|
||||
public ResponseEntity<Object> bindOrUnbind(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "siteCode", "shelfCode", "mode");
|
||||
return new ResponseEntity<>(pdaIosOutService.bindOrUnbind(whereJson), HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,20 +62,39 @@ public class PdaIosOutController {
|
||||
@PostMapping("/materialConfirm")
|
||||
@Log("线边库物料出库确认")
|
||||
public ResponseEntity<Object> materialConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "group_id", "storagevehicle_code", "siteCode", "struct_code");
|
||||
return new ResponseEntity<>(pdaIosOutService.materialConfirm(whereJson), HttpStatus.OK);
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "sect_id", "siteCode", "group_id");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.materialConfirm(whereJson);
|
||||
}, "materialConfirm" + whereJson.getString("group_id"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 载具出库确认
|
||||
* 线边库物料出库确认
|
||||
*/
|
||||
@PostMapping("/confirm")
|
||||
@Log("载具出库确认")
|
||||
public ResponseEntity<Object> outStorageConfirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaIosOutService.outStorageConfirm(whereJson), HttpStatus.OK);
|
||||
@PostMapping("/callMaterialConfirm")
|
||||
@Log("产线叫料出库点确认")
|
||||
public ResponseEntity<Object> callMaterialConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "group_id", "storagevehicle_code", "siteCode", "struct_code");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.callMaterialConfirm(whereJson);
|
||||
}, "callMaterialConfirm" + whereJson.getString("group_id"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 货架与站点绑定或解绑
|
||||
*/
|
||||
@PostMapping("bindOrUnbind")
|
||||
@Log("货架与站点绑定或解绑")
|
||||
public ResponseEntity<Object> bindOrUnbind(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "siteCode", "shelfCode", "mode");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.bindOrUnbind(whereJson);
|
||||
}, "bindOrUnbind" + whereJson.getString("siteCode") + whereJson.getString("shelfCode"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库确认获取物料明细
|
||||
@@ -96,6 +106,22 @@ public class PdaIosOutController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 载具出库确认
|
||||
*/
|
||||
@PostMapping("/confirm")
|
||||
@Log("载具出库确认")
|
||||
public ResponseEntity<Object> outStorageConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "storagevehicle_code", "group_id", "type");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.outStorageConfirm(whereJson);
|
||||
}, "outStorageConfirm" + whereJson.getString("storagevehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -107,7 +133,10 @@ public class PdaIosOutController {
|
||||
@Log("转运确认")
|
||||
public ResponseEntity<Object> transferConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "storagevehicle_code");
|
||||
return new ResponseEntity<>(pdaIosOutService.transferConfirm(whereJson), HttpStatus.OK);
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.transferConfirm(whereJson);
|
||||
}, "transferConfirm" + whereJson.getString("storagevehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +147,10 @@ public class PdaIosOutController {
|
||||
@Log("空载具出库确认")
|
||||
public ResponseEntity<Object> vehicleOutConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "sect_id", "siteCode");
|
||||
return new ResponseEntity<>(pdaIosOutService.vehicleOutConfirm(whereJson), HttpStatus.OK);
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosOutService.vehicleOutConfirm(whereJson);
|
||||
}, "vehicleOutConfirm" + whereJson.getString("sect_id") + whereJson.getString("siteCode"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,19 @@ public interface PdaIosOutService {
|
||||
|
||||
|
||||
/**
|
||||
* 线边库物料出库确认
|
||||
* 产线叫料点确认
|
||||
*
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具码
|
||||
* point_code: 点位编码
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse callMaterialConfirm(JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 载具出库确认
|
||||
*
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具码
|
||||
@@ -57,6 +69,7 @@ public interface PdaIosOutService {
|
||||
*/
|
||||
PdaResponse materialConfirm(JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 货架与站点绑定或解绑
|
||||
*
|
||||
|
||||
@@ -268,14 +268,14 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
*/
|
||||
@Override
|
||||
public PdaResponse getReturnMaterial(JSONObject whereJson) {
|
||||
whereJson.put("status", GROUP_PLATE_STATUS.code("出库"));
|
||||
whereJson.put("status", GROUP_PLATE_STATUS.code("入库"));
|
||||
whereJson.put("vehicleCode", whereJson.getString("search"));
|
||||
whereJson.put("qty", 0);
|
||||
List<JSONObject> list = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
throw new BadRequestException("此载具无余料可回库!");
|
||||
}
|
||||
return PdaResponse.requestParamOk(list);
|
||||
return PdaResponse.requestParamOk(list.get(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -292,27 +292,40 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse confirmReturnMaterial(JSONObject whereJson) {
|
||||
//校验回库起点
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code")));
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
throw new BadRequestException("未找到载具所在的点位信息,请检查");
|
||||
}
|
||||
// 生成回库任务
|
||||
whereJson.put("site_code",schBasePoint.getPoint_code());
|
||||
whereJson.put("config_code", IOSConstant.BACK_IN_TASK);
|
||||
whereJson.put("vehicle_code", whereJson.getString("vehicle_code"));
|
||||
whereJson.put("vehicle_code", whereJson.getString("storagevehicle_code"));
|
||||
whereJson.put("Priority", TaskEnum.ACS_PRIORITY.code("1"));
|
||||
// 查询库区
|
||||
Sectattr sectDao = iSectattrService.getById(whereJson.getString("sect_id"));
|
||||
whereJson.put("stor_id", sectDao.getStor_id());
|
||||
whereJson.put("sect_code", sectDao.getSect_code());
|
||||
//入库分配
|
||||
divStructNoBills(whereJson);
|
||||
//更新组盘表状态
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 不含单据入库业务
|
||||
* storagevehicle_code 载具号
|
||||
* stor_id 入库仓库id
|
||||
* sect_code 库区编号
|
||||
* material_code 物料编号
|
||||
* qty 数量
|
||||
* pcsn 批次
|
||||
* site_code 所在点位
|
||||
* config_code 任务配置类型
|
||||
*/
|
||||
private void divStructNoBills(JSONObject whereJson) {
|
||||
//校验载具
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("storagevehicle_code"));
|
||||
if (ObjectUtil.isEmpty(vehicleDao)) {
|
||||
throw new BadRequestException("不存在该载具号信息,请检查");
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
@@ -33,7 +32,6 @@ import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.PdaPointTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StOutTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.VehicleOutTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
@@ -52,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -162,22 +161,40 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
|
||||
@Override
|
||||
public PdaResponse getMaterialDtl(JSONObject whereJson) {
|
||||
List<StructattrVechielDto> list = iStructattrService.collectVechicle(
|
||||
MapOf.of("search", whereJson.getString("search"),
|
||||
"stor_code", "XB",
|
||||
"status", GROUP_PLATE_STATUS.code("入库"),
|
||||
"is_lock", "false",
|
||||
"order_by", "gro.create_time asc"));
|
||||
List<StructattrVechielDto> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(whereJson.getString("sect_id"))) {
|
||||
list = iStructattrService.collectVechicle(
|
||||
MapOf.of("search", whereJson.getString("search"),
|
||||
"stor_code", "XB",
|
||||
"status", GROUP_PLATE_STATUS.code("入库"),
|
||||
"is_lock", "false",
|
||||
"order_by", "gro.create_time asc"));
|
||||
} else if (StringUtils.isNotBlank(whereJson.getString("region_code"))) {
|
||||
list = iStructattrService.getRegionIvt(
|
||||
MapOf.of("search", whereJson.getString("search"),
|
||||
"region_code", whereJson.getString("region_code"),
|
||||
"status", GROUP_PLATE_STATUS.code("入库"),
|
||||
"is_has_workder", "false",
|
||||
"order_by", "gro.create_time asc"));
|
||||
}
|
||||
return PdaResponse.requestParamOk(list);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PdaResponse getVehicleMaterial(JSONObject whereJson) {
|
||||
whereJson.put("status", GROUP_PLATE_STATUS.code("出库"));
|
||||
List<JSONObject> list = new ArrayList<JSONObject>();
|
||||
whereJson.put("status", GROUP_PLATE_STATUS.code("入库"));
|
||||
whereJson.put("vehicleCode", whereJson.getString("search"));
|
||||
whereJson.put("qty", 0);
|
||||
return PdaResponse.requestParamOk(mdPbGroupplateMapper.getVehicleMaterial(whereJson));
|
||||
whereJson.put("frozen_qty", 0);
|
||||
List<JSONObject> result = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
throw new BadRequestException("此载具无出库确认的任务!");
|
||||
}
|
||||
list.add(result.get(0));
|
||||
return PdaResponse.requestParamOk(list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +247,54 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse callMaterialConfirm(JSONObject whereJson) {
|
||||
//创建出库单/明细/分配
|
||||
GroupPlate plateDao = mdPbGroupplateMapper.selectOne(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")));
|
||||
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, whereJson.getString("struct_code")));
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id());
|
||||
whereJson.put("material_id", materDao.getMaterial_id());
|
||||
whereJson.put("material_code", materDao.getMaterial_code());
|
||||
whereJson.put("store_id", sectDao.getStor_id());
|
||||
whereJson.put("store_code", sectDao.getStor_code());
|
||||
whereJson.put("store_name", sectDao.getStor_name());
|
||||
whereJson.put("sec", sectDao.getSect_id());
|
||||
whereJson.put("qty", plateDao.getQty());
|
||||
whereJson.put("pcsn", plateDao.getPcsn());
|
||||
whereJson.put("unit_id", plateDao.getQty_unit_id());
|
||||
whereJson.put("unit_name", plateDao.getQty_unit_name());
|
||||
//创建出库单据
|
||||
String disId = createOutBills(whereJson);
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", whereJson.getString("struct_code"));
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
//创建任务
|
||||
JSONObject taskForm = new JSONObject();
|
||||
taskForm.put("task_type", "STOutTask");
|
||||
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskForm.put("PickingLocation", whereJson.getString("struct_code"));
|
||||
taskForm.put("PlacedLocation", whereJson.getString("siteCode"));
|
||||
taskForm.put("vehicle_code", whereJson.getString("storagevehicle_code"));
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
String taskId = stOutTask.create(taskForm);
|
||||
//更新任务id
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
.set(IOStorInvDis::getTask_id, taskId)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, disId)
|
||||
);
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getFrozen_qty, plateDao.getQty())
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"))
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
/**
|
||||
* 空载具出库
|
||||
@@ -399,6 +464,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
if (ObjectUtils.isNotEmpty(cxPointLists)) {
|
||||
throw new BadRequestException("该货架正在执行输送任务,状态为锁定,请等任务完成再做绑定或解绑!");
|
||||
}
|
||||
//更新点位
|
||||
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, whereJson.getString("siteCode"));
|
||||
if ("1" .equals(whereJson.getString("mode"))) {
|
||||
@@ -439,6 +505,9 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
throw new BadRequestException("未找到载具所在的点位信息,请检查");
|
||||
}
|
||||
GroupPlate groupPlate = mdPbGroupplateMapper.selectById(whereJson.getString("group_id"));
|
||||
if (groupPlate.getFrozen_qty().compareTo(BigDecimal.ZERO) == 0 || groupPlate.getQty().compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new BadRequestException("该载具已出库确认,无需再次操作!");
|
||||
}
|
||||
//更新组盘信息
|
||||
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
//出库确认
|
||||
@@ -448,11 +517,11 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
} else {
|
||||
//强制确认
|
||||
updateWrapper.set(GroupPlate::getQty, 0).set(GroupPlate::getFrozen_qty, 0);
|
||||
updateWrapper.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"));
|
||||
}
|
||||
updateWrapper.set(GroupPlate::getUpdate_optid, currentUserId + "")
|
||||
.set(GroupPlate::getUpdate_optname, nickName)
|
||||
.set(GroupPlate::getUpdate_time, now)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"));
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), updateWrapper);
|
||||
|
||||
@@ -60,8 +60,8 @@ public class PdaResponse<T> {
|
||||
public static <T> TableDataInfo<T> build(IPage<T> page) {
|
||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setContent(page.getRecords());
|
||||
rspData.setMessage("查询成功");
|
||||
rspData.setData(page.getRecords());
|
||||
rspData.setTotalElements(page.getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
}
|
||||
}
|
||||
TableDataInfo build = TableDataInfo.build(page);
|
||||
build.setContent(list);
|
||||
build.setData(list);
|
||||
return build;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,4 +61,6 @@ public class SchBaseRegion implements Serializable {
|
||||
|
||||
private Integer order_seq;
|
||||
|
||||
private String stor_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -168,9 +168,11 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getPointList(SchBasePoint region) {
|
||||
String regionCode = (region != null) ? region.getRegion_code() : null;
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, region.getRegion_code())
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
.eq(regionCode != null, SchBasePoint::getRegion_code, regionCode)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,9 +84,12 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
|
||||
@Override
|
||||
public List<SchBaseRegion> getRegionList(SchBaseRegion region) {
|
||||
return schBaseRegionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>()
|
||||
.eq(ObjectUtil.isNotEmpty(region), SchBaseRegion::getIs_has_workder, true)
|
||||
.orderByAsc(SchBaseRegion::getOrder_seq));
|
||||
LambdaQueryWrapper<SchBaseRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (region != null) {
|
||||
lambdaQueryWrapper.eq(SchBaseRegion::getStor_code, region.getStor_code());
|
||||
}
|
||||
lambdaQueryWrapper.orderByAsc(SchBaseRegion::getOrder_seq);
|
||||
return schBaseRegionMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,7 +13,7 @@ import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -37,6 +36,13 @@ public abstract class AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
|
||||
|
||||
/**
|
||||
* wms调用acs接口服务
|
||||
*/
|
||||
@@ -51,37 +57,9 @@ public abstract class AbstractTask {
|
||||
|
||||
/**
|
||||
* 下发acs前参数整理
|
||||
*
|
||||
*/
|
||||
public abstract AcsTaskDto sendAcsParam(String taskId);
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*/
|
||||
public void schedule() {
|
||||
this.autoTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有任务并整理好参数
|
||||
*/
|
||||
public void autoTask() {
|
||||
// 查询未执行下发的任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.CREATE.getCode()));
|
||||
if (ObjectUtil.isEmpty(taskList)) {
|
||||
return;
|
||||
}
|
||||
// 整理下发acs参数
|
||||
List<AcsTaskDto> taskDtoList = new ArrayList<>();
|
||||
for (SchBaseTask taskDao : taskList) {
|
||||
AcsTaskDto acsTaskDto = this.sendAcsParam(taskDao.getTask_id());
|
||||
taskDtoList.add(acsTaskDto);
|
||||
}
|
||||
// 下发
|
||||
this.renotifyAcs(taskDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发当前任务
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.TaskOrderDetail;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -16,17 +18,44 @@ public class AcsTaskDto {
|
||||
*/
|
||||
private String ext_task_uuid;
|
||||
|
||||
/**
|
||||
* 任务模板
|
||||
*/
|
||||
private String modelProcessCode;
|
||||
|
||||
/**
|
||||
* 源头系统
|
||||
*/
|
||||
private String fromSystem;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
|
||||
/**
|
||||
* 任务路径
|
||||
*/
|
||||
private String taskPath;
|
||||
|
||||
|
||||
/**
|
||||
* 货架编号
|
||||
*/
|
||||
private String shelfNumber;
|
||||
/**
|
||||
* 取货点1
|
||||
*/
|
||||
String start_device_code;
|
||||
|
||||
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
@@ -124,4 +153,9 @@ public class AcsTaskDto {
|
||||
* 扩展属性
|
||||
*/
|
||||
Map<String, String> params;
|
||||
|
||||
/**
|
||||
* 任务明细
|
||||
*/
|
||||
private List<TaskOrderDetail> taskOrderDetail;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.wms.gateway.dto.RcsResponse;
|
||||
import org.nl.wms.gateway.service.IGateWayService;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@@ -29,14 +38,22 @@ public class AutoTask {
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
/**
|
||||
* 任务工厂服务
|
||||
*/
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
@Resource
|
||||
private IGateWayService iGateWayService;
|
||||
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
//定时任务
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
@@ -54,19 +71,56 @@ public class AutoTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时下发任务
|
||||
* 定时任务:下发任务
|
||||
*/
|
||||
private void sendTask() {
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.CREATE.getCode()));
|
||||
if (ObjectUtil.isEmpty(taskList)) {
|
||||
if (CollectionUtils.isEmpty(taskList)) {
|
||||
return;
|
||||
}
|
||||
// 整理下发acs参数
|
||||
List<SchBaseTask> failTaskList = new ArrayList<>();
|
||||
Set<String> issuedTaskSet = new HashSet<>();
|
||||
// 整理下发rcs参数
|
||||
for (SchBaseTask taskDao : taskList) {
|
||||
AbstractTask task = taskFactory.getTask(taskDao.getConfig_code());
|
||||
task.sendTaskOne(taskDao.getTask_id());
|
||||
List<String> taskDtoList = new ArrayList<>();
|
||||
taskDtoList.add(updateIvtUtils.sendRcsParam(taskDao));
|
||||
RcsResponse resultForRcs = RcsResponse.requestOkMessage("", "");
|
||||
try {
|
||||
// 创建下发对象
|
||||
resultForRcs = iGateWayService.renotifyRcs(taskDtoList);
|
||||
} catch (Exception e) {
|
||||
log.error("任务下发异常: {}", e.getMessage());
|
||||
resultForRcs.setResponseDate(DateUtil.now());
|
||||
resultForRcs.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
resultForRcs.setDesc(e.getMessage());
|
||||
}
|
||||
if (resultForRcs.getCode() == HttpStatus.HTTP_OK) {
|
||||
issuedTaskSet.add(taskDao.getTask_id());
|
||||
log.info("任务号{},载具号{}下发任务成功", taskDao.getTask_code(), taskDao.getVehicle_code());
|
||||
} else {
|
||||
//获取返回的错误信息
|
||||
String error = resultForRcs.getDesc();
|
||||
//把下发失败的任务号放在集合中,统一更新备注任务下发失败
|
||||
taskDao.setRemark(resultForRcs.getResponseDate() + ":" + error);
|
||||
failTaskList.add(taskDao);
|
||||
log.error("任务号{},载具号{}下发任务失败,错误信息:{}", taskDao.getTask_code(), taskDao.getVehicle_code(), error);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(issuedTaskSet)) {
|
||||
// 如果下发成功,就修改状态
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatus.ISSUED.getCode());
|
||||
updateWrapper.in(SchBaseTask::getTask_id, issuedTaskSet);
|
||||
taskService.update(updateWrapper);
|
||||
}
|
||||
//失败的,更新每个不同失败的原因
|
||||
for (SchBaseTask r : failTaskList) {
|
||||
LambdaUpdateWrapper<SchBaseTask> failUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
failUpdateWrapper.set(SchBaseTask::getRemark, r.getRemark());
|
||||
failUpdateWrapper.eq(SchBaseTask::getTask_id, r.getTask_id());
|
||||
taskService.update(failUpdateWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.sch_manage.service.util.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -19,10 +20,14 @@ import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 余料回库类
|
||||
@@ -50,8 +55,15 @@ public class BackInTask extends AbstractTask {
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
@@ -69,10 +81,9 @@ public class BackInTask extends AbstractTask {
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Override
|
||||
public AcsTaskDto sendAcsParam(String taskId) {
|
||||
SchBaseTask taskDao = taskService.getById(taskId);
|
||||
|
||||
// 组织下发给acs的数据
|
||||
AcsTaskDto acsTaskDto = new AcsTaskDto();
|
||||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id());
|
||||
@@ -84,6 +95,10 @@ public class BackInTask extends AbstractTask {
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
// 校验任务
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -47,9 +48,14 @@ public class MoveTask extends AbstractTask {
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -49,9 +50,14 @@ public class PdaPointTask extends AbstractTask {
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -42,8 +43,14 @@ public class StInTask extends AbstractTask {
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(json.getString("TaskCode"));
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -40,9 +41,14 @@ public class StOutTask extends AbstractTask {
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(json.getString("TaskCode"));
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.sch_manage.service.util.tasks;
|
||||
import lombok.Data;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author gbx
|
||||
*/
|
||||
@Data
|
||||
public class TaskOrderDetail {
|
||||
/**
|
||||
* 任务路径
|
||||
*/
|
||||
private String taskPath;
|
||||
|
||||
/**
|
||||
* 货架编号
|
||||
*/
|
||||
private String shelfNumber;
|
||||
|
||||
/**
|
||||
* 额外信息
|
||||
*/
|
||||
private Map<String, String> extraInfo;
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -50,8 +51,14 @@ public class VehicleInTask extends AbstractTask {
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -41,8 +42,14 @@ public class VehicleOutTask extends AbstractTask {
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 校验工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
updateIvtUtils.checkTask(json);
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(json.getString("TaskCode"));
|
||||
|
||||
@@ -42,7 +42,7 @@ public enum IOSEnum {
|
||||
)),
|
||||
|
||||
// 点位状态
|
||||
POINT_STATUS(MapOf.of("无货", "1", "有货", "2" )),
|
||||
POINT_STATUS(MapOf.of("无货", "0", "有货", "1" )),
|
||||
|
||||
// 单据创建类型
|
||||
CREATE_MODE(MapOf.of("PC产生", "1", "终端产生", "2", "外部接口产生", "3")),
|
||||
|
||||
@@ -50,13 +50,13 @@
|
||||
<select id="getGroupPlate" resultType="org.nl.wms.warehouse_management.service.dto.GroupPlateDto">
|
||||
SELECT group_id,
|
||||
storagevehicle_code,
|
||||
gp.material_code,pcsn,
|
||||
gp.material_id,pcsn,
|
||||
qty_unit_id,
|
||||
qty_unit_name,qty,frozen_qty,remark,
|
||||
status,ext_code,ext_type,
|
||||
mater.material_name,mater.material_spec,mater.material_id
|
||||
mater.material_name,mater.material_spec,mater.material_id,mater.material_code
|
||||
FROM md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_code = gp.material_code
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gp.material_id
|
||||
<where>
|
||||
gp.status = '01' and frozen_qty = 0
|
||||
<if test="params.material_code != null">
|
||||
|
||||
@@ -73,7 +73,11 @@
|
||||
AND
|
||||
gro.status = #{params.status}
|
||||
</if>
|
||||
<if test="params.qty != null and params.qty != ''">
|
||||
<if test="params.frozen_qty == 0">
|
||||
AND
|
||||
gro.frozen_qty>0
|
||||
</if>
|
||||
<if test="params.qty == 0">
|
||||
AND
|
||||
gro.qty>0
|
||||
</if>
|
||||
|
||||
@@ -20,6 +20,8 @@ public class GroupPlateDto extends GroupPlate{
|
||||
|
||||
private String material_id;
|
||||
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -308,6 +309,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.getString("material_id"));
|
||||
ioStorInvDtl.put("material_code", row.getString("material_code"));
|
||||
ioStorInvDtl.put("pcsn", row.getString("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
@@ -343,55 +345,46 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void allDiv(JSONObject whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("查不到出库单信息");
|
||||
}
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
|
||||
// List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
// .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
|
||||
// .gt(IOStorInvDtl::getUnassign_qty,0)
|
||||
// .eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
||||
// List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
// .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
|
||||
// .gt(IOStorInvDtl::getUnassign_qty,0)
|
||||
// .eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
||||
if (ObjectUtil.isEmpty(dtls)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
for (int i = 0; i < dtls.size(); i++) {
|
||||
IOStorInvDtlDto dtl = dtls.get(i);
|
||||
double unassign_qty = dtl.getUnassign_qty().doubleValue();
|
||||
String pcsn = dtl.getPcsn();
|
||||
String material_id = dtl.getMaterial_id();
|
||||
|
||||
String material_code = dtl.getMaterial_code();
|
||||
// 根据物料和批次号查询库存可用
|
||||
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id);
|
||||
|
||||
if (ObjectUtil.isEmpty(canuseSum) || canuseSum.doubleValue()<unassign_qty){
|
||||
throw new BadRequestException("物料编号:"+ dtl.getMaterial_code() +"出库分配数量不满足");
|
||||
}
|
||||
|
||||
/*
|
||||
* 分配规则:
|
||||
* 1.按批次先进先出
|
||||
* 2.相同批次载具量小优先
|
||||
*/
|
||||
|
||||
//出库分配查询货位信息
|
||||
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
|
||||
|
||||
int seq_no = 1;
|
||||
double allocation_canuse_qty = 0;
|
||||
for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
|
||||
@@ -404,6 +397,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
||||
ioStorInvDis.setPcsn(outAllocation.getPcsn());
|
||||
ioStorInvDis.setMaterial_id(material_id);
|
||||
ioStorInvDis.setMaterial_code(material_code);
|
||||
ioStorInvDis.setSect_name(outAllocation.getSect_name());
|
||||
ioStorInvDis.setSect_code(outAllocation.getSect_code());
|
||||
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
|
||||
@@ -414,22 +408,20 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
|
||||
if (unassign_qty<0){
|
||||
unassign_qty=0;
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
unassign_qty = unassign_qty - outAllocation.getQty().doubleValue();
|
||||
if (unassign_qty < 0) {
|
||||
unassign_qty = 0;
|
||||
}
|
||||
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue();
|
||||
ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
|
||||
|
||||
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getQty().doubleValue();
|
||||
ioStorInvDis.setPlan_qty(outAllocation.getQty());
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", outAllocation.getStruct_code());
|
||||
@@ -437,11 +429,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
//生成分配明细
|
||||
ioStorInvDisMapper.insert(ioStorInvDis);
|
||||
|
||||
//更新库存 加冻结减可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -454,13 +444,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
|
||||
//分配完成 结束分配
|
||||
if (unassign_qty==0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//更新详情
|
||||
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
|
||||
@@ -468,7 +456,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
||||
ioStorInvDtlMapper.updateById(dtl);
|
||||
}
|
||||
|
||||
//更新主表
|
||||
//根据单据标识判断明细是否都已经分配完成
|
||||
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
@@ -619,6 +606,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
||||
ioStorInvDis.setPcsn(outAllocation.getPcsn());
|
||||
ioStorInvDis.setMaterial_id(material_id);
|
||||
ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code());
|
||||
ioStorInvDis.setSect_name(outAllocation.getSect_name());
|
||||
ioStorInvDis.setSect_code(outAllocation.getSect_code());
|
||||
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
|
||||
@@ -631,19 +619,19 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
|
||||
if (unassign_qty<0){
|
||||
unassign_qty=0;
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
unassign_qty = unassign_qty - outAllocation.getQty().doubleValue();
|
||||
if (unassign_qty < 0) {
|
||||
unassign_qty = 0;
|
||||
}
|
||||
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue();
|
||||
ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
|
||||
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getQty().doubleValue();
|
||||
ioStorInvDis.setPlan_qty(outAllocation.getQty());
|
||||
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
@@ -652,11 +640,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
|
||||
//生成分配明细
|
||||
ioStorInvDisMapper.insert(ioStorInvDis);
|
||||
|
||||
//更新库存 加冻结减可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -999,10 +986,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Override
|
||||
public void allSetPoint(JSONObject whereJson) {
|
||||
//出库点
|
||||
String point_code = whereJson.getString("point_code");
|
||||
String regionCode = whereJson.getString("point_code");
|
||||
|
||||
if (StrUtil.isBlank(point_code)){
|
||||
throw new BadRequestException("未选择出库点");
|
||||
if (StrUtil.isBlank(regionCode)) {
|
||||
throw new BadRequestException("未选择出库区域");
|
||||
}
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
@@ -1011,40 +998,89 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
}
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).ne(IOStorInvDis::getStruct_code,""))
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinv_id)
|
||||
.eq(IOStorInvDis::getIs_issued, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).ne(IOStorInvDis::getStruct_code, ""))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDisList)){
|
||||
if (ObjectUtil.isEmpty(ioStorInvDisList)) {
|
||||
throw new BadRequestException("当前没有可设置的分配明细");
|
||||
}
|
||||
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
for (IOStorInvDis ioStorInvDis : ioStorInvDisList) {
|
||||
//获取终点
|
||||
String pointCode = getPointCode(regionCode);
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STOutTask");
|
||||
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("PickingLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PlacedLocation", point_code);
|
||||
task_form.put("PlacedLocation", pointCode);
|
||||
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
|
||||
String task_id = stOutTask.create(task_form);
|
||||
|
||||
//更新点位
|
||||
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, pointCode)
|
||||
.set(SchBasePoint::getVehicle_code, ioStorInvDis.getStoragevehicle_code())
|
||||
.set(SchBasePoint::getIs_has_workder, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"));
|
||||
schBasePointMapper.update(new SchBasePoint(), wrapper);
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(ioStorInvDis.getIostorinvdis_id());
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
dis.setPoint_code(regionCode);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
}
|
||||
}
|
||||
|
||||
private String getPointCode(String regionCode) {
|
||||
String pointCode = "";
|
||||
List<SchBasePoint> pointList = schBasePointMapper.selectList(new LambdaQueryWrapper<>(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getRegion_code, regionCode)
|
||||
.eq(SchBasePoint::getIs_used, BaseDataEnum.IS_YES_NOT.code("是")));
|
||||
if (regionCode.contains("Y01")) {
|
||||
Map<String, List<SchBasePoint>> pointMap = pointList.stream().collect(Collectors.groupingBy(SchBasePoint::getParent_point_code));
|
||||
if (ObjectUtils.isEmpty(pointMap)) {
|
||||
throw new RuntimeException("该暂存区已分配或放满了,请及时取走暂存区的物料!");
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<SchBasePoint>> entry : pointMap.entrySet()) {
|
||||
List<SchBasePoint> filteredSortedList = entry.getValue();
|
||||
filteredSortedList.sort(Comparator.comparingInt(SchBasePoint::getCol_num).reversed());
|
||||
boolean hasEmptyVehicle = true;
|
||||
Optional<SchBasePoint> emptyList = filteredSortedList.stream()
|
||||
.filter(n -> n.getPoint_status().equals(IOSEnum.POINT_STATUS.code("无货")))
|
||||
.findFirst();
|
||||
//判断点位外层是否有空载具
|
||||
if (emptyList.isPresent()) {
|
||||
Integer sortSeq = emptyList.get().getCol_num();
|
||||
//外层存在有货的阻挡,那么这一列都不能用了
|
||||
hasEmptyVehicle = filteredSortedList.stream()
|
||||
.anyMatch(r -> r.getCol_num() < sortSeq &&
|
||||
r.getPoint_status().equals(IOSEnum.POINT_STATUS.code("有货")));
|
||||
}
|
||||
if (!hasEmptyVehicle) {
|
||||
pointCode = emptyList.get().getPoint_code();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(pointCode)) {
|
||||
throw new BadRequestException("该暂存区暂无空闲货位,请检查暂存区是否存在同一列有物料阻挡未取走!");
|
||||
}
|
||||
} else {
|
||||
pointCode = pointList.stream()
|
||||
.filter(r -> IOSEnum.POINT_STATUS.code("无货").equals(r.getPoint_status()))
|
||||
.sorted(Comparator.comparing(SchBasePoint::getRow_num))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new BadRequestException("该暂存区暂无空闲货位,请及时取走暂存区的物料!"))
|
||||
.getPoint_code();
|
||||
}
|
||||
return pointCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirm(JSONObject whereJson) {
|
||||
|
||||
|
||||
@@ -3,19 +3,30 @@ package org.nl.wms.warehouse_management.service.util;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.TaskOrderDetail;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,6 +43,12 @@ public class UpdateIvtUtils {
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
@Resource
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
/**
|
||||
* 组盘信息服务
|
||||
*/
|
||||
@@ -76,7 +93,7 @@ public class UpdateIvtUtils {
|
||||
// 加可用(加库存)
|
||||
updateAddCanuseIvt(where);
|
||||
break;
|
||||
case IOSConstant.UPDATE_IVT_TYPE_SUB_CANUSE_IVT :
|
||||
case IOSConstant.UPDATE_IVT_TYPE_SUB_CANUSE_IVT:
|
||||
// 减可用(减库存)
|
||||
updateSubCanuseIvt(where);
|
||||
break;
|
||||
@@ -85,8 +102,23 @@ public class UpdateIvtUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务校验
|
||||
*
|
||||
* @param where 输入参数
|
||||
*/
|
||||
public void checkTask(JSONObject where) {
|
||||
List<SchBaseTask> list = iSchBaseTaskService.list(new QueryWrapper<SchBaseTask>().eq("vehicle_code", where.getString("vehicle_code"))
|
||||
.lt("task_status", TaskStatus.FINISHED.getCode()));
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
throw new BadRequestException("当前载具存在任务:" + list.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(","))+",请在WMS任务列表中检查!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据校验
|
||||
*
|
||||
* @param where 输入参数
|
||||
*/
|
||||
private void checkData(JSONObject where) {
|
||||
@@ -158,13 +190,13 @@ public class UpdateIvtUtils {
|
||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
// 减可用数
|
||||
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
if (canuse_qty < 0) {
|
||||
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
}
|
||||
// double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
// if (canuse_qty < 0) {
|
||||
// throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
// }
|
||||
// 加冻结数
|
||||
double frozen_qty = NumberUtil.add(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setQty(BigDecimal.valueOf(canuse_qty));
|
||||
//extDao.setQty(BigDecimal.valueOf(canuse_qty));
|
||||
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty));
|
||||
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
@@ -225,14 +257,14 @@ public class UpdateIvtUtils {
|
||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
// 减冻结
|
||||
double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue();
|
||||
if (qty < 0) {
|
||||
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
}
|
||||
// double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue();
|
||||
// if (qty < 0) {
|
||||
// throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
// }
|
||||
// 加可用
|
||||
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setFrozen_qty(BigDecimal.ZERO);
|
||||
extDao.setQty(BigDecimal.valueOf(qty));
|
||||
//extDao.setQty(BigDecimal.valueOf(qty));
|
||||
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
@@ -290,4 +322,25 @@ public class UpdateIvtUtils {
|
||||
iMdPbGroupPlateService.updateById(extDao);
|
||||
}
|
||||
|
||||
public String sendRcsParam(SchBaseTask taskDao) {
|
||||
AcsTaskDto acsTaskDto = new AcsTaskDto();
|
||||
acsTaskDto.setModelProcessCode(taskDao.getVehicle_type());
|
||||
acsTaskDto.setOrderId(taskDao.getTask_code());
|
||||
acsTaskDto.setFromSystem("WMS");
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setShelfNumber(taskDao.getVehicle_code());
|
||||
TaskOrderDetail detail = new TaskOrderDetail();
|
||||
detail.setTaskPath(taskDao.getPoint_code2() + "," + taskDao.getPoint_code1());
|
||||
detail.setShelfNumber(taskDao.getVehicle_code());
|
||||
// Map<String, String> extraInfo = new HashMap<>();
|
||||
// extraInfo.put("s", "1");
|
||||
// extraInfo.put("d", "2");
|
||||
// detail.setExtraInfo(extraInfo);
|
||||
// 放到列表
|
||||
List<TaskOrderDetail> detailList = new ArrayList<>();
|
||||
detailList.add(detail);
|
||||
acsTaskDto.setTaskOrderDetail(detailList);
|
||||
return JSON.toJSONString(acsTaskDto, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user