出库时,盘点,出库计划,增加出库楼层

main
judy 1 year ago
parent e7e66459d9
commit 0e3d82025b
  1. 9
      shkj-admin/src/main/resources/application-dev.yml
  2. 2
      shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java
  3. 5
      shkj-wms/src/main/java/com/shkj/wms/bo/BaseContainerCallBo.java
  4. 5
      shkj-wms/src/main/java/com/shkj/wms/bo/BusinOutPlanAddBo.java
  5. 5
      shkj-wms/src/main/java/com/shkj/wms/bo/BusinStockInvAddBo.java
  6. 3
      shkj-wms/src/main/java/com/shkj/wms/controller/base/BaseMoldController.java
  7. 4
      shkj-wms/src/main/java/com/shkj/wms/domain/BusinOutInPlan.java
  8. 5
      shkj-wms/src/main/java/com/shkj/wms/domain/BusinStockInv.java
  9. 2
      shkj-wms/src/main/java/com/shkj/wms/service/ISysThirdExceptionRequestService.java
  10. 13
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java
  11. 5
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinStockInvServiceImpl.java
  12. 3
      shkj-wms/src/main/java/com/shkj/wms/service/impl/SysThirdExceptionRequestServiceImpl.java
  13. 36
      shkj-wms/src/main/java/com/shkj/wms/utils/WmsCallWcsUtil.java
  14. 46
      shkj-wms/src/main/resources/mapper/wms/BaseMoldMapper.xml

@ -12,12 +12,11 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://127.0.0.1:3306/mjk_pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B7 #url: jdbc:mysql://127.0.0.1:3306/mjk_pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B7
# url: jdbc:mysql://192.168.150.162:3306/mjk_wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://120.77.94.227:3306/mjk_wcs_2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#url: jdbc:mysql://120.77.94.227:3306/mjk_wms_wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
# password: CTlTwKgIrRVTsEHqxxx password: CTlTwKgIrRVTsEHqxxx
password: 123456 # password: 123456
# password: Y4yhl9tbf110 # password: Y4yhl9tbf110
# 从库数据源 # 从库数据源
slave: slave:

@ -525,8 +525,6 @@ public class PlcEventTask {
public void stkRealTimeTask(List<WcsPlcProperty> propertyList,Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite,PlcOperate plcOperate,String pointTables){ public void stkRealTimeTask(List<WcsPlcProperty> propertyList,Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite,PlcOperate plcOperate,String pointTables){
try { try {
// log.info("监测堆垛机读取的属性值:"+pointMap);
if (pointMap.isEmpty()){ if (pointMap.isEmpty()){
pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables); pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables);
log.info("堆垛机为空时,重新读取的属性值{} ",pointMap); log.info("堆垛机为空时,重新读取的属性值{} ",pointMap);

@ -44,4 +44,9 @@ private static final long serialVersionUID=1L;
* 可容纳模具的数量 * 可容纳模具的数量
*/ */
private String modlQty; private String modlQty;
/**
* 出库楼层
*/
private Integer layer;
} }

@ -40,4 +40,9 @@ public class BusinOutPlanAddBo implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7")
private Date planTime; private Date planTime;
/**
* 出库楼层
*/
private Integer layer;
} }

@ -43,5 +43,10 @@ public class BusinStockInvAddBo implements Serializable {
@NotEmpty(message = "库存id集合不得为空") @NotEmpty(message = "库存id集合不得为空")
private List<Long> ids; private List<Long> ids;
/**
* 出库楼层
*/
private Integer layer;
} }

@ -189,9 +189,6 @@ public class BaseMoldController extends BaseController {
@GetMapping("/queryStockMoldByBarCode") @GetMapping("/queryStockMoldByBarCode")
public Result<List<BaseMoldVo>> queryStockMoldByBarCode(BaseMoldBarcodeQueryBo bo) { public Result<List<BaseMoldVo>> queryStockMoldByBarCode(BaseMoldBarcodeQueryBo bo) {
// if (StringUtils.isBlank(bo.getMoldBarcode())) {
// return Result.err().msg("模具编码不得为空");
// }
return iBaseMoldService.queryStockMoldByBarCode(bo); return iBaseMoldService.queryStockMoldByBarCode(bo);
} }

@ -174,4 +174,8 @@ public class BusinOutInPlan implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7")
private Date planTime; private Date planTime;
/**
* 出库楼层
*/
private Integer layer;
} }

@ -177,5 +177,10 @@ public class BusinStockInv implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+7")
private Date endTime; private Date endTime;
/**
* 出库楼层
*/
private Integer layer;
} }

@ -35,7 +35,7 @@ public interface ISysThirdExceptionRequestService extends IService<SysThirdExcep
* @param isSuccess 是否成功标志 * @param isSuccess 是否成功标志
* @param planTime 制定出库计划时传入计划出库时间 * @param planTime 制定出库计划时传入计划出库时间
*/ */
void addException(String orderCode, String type, String requestBody, String responseBody, Boolean isSuccess, Date planTime); void addException(String orderCode, String type, String requestBody, String responseBody, Boolean isSuccess, Date planTime,Integer layer);
/** /**
* 没有被任务id列表和秩序 * 没有被任务id列表和秩序

@ -363,6 +363,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
BusinOutInPlan businOutInPlan = initCallPlan(containerId, containerCode, orderNo,bo.getModlQty()); BusinOutInPlan businOutInPlan = initCallPlan(containerId, containerCode, orderNo,bo.getModlQty());
businOutInPlan.setLocationId(vo.getId()); businOutInPlan.setLocationId(vo.getId());
businOutInPlan.setDetailId(vo.getId()); businOutInPlan.setDetailId(vo.getId());
businOutInPlan.setLayer(bo.getLayer());
OutStockDetailVo detailVo = new OutStockDetailVo(); OutStockDetailVo detailVo = new OutStockDetailVo();
detailVo.setLocationId(vo.getId()); detailVo.setLocationId(vo.getId());
@ -373,7 +374,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
detailVo.setOrderNo(orderNo); detailVo.setOrderNo(orderNo);
detailVo.setBranchId(vo.getBranchId()); detailVo.setBranchId(vo.getBranchId());
//给堆垛机下命令 //给堆垛机下命令
Result result = wmsCallWcsUtil.callOutStock(detailVo); Result result = wmsCallWcsUtil.callOutStock(detailVo,bo.getLayer());
if (Result.isOk(result)) { if (Result.isOk(result)) {
//正常更新单据状态为:出库中 //正常更新单据状态为:出库中
businOutInPlan.setPlanStatus(PlanStatusEnum.DOING.getValue()); businOutInPlan.setPlanStatus(PlanStatusEnum.DOING.getValue());
@ -679,7 +680,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
} }
BusinOutInPlan outPlan = new BusinOutInPlan(); BusinOutInPlan outPlan = new BusinOutInPlan();
outPlan.setLayer(bo.getLayer());
outPlan.setMoldBarcode(moldBarcode); outPlan.setMoldBarcode(moldBarcode);
outPlan.setMoldId(barcode.getId()); outPlan.setMoldId(barcode.getId());
outPlan.setMoldNo(barcode.getMoldNo()); outPlan.setMoldNo(barcode.getMoldNo());
@ -734,7 +735,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
log.info("开始调用wcs下发任务 = {}", detailVo); log.info("开始调用wcs下发任务 = {}", detailVo);
//由于堆垛机只能执行一个任务、所以这里只能第一个任务下发、其他的任务进行轮询 //由于堆垛机只能执行一个任务、所以这里只能第一个任务下发、其他的任务进行轮询
if (index.equals(0)) { if (index.equals(0)) {
Result result = wmsCallWcsUtil.outStock(detailVo, true); Result result = wmsCallWcsUtil.outStock(detailVo, true,bo.getLayer());
if (!Result.isOk(result)) { if (!Result.isOk(result)) {
entry.getValue().forEach(x -> x.setPlanStatus(PlanStatusEnum.WAIT.getValue())); entry.getValue().forEach(x -> x.setPlanStatus(PlanStatusEnum.WAIT.getValue()));
} else { } else {
@ -743,12 +744,11 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
} else { } else {
log.info("不用调用、直接进入轮训 = {}", detailVo); log.info("不用调用、直接进入轮训 = {}", detailVo);
entry.getValue().forEach(x -> x.setPlanStatus(PlanStatusEnum.WAIT.getValue())); entry.getValue().forEach(x -> x.setPlanStatus(PlanStatusEnum.WAIT.getValue()));
wmsCallWcsUtil.outStock(detailVo, false); wmsCallWcsUtil.outStock(detailVo, false, bo.getLayer());
} }
index++; index++;
} }
this.updateBatchById(outPlans); this.updateBatchById(outPlans);
} finally { } finally {
//释放锁 //释放锁
@ -799,6 +799,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
outPlan.setBranchId(SecurityUtils.erpBranchId); outPlan.setBranchId(SecurityUtils.erpBranchId);
outPlan.setPlanTime(bo.getPlanTime()); outPlan.setPlanTime(bo.getPlanTime());
outPlan.setPlanStatus(PlanStatusEnum.WAIT.getValue()); outPlan.setPlanStatus(PlanStatusEnum.WAIT.getValue());
outPlan.setLayer(bo.getLayer());
if (!oldLocationId.equals(locationId)){ if (!oldLocationId.equals(locationId)){
orderNo=IntIdUtil.generateIntId(); orderNo=IntIdUtil.generateIntId();
@ -809,7 +810,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
moveBo.setFromColumn(baseLocation.getLocationColumn()); moveBo.setFromColumn(baseLocation.getLocationColumn());
moveBo.setFromLayer(baseLocation.getLayer()); moveBo.setFromLayer(baseLocation.getLayer());
thirdExceptionRequestService.addException(orderNo.toString(), ThirdApiTypeEnum.wcsOutTask, JSONObject.toJSONString(moveBo), thirdExceptionRequestService.addException(orderNo.toString(), ThirdApiTypeEnum.wcsOutTask, JSONObject.toJSONString(moveBo),
"出库计划", false,bo.getPlanTime()); "出库计划", false,bo.getPlanTime(),bo.getLayer());
} }
outPlan.setOrderNo(orderNo); outPlan.setOrderNo(orderNo);
outPlans.add(outPlan); outPlans.add(outPlan);

@ -262,13 +262,14 @@ public class BusinStockInvServiceImpl extends ServiceImpl<BusinStockInvMapper, B
detailVo.setOrderNo(orderNo); detailVo.setOrderNo(orderNo);
detailVo.setBranchId(vo.getBranchId()); detailVo.setBranchId(vo.getBranchId());
log.info("开始调用wcs下发任务 = {}" , detailVo); log.info("开始调用wcs下发任务 = {}" , detailVo);
List<BusinStockInv> businStockInvs = entry.getValue();
//由于堆垛机只能执行一个任务、所以这里只能第一个任务下发、其他的任务进行轮询 //由于堆垛机只能执行一个任务、所以这里只能第一个任务下发、其他的任务进行轮询
//全部进入任务管理,进行调度执行 //全部进入任务管理,进行调度执行
if (index.equals(0)) { if (index.equals(0)) {
wmsCallWcsUtil.outStock(detailVo, false); wmsCallWcsUtil.outStock(detailVo, false,businStockInvs.get(0).getLayer());
} else { } else {
log.info("不用调用、直接进入轮询 = {}" , detailVo); log.info("不用调用、直接进入轮询 = {}" , detailVo);
wmsCallWcsUtil.outStock(detailVo, false); wmsCallWcsUtil.outStock(detailVo, false,businStockInvs.get(0).getLayer());
} }
index++; index++;
} }

@ -147,7 +147,7 @@ public class SysThirdExceptionRequestServiceImpl extends ServiceImpl<SysThirdExc
@Override @Override
public void addException(String code, String type, String requestBody, String responseBody, Boolean isSuccess, Date planTime) { public void addException(String code, String type, String requestBody, String responseBody, Boolean isSuccess, Date planTime,Integer layer) {
SysThirdExceptionRequest request = new SysThirdExceptionRequest(); SysThirdExceptionRequest request = new SysThirdExceptionRequest();
request.setCode(code); request.setCode(code);
request.setType(type); request.setType(type);
@ -157,6 +157,7 @@ public class SysThirdExceptionRequestServiceImpl extends ServiceImpl<SysThirdExc
request.setCreateBy("admin").setCreateTime(new Date()); request.setCreateBy("admin").setCreateTime(new Date());
request.setPlanTime(planTime); request.setPlanTime(planTime);
request.setUpdateTime(DateUtils.getNowDate()); request.setUpdateTime(DateUtils.getNowDate());
request.setLayer(layer);
this.save(request); this.save(request);
} }

@ -54,7 +54,7 @@ public class WmsCallWcsUtil {
*/ */
// @Async // @Async
// @Retryable(recover = "outStockRecover", maxAttempts = 3, backoff = @Backoff(value = 2000, multiplier = 2)) // @Retryable(recover = "outStockRecover", maxAttempts = 3, backoff = @Backoff(value = 2000, multiplier = 2))
public Result outStock(OutStockDetailVo vo, boolean call) { public Result outStock(OutStockDetailVo vo, boolean call,Integer layer) {
try { try {
STKMoveBo moveBo = getStkMoveBo(vo); STKMoveBo moveBo = getStkMoveBo(vo);
Result<Boolean> result = Result.err(); Result<Boolean> result = Result.err();
@ -70,20 +70,9 @@ public class WmsCallWcsUtil {
} }
result = stkCallUtil.outTask(moveBo); result = stkCallUtil.outTask(moveBo);
} }
// 这里是添加成功的结果
// String code = taskService.addTask(vo.getOrderNo(),
// vo.getOrderNo().toString(),
// BusinTaskTypeEnum.out.getValue(),
// Result.isOk(result) ? TaskStatusEnum.wait_callback.getValue() : TaskStatusEnum.err.getValue(),
// null,
// "下发任务" + vo.getLocationCode(),
// null,
// vo.getBranchId(),
// result.getMsg(),
// ThirdApiTypeEnum.wcsOutTask);
thirdExceptionRequestService.addException(vo.getOrderNo().toString(), ThirdApiTypeEnum.wcsOutTask, JSONObject.toJSONString(moveBo), thirdExceptionRequestService.addException(vo.getOrderNo().toString(), ThirdApiTypeEnum.wcsOutTask, JSONObject.toJSONString(moveBo),
JSONObject.toJSONString(result), Result.isOk(result),null); JSONObject.toJSONString(result), Result.isOk(result),null,layer);
log.info("outStock 调用结果 = {}", result); log.info("outStock 调用结果 = {}", result);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
@ -93,7 +82,7 @@ public class WmsCallWcsUtil {
} }
} }
public Result callOutStock(OutStockDetailVo vo) { public Result callOutStock(OutStockDetailVo vo,Integer layer) {
try { try {
//从哪个位置搬运 //从哪个位置搬运
STKMoveBo moveBo = getStkMoveBo(vo); STKMoveBo moveBo = getStkMoveBo(vo);
@ -102,7 +91,7 @@ public class WmsCallWcsUtil {
Result<Boolean> result = stkCallUtil.outTask(moveBo); Result<Boolean> result = stkCallUtil.outTask(moveBo);
//记录结果到是否正常,异常要轮询执行 //记录结果到是否正常,异常要轮询执行
thirdExceptionRequestService.addException(vo.getOrderNo().toString(), ThirdApiTypeEnum.wcsCallOutStock, JSONObject.toJSONString(moveBo), thirdExceptionRequestService.addException(vo.getOrderNo().toString(), ThirdApiTypeEnum.wcsCallOutStock, JSONObject.toJSONString(moveBo),
JSONObject.toJSONString(result), Result.isOk(result),null); JSONObject.toJSONString(result), Result.isOk(result),null,layer);
log.info("outStock 调用结果 = {}", result); log.info("outStock 调用结果 = {}", result);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
@ -159,23 +148,8 @@ public class WmsCallWcsUtil {
STKMoveBo moveBo = getStkMoveBo(vo); STKMoveBo moveBo = getStkMoveBo(vo);
Result<Boolean> result = stkCallUtil.locationAdjustment(moveBo); Result<Boolean> result = stkCallUtil.locationAdjustment(moveBo);
// if (Result.isOk(result)) {
// log.error("货位调整下发失败 result = {}", result);
// throw new ServiceException(result.getMsg());
// }
// // 这里是添加成功的结果
// String code = taskService.addTask(moveBo.getTaskId(),
// moveBo.getTaskId().toString(),
// BusinTaskTypeEnum.move.getValue(),
// TaskStatusEnum.wait_callback.getValue(),
// null,
// "货位调整" + vo.getFromLocationCode() + "=>" + vo.getToLocationCode(),
// null,
// vo.getBranchId(),
// result.getMsg(),
// ThirdApiTypeEnum.wcsMoveLocationTask);
thirdExceptionRequestService.addException(vo.getTaskId().toString(), ThirdApiTypeEnum.wcsMoveLocationTask, JSONObject.toJSONString(moveBo), thirdExceptionRequestService.addException(vo.getTaskId().toString(), ThirdApiTypeEnum.wcsMoveLocationTask, JSONObject.toJSONString(moveBo),
JSONObject.toJSONString(result), true,null); JSONObject.toJSONString(result), true,null,null);
return Result.ok(); return Result.ok();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

@ -90,16 +90,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryStockMoldByBarCodePage" resultType="com.shkj.wms.vo.BaseMoldVo" <select id="queryStockMoldByBarCodePage" resultType="com.shkj.wms.vo.BaseMoldVo"
parameterType="com.shkj.wms.bo.BaseMoldBarcodeQueryBo"> parameterType="com.shkj.wms.bo.BaseMoldBarcodeQueryBo">
select SELECT
m.id,m.mold_no,m.mold_name,m.type,m.model,m.length,m.width,m.height,m.volume,m.service_interval,m.service_life, m.id,
m.is_del,m.is_activity,m.branch_id,m.update_by,m.create_by,m.update_time,m.create_time,bar_code as mold_barcode m.mold_no,
,c.container_name m.mold_name,
from base_mold m m.type,
inner join sys_stock_detail s on m.id=s.mold_id m.model,
left join base_container c on c.id =s.container_id m.length,
where m.width,
m.is_activity = 1 m.height,
and m.is_del = 0 m.volume,
m.service_interval,
m.service_life,
m.is_del,
m.is_activity,
m.branch_id,
m.update_by,
m.create_by,
m.update_time,
m.create_time,
bar_code AS mold_barcode,
c.container_name
FROM
base_mold m
INNER JOIN sys_stock_detail s ON m.id = s.mold_id AND s.qty - s.out_qty > 0
INNER JOIN base_container c on c.id =s.container_id
LEFT JOIN ( SELECT plan.mold_id FROM busin_out_in_plan plan WHERE plan_status NOT IN ( '2', '3' ) AND plan.type = 'out' ) AS planout ON planout.mold_id = m.id
WHERE
planout.mold_id IS NULL
AND m.is_activity = 1
AND m.is_del = 0
<if test="moldBarcode != null and moldBarcode != ''"> <if test="moldBarcode != null and moldBarcode != ''">
and m.bar_code like CONCAT('%', #{moldBarcode},'%') and m.bar_code like CONCAT('%', #{moldBarcode},'%')
</if> </if>
@ -120,11 +141,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and m.type =#{moldType} and m.type =#{moldType}
</if> </if>
and EXISTS (select 1 from sys_stock_detail s where s.barcode = m.bar_code and s.qty - s.out_qty > 0)
and not exists(select 1 from busin_out_in_plan p where type ='out' and plan_status not in('2','3') and p.mold_barcode=m.bar_code)
order by c.container_name
</select> </select>
<select id="getBaseMoldNotinStockDetail" resultType="com.shkj.wms.vo.BaseMoldVo" <select id="getBaseMoldNotinStockDetail" resultType="com.shkj.wms.vo.BaseMoldVo"

Loading…
Cancel
Save