修改提交
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
package org.nl.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.mnt.util.DataTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@@ -16,14 +27,14 @@ public class DataBaseConfig {
|
||||
@Value("${erp.sqlserver.enabled}")
|
||||
private boolean sqlserverIsConnect;
|
||||
|
||||
/* @Primary
|
||||
@Primary
|
||||
@Bean(name = "dataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||
public DataSource dataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
|
||||
@Bean(name = "dataSource2")
|
||||
/* @Bean(name = "dataSource2")
|
||||
@ConditionalOnExpression("${erp.sqlserver.enabled:true}")
|
||||
public DataSource dataSource2() {
|
||||
System.out.println("是否连接Sqlserver"+sqlserverIsConnect);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.nl.start.day01;
|
||||
|
||||
public class AppMain {
|
||||
public static void main(String[] args) {
|
||||
Device ylj= Device.builder().build();
|
||||
ylj.callMaterial();
|
||||
|
||||
/* ylj.sendMaterial(m,sld);
|
||||
ylj.sendEmpty("123",sld);
|
||||
ylj.callEmpty(sld);*/
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package org.nl.start.day01;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
/**
|
||||
* 所有的状态和类型都是以01开始
|
||||
* 呼叫物料业务
|
||||
*/
|
||||
public class CallMaterialTask {
|
||||
public void create(Device device) {
|
||||
//1、判断是否有库存
|
||||
//2、如果有库存则生成出库单,并生成AGV搬运任务,否则判断是否需要通过定时器一直判断库存(半条任务)
|
||||
|
||||
//任务表【SCH_BASE_Task】
|
||||
Task task = Task.builder().acs_task_type("1")
|
||||
.create_id("2")
|
||||
.create_time("3")
|
||||
.build();
|
||||
|
||||
String jsonString = JSON.toJSONString(task);
|
||||
JSONObject jSONObject = JSONObject.parseObject(jsonString);
|
||||
//任务表【SCH_BASE_Task】
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(jSONObject);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//任务表【SCH_BASE_Task】
|
||||
Task task = Task.builder().acs_task_type("3")
|
||||
.create_id("1")
|
||||
.create_time("4")
|
||||
.build();
|
||||
|
||||
String jsonString = JSONObject.toJSONString(task);
|
||||
JSONObject jSONObject = JSONObject.parseObject(jsonString);
|
||||
System.out.println(jSONObject);
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
package org.nl.start.day01;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 需求和开发组-
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
public class Device {
|
||||
private WorkProcedure workProcedure;
|
||||
//前一工序
|
||||
private WorkProcedure preWorkProcedure;
|
||||
//后一工序
|
||||
private WorkProcedure nextWorkProcedure;
|
||||
|
||||
/**
|
||||
* 设备存在的点位信息:如上料点,下料点,送空载具点,上空载具点等等
|
||||
*/
|
||||
private List<Point> points;
|
||||
|
||||
/**
|
||||
* 前一个区域查找物料位置
|
||||
*/
|
||||
private List<Sect> preMaterialSects;
|
||||
/**
|
||||
* 下一个区域查找物料位置
|
||||
*/
|
||||
private List<Sect> nextMaterialSects;
|
||||
|
||||
/**
|
||||
* 前一个区域查找载具位置
|
||||
*/
|
||||
private List<Sect> preVehicleSects;
|
||||
|
||||
/**
|
||||
* 下一个区域查找空位置存储载具
|
||||
*/
|
||||
private List<Sect> nextVehicleSects;
|
||||
|
||||
/**
|
||||
* 上料点
|
||||
*/
|
||||
private Point upMaterialPoint;
|
||||
/**
|
||||
* 下料点
|
||||
*/
|
||||
private Point downMaterialPoint;
|
||||
|
||||
/**
|
||||
* 上空托盘点
|
||||
*/
|
||||
private Point upVehiclePoint;
|
||||
/**
|
||||
* 送空托盘点
|
||||
*/
|
||||
private Point downVehiclePoint;
|
||||
|
||||
/**
|
||||
* 叫料时,如果库内没有物料,是否采用定时器循环一直呼叫,默认true
|
||||
*/
|
||||
private boolean isAllAlongCallMaterial = true;
|
||||
|
||||
/**
|
||||
* 叫料时,如果库内没有载具,是否采用定时器循环一直呼叫,默认true
|
||||
*/
|
||||
private boolean isAllAlongCallVehicle = true;
|
||||
/**
|
||||
* 生产中的物料
|
||||
*/
|
||||
private Material material;
|
||||
|
||||
|
||||
/**
|
||||
* 叫料时,如果库内没有物料,是否采用定时器循环一直呼叫,默认true
|
||||
*/
|
||||
private boolean isAllAlongSendMaterial = true;
|
||||
|
||||
/**
|
||||
* 叫料时,如果库内没有载具,是否采用定时器循环一直呼叫,默认true
|
||||
*/
|
||||
private boolean isAllAlongSendVehicle = true;
|
||||
|
||||
|
||||
/**
|
||||
* 1、设备叫料,判断库存是否满足
|
||||
*/
|
||||
public void callMaterial() {
|
||||
//1、根据物料信息,查找起点区域位置
|
||||
//1、查找起点
|
||||
//2、创建任务
|
||||
/*LinkLine line = new LinkLine();
|
||||
line.setName("压力机叫料");
|
||||
line.setStartSects(this.preMaterialSects);*/
|
||||
CallMaterialTask task = new CallMaterialTask();
|
||||
task.create(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1、呼叫空托盘
|
||||
*/
|
||||
public void callEmpty() {
|
||||
//1、查找起点
|
||||
//2、
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1、送空托盘
|
||||
*/
|
||||
public void sendEmpty() {
|
||||
//1、查找起点
|
||||
//2、
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1、送料
|
||||
*/
|
||||
public void sendMaterial() {
|
||||
//1、查找起点
|
||||
//2、
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.basedata.st;
|
||||
|
||||
/**
|
||||
* // 11-扣减可用; 12-增加可用;
|
||||
* // 21-减库存; 22-加库存; 23-同时加; 24-同时减
|
||||
*/
|
||||
public enum IvtChangeTypeEnum {
|
||||
SUB_CAN_USE("扣减可用数", 11),
|
||||
ADD_CAN_USE("增加用数", 12),
|
||||
|
||||
SUB_IVT("扣减库存", 21),
|
||||
ADD_IVT("增加库存", 22),
|
||||
ADD_IVT_AND_CAN_USE("同时加库存和可用", 23),
|
||||
SUB_IVT_AND_CAN_USE("同时减库存和可用", 24);
|
||||
|
||||
private final String name;
|
||||
private final int index;
|
||||
|
||||
IvtChangeTypeEnum(String name, int index) {
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
package org.nl.wms.basedata.st;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Title: Test.java Description: 一、入库 单据审核,可用数、库存数加上。 取消审核,可用数、库存数减掉 二、出库
|
||||
* 单据分配,可用数减掉 取消分配,可用数加回 单据审核,库存数减掉 取消审核,库存数加回
|
||||
*
|
||||
* @author ldjun
|
||||
* @created 2020年7月23日 下午2:23:04
|
||||
*/
|
||||
public class StoreIvtServiceImpl {
|
||||
/**
|
||||
* @discription 添加仓储变动记录
|
||||
* @author ldjun
|
||||
* @created 2020年5月12日 下午12:54:42
|
||||
*/
|
||||
public void addIvtFlow(JSONObject disObj, IvtChangeTypeEnum changeType) {
|
||||
String struct_id = disObj.getString("struct_id");
|
||||
JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_id ='" + struct_id + "'").uniqueResult(0);
|
||||
String vehicle_code = disObj.getString("vehicle_code");
|
||||
if (StrUtil.isEmpty(struct_id)) {
|
||||
throw new BadRequestException("仓位标识不能为空!");
|
||||
}
|
||||
String change_qty = disObj.getString("change_qty");
|
||||
if (StrUtil.isEmpty(change_qty)) {
|
||||
change_qty = "0";
|
||||
}
|
||||
if (StrUtil.equals("0", change_qty)) {
|
||||
throw new BadRequestException("变动量不能都为0!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("struct_id", struct_id);
|
||||
param.put("struct_code",pointObj.getString("point_code"));
|
||||
param.put("struct_name",pointObj.getString("point_name"));
|
||||
param.put("material_id", disObj.getString("material_id"));
|
||||
param.put("pcsn", disObj.getString("pcsn"));
|
||||
//先默认写死,只有一个仓库
|
||||
param.put("stor_id", "1528627995269533696");
|
||||
param.put("change_type_scode",changeType.getIndex());
|
||||
|
||||
param.put("inv_id", disObj.getString("bill_id"));
|
||||
param.put("bill_code", disObj.getString("bill_code"));
|
||||
param.put("bill_type_scode", disObj.getString("bill_type_scode"));
|
||||
param.put("qty_unit_id", disObj.getString("qty_unit_id"));
|
||||
param.put("change_time", DateUtil.now());
|
||||
param.put("change_qty", change_qty);
|
||||
param.put("change_person_id", SecurityUtils.getCurrentUserId());
|
||||
param.put("change_person_name", SecurityUtils.getNickName());
|
||||
|
||||
|
||||
param.put("change_type", changeType.getIndex());
|
||||
param.put("workprocedure_id", disObj.getString("workprocedure_id"));
|
||||
param.put("is_full", disObj.getString("is_full"));
|
||||
|
||||
|
||||
// 仓位库存变动记录表【ST_IVT_StructIvtFlow】
|
||||
WQLObject ivtFlowTab = WQLObject.getWQLObject("ST_IVT_StructIvtFlow");
|
||||
ivtFlowTab.insert(param);
|
||||
// 根据变动记录改变仓位库存
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("stewing_time", disObj.getString("stewing_time"));
|
||||
param.put("producetask_id", disObj.getString("producetask_id"));
|
||||
this.changeInventory(param, changeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param param
|
||||
* @discription 扣减可用数
|
||||
* @author ldjun
|
||||
* @created 2020年5月12日 上午8:52:44
|
||||
*/
|
||||
private void changeInventory(JSONObject param, IvtChangeTypeEnum changeType) {
|
||||
WQLObject stackIvtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
String struct_id = param.getString("struct_id");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String stewing_time = param.getString("stewing_time");
|
||||
String producetask_id = param.getString("producetask_id");
|
||||
String struct_name = param.getString("struct_name");
|
||||
String struct_code = param.getString("struct_code");
|
||||
if (StrUtil.isEmpty(struct_id)) {
|
||||
throw new BadRequestException("仓位标识不能为空!");
|
||||
}
|
||||
|
||||
String material_id = param.getString("material_id");
|
||||
// 拼接查询条件参数
|
||||
String whereArgs = "struct_id = '" + struct_id + "' and material_id = '" + material_id + "'";
|
||||
JSONObject stackIvtObj = stackIvtTab.query(whereArgs).uniqueResult(0);
|
||||
|
||||
// 需变动的数量
|
||||
String change_qty = param.getString("change_qty");
|
||||
|
||||
// 变动类型
|
||||
// 11-扣减可用; 12-增加可用; 13-刷新可用
|
||||
// 21-减库存; 22-加库存; 23-同时加; 24-同时减
|
||||
// 31-加待入; 32-减待入 33减库存可用数可以为0 34同时减(库存和数量) 考虑负数 35 加库存 考虑负数
|
||||
if (stackIvtObj == null) {// 说明该货位上还没有该物料,直接插入记录即可
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("stockrecord_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("struct_id", param.getString("struct_id"));
|
||||
json.put("struct_name", param.getString("struct_name"));
|
||||
json.put("material_id", param.getString("material_id"));
|
||||
|
||||
json.put("pcsn", param.getString("pcsn"));
|
||||
json.put("qty_unit_id", param.getString("qty_unit_id"));
|
||||
json.put("instorage_time", DateUtil.now());
|
||||
|
||||
json.put("canuse_qty", "0");
|
||||
json.put("frozen_qty", "0");
|
||||
json.put("ivt_qty", "0");
|
||||
json.put("warehousing_qty", "0");
|
||||
json.put("qc_qty", "0");
|
||||
|
||||
// 11-扣减可用; 12-增加可用;
|
||||
// 21-减库存; 22-加库存; 23-同时加(可用和库存); 24-同时减(可用和库存)
|
||||
// 31-加待入; 32-减待入
|
||||
switch (changeType.getIndex()) {
|
||||
case 11: // 扣减可用重量和数量
|
||||
break;
|
||||
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
json.put("ivt_qty", change_qty);
|
||||
break;
|
||||
case 23:
|
||||
json.put("ivt_qty", change_qty);
|
||||
json.put("canuse_qty", change_qty);
|
||||
break;
|
||||
case 24:// 同时减
|
||||
// 语句
|
||||
break;
|
||||
case 31:// 加待入
|
||||
// 语句
|
||||
break;
|
||||
case 32:// 减待入
|
||||
// 语句
|
||||
break;
|
||||
default: // 可选
|
||||
throw new BadRequestException("变动类型不正确!");
|
||||
}
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("stewing_time", stewing_time);
|
||||
json.put("producetask_id", producetask_id);
|
||||
json.put("struct_code", struct_code);
|
||||
json.put("struct_name", struct_name);
|
||||
json.put("barcode", param.getString("barcode"));
|
||||
json.put("workprocedure_id", param.getString("workprocedure_id"));
|
||||
String is_full = param.getString("is_full");
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
is_full = "1";
|
||||
}
|
||||
json.put("is_full", is_full);
|
||||
|
||||
stackIvtTab.insert(json);
|
||||
}
|
||||
// 对应的货位上有物料,需判断数量重量相关字段是否符合实际逻辑,符合时更新相应记录
|
||||
if (stackIvtObj != null) {
|
||||
// 变动前可用数量
|
||||
String before_canuse_qty = stackIvtObj.getString("canuse_qty");
|
||||
// 变动前冻结数量
|
||||
String before_frozen_qty = stackIvtObj.getString("frozen_qty");
|
||||
// 变动前库存数量
|
||||
String before_ivt_qty = stackIvtObj.getString("ivt_qty");
|
||||
// 变动前待入数量
|
||||
String before_warehousing_qty = stackIvtObj.getString("warehousing_qty");
|
||||
// 变动前待检数量
|
||||
String before_qc_qty = stackIvtObj.getString("qc_qty");
|
||||
|
||||
// 变动后可用数量
|
||||
BigDecimal after_canuse_qty = new BigDecimal(0);
|
||||
// 变动后冻结数量
|
||||
BigDecimal after_frozen_qty = new BigDecimal(0);
|
||||
// 变动后库存数量
|
||||
BigDecimal after_ivt_qty = new BigDecimal(0);
|
||||
// 变动后待入数量
|
||||
BigDecimal after_warehousing_qty = new BigDecimal(0);
|
||||
// 变动后待检数量
|
||||
BigDecimal after_qc_qty = new BigDecimal(0);
|
||||
|
||||
// 判断是否减为0
|
||||
boolean is_sub0 = false;
|
||||
switch (changeType.getIndex()) {
|
||||
case 11: // 扣减可用重量和数量
|
||||
// 变动后可用数量
|
||||
after_canuse_qty = NumberUtil.sub(before_canuse_qty, change_qty);
|
||||
if (after_canuse_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("可用数量不足,无法操作!");
|
||||
}
|
||||
stackIvtObj.put("canuse_qty", after_canuse_qty);
|
||||
break;
|
||||
case 12:// 12-增加可用重量和数量;
|
||||
// 变动后可用数量
|
||||
after_canuse_qty = NumberUtil.add(before_canuse_qty, change_qty);
|
||||
stackIvtObj.put("canuse_qty", after_canuse_qty);
|
||||
break;
|
||||
case 13:// 刷新可用数量和重量
|
||||
// 语句
|
||||
break;
|
||||
case 21:// 减库存
|
||||
// 变动后库存数量
|
||||
after_ivt_qty = NumberUtil.sub(before_ivt_qty, change_qty);
|
||||
if (after_ivt_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("可用数量不足,无法操作!");
|
||||
}
|
||||
if (after_ivt_qty.doubleValue() <= 0) {
|
||||
is_sub0 = true;
|
||||
}
|
||||
stackIvtObj.put("ivt_qty", after_ivt_qty);
|
||||
break;
|
||||
case 33:// 减库存
|
||||
after_ivt_qty = NumberUtil.sub(before_ivt_qty, change_qty);
|
||||
if (after_ivt_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("库存数量不足,无法操作!");
|
||||
}
|
||||
if (after_ivt_qty.doubleValue() <= 0) {
|
||||
is_sub0 = true;
|
||||
}
|
||||
stackIvtObj.put("ivt_qty", after_ivt_qty);
|
||||
break;
|
||||
case 22:// 加库存重量和数量
|
||||
// 变动后库存数量
|
||||
after_ivt_qty = NumberUtil.add(before_ivt_qty, change_qty);
|
||||
stackIvtObj.put("ivt_qty", after_ivt_qty);
|
||||
break;
|
||||
case 23:// 同时加(可用和库存)
|
||||
// 变动后可用数量
|
||||
after_canuse_qty = NumberUtil.add(before_canuse_qty, change_qty);
|
||||
stackIvtObj.put("canuse_qty", after_canuse_qty);
|
||||
|
||||
// 变动后库存数量
|
||||
after_ivt_qty = NumberUtil.add(before_ivt_qty, change_qty);
|
||||
stackIvtObj.put("ivt_qty", after_ivt_qty);
|
||||
// 语句
|
||||
break;
|
||||
case 24:// 同时减(库存和数量)
|
||||
// 变动后可用数量
|
||||
after_canuse_qty = NumberUtil.sub(before_canuse_qty, change_qty);
|
||||
if (after_canuse_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("可用数量不足,无法操作!");
|
||||
}
|
||||
stackIvtObj.put("canuse_qty", after_canuse_qty);
|
||||
|
||||
// 变动后库存数量
|
||||
after_ivt_qty = NumberUtil.sub(before_ivt_qty, change_qty);
|
||||
if (after_ivt_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("可用数量不足,无法操作!");
|
||||
}
|
||||
if (after_ivt_qty.doubleValue() <= 0) {
|
||||
is_sub0 = true;
|
||||
}
|
||||
stackIvtObj.put("ivt_qty", after_ivt_qty);
|
||||
// 语句
|
||||
|
||||
break;
|
||||
case 31:// 加待入
|
||||
// 语句
|
||||
break;
|
||||
case 32:// 减待入
|
||||
// 语句
|
||||
break;
|
||||
default: // 可选
|
||||
throw new BadRequestException("变动类型不正确!");
|
||||
}
|
||||
|
||||
|
||||
// 库存减为0,删除该记录
|
||||
if (is_sub0) {
|
||||
// 出完货以后更新载具号为空
|
||||
JSONObject structObj = new JSONObject();
|
||||
structObj.put("storagevehicle_code", "");
|
||||
structObj.put("struct_id", stackIvtObj.getString("struct_id"));
|
||||
stackIvtTab.delete(whereArgs);
|
||||
|
||||
} else {//更新
|
||||
stackIvtObj.put("vehicle_code", vehicle_code);
|
||||
stackIvtTab.update(stackIvtObj, whereArgs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
缓存线相关功能
|
||||
@@ -1,64 +0,0 @@
|
||||
package org.nl.wms.cacheLine.service;
|
||||
|
||||
import org.nl.wms.cacheLine.service.dto.MateriorecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author qinx
|
||||
* @date 2022-05-26
|
||||
**/
|
||||
public interface MateriorecordService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<MateriorecordDto>
|
||||
*/
|
||||
List<MateriorecordDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param record_uuid ID
|
||||
* @return Materiorecord
|
||||
*/
|
||||
MateriorecordDto findById(Long record_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Materiorecord
|
||||
*/
|
||||
MateriorecordDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(MateriorecordDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(MateriorecordDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.nl.wms.cacheline.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.cacheline.service.AcsCacheLineService;
|
||||
import org.nl.wms.cacheline.service.CacheLineHandService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @date 2022-05-25
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "缓存线条码管理")
|
||||
@RequestMapping("/api/acs/cacheLine/")
|
||||
@Slf4j
|
||||
public class AcsCacheLineController {
|
||||
|
||||
private final AcsCacheLineService acsCacheLineService;
|
||||
|
||||
@PostMapping("/getEmptyStruct")
|
||||
@Log("获取一个空的缓存线货位")
|
||||
@ApiOperation("获取一个空的缓存线货位")
|
||||
public ResponseEntity<Object> getEmptyStruct(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(acsCacheLineService.getEmptyStruct(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getFullStruct")
|
||||
@Log("获取一个有料的缓存线货位")
|
||||
@ApiOperation("获取一个有料的缓存线货位")
|
||||
public ResponseEntity<Object> getFullStruct(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(acsCacheLineService.getFullStruct(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateStruct")
|
||||
@Log("更新缓存线货位")
|
||||
@ApiOperation("更新缓存线货位")
|
||||
public ResponseEntity<Object> updateStruct(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(acsCacheLineService.updateStruct(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package org.nl.wms.cacheLine.rest;
|
||||
|
||||
package org.nl.wms.cacheline.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.cacheLine.service.CacheLineHandService;
|
||||
import org.nl.wms.cacheline.service.CacheLineHandService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -1,13 +1,12 @@
|
||||
package org.nl.wms.cacheLine.rest;
|
||||
|
||||
package org.nl.wms.cacheline.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.cacheLine.service.MateriorecordService;
|
||||
import org.nl.wms.cacheLine.service.dto.MateriorecordDto;
|
||||
import org.nl.wms.cacheline.service.MateriorecordService;
|
||||
import org.nl.wms.cacheline.service.dto.MateriorecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.rest;
|
||||
package org.nl.wms.cacheline.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -7,8 +7,9 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.cacheLine.service.VehicleService;
|
||||
import org.nl.wms.cacheLine.service.dto.VehicleDto;
|
||||
|
||||
import org.nl.wms.cacheline.service.VehicleService;
|
||||
import org.nl.wms.cacheline.service.dto.VehicleDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -1,12 +1,12 @@
|
||||
package org.nl.wms.cacheLine.rest;
|
||||
package org.nl.wms.cacheline.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.cacheLine.service.VehilematerialService;
|
||||
import org.nl.wms.cacheLine.service.dto.VehilematerialDto;
|
||||
import org.nl.wms.cacheline.service.VehilematerialService;
|
||||
import org.nl.wms.cacheline.service.dto.VehilematerialDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.wms.cacheline.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务接口
|
||||
* @date 2022-05-25
|
||||
**/
|
||||
public interface AcsCacheLineService {
|
||||
|
||||
/**
|
||||
* 获取一个空的缓存线货位
|
||||
*/
|
||||
Map<String, Object> getEmptyStruct(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 获取一个有料的缓存线货位
|
||||
*/
|
||||
Map<String, Object> getFullStruct(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 更新缓存线货位
|
||||
*/
|
||||
Map<String, Object> updateStruct(Map<String, String> jsonObject);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service;
|
||||
package org.nl.wms.cacheline.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.wms.cacheline.service;
|
||||
|
||||
import org.nl.wms.cacheline.service.dto.MateriorecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务接口
|
||||
* @date 2022-05-26
|
||||
**/
|
||||
public interface MateriorecordService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<MateriorecordDto>
|
||||
*/
|
||||
List<MateriorecordDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param record_uuid ID
|
||||
* @return Materiorecord
|
||||
*/
|
||||
MateriorecordDto findById(Long record_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Materiorecord
|
||||
*/
|
||||
MateriorecordDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(MateriorecordDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(MateriorecordDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.cacheLine.service;
|
||||
package org.nl.wms.cacheline.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.cacheLine.service.dto.VehicleDto;
|
||||
import org.nl.wms.cacheline.service.dto.VehicleDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.nl.wms.cacheLine.service;
|
||||
package org.nl.wms.cacheline.service;
|
||||
|
||||
import org.nl.wms.cacheLine.service.dto.VehilematerialDto;
|
||||
import org.nl.wms.cacheline.service.dto.VehilematerialDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.dto;
|
||||
package org.nl.wms.cacheline.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.dto;
|
||||
package org.nl.wms.cacheline.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.dto;
|
||||
package org.nl.wms.cacheline.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.cacheline.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.cacheline.service.AcsCacheLineService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务实现
|
||||
* @date 2022-05-25
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsCacheLineServiceImpl implements AcsCacheLineService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getEmptyStruct(Map<String, String> jsonObject) {
|
||||
JSONObject result = WQL.getWO("QACS_CACHE_005").addParam("flag", "1").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
throw new BadRequestException("未知道合适的位置!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getFullStruct(Map<String, String> jsonObject) {
|
||||
|
||||
//物料,工序 默认能取到
|
||||
String produceorder_uuid = jsonObject.get("produceorder_uuid");
|
||||
String material_uuid = jsonObject.get("material_uuid");
|
||||
JSONObject result = WQL.getWO("QACS_CACHE_005").addParam("flag", "2").addParam("material_uuid", material_uuid).addParam("produceorder_uuid", produceorder_uuid).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
throw new BadRequestException("未知道合适的位置!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateStruct(Map<String, String> jsonObject) {
|
||||
//默认取到 position_code(缓存线位置编码) vehicle_uuid vehicle_code
|
||||
String position_code = jsonObject.get("position_code");
|
||||
String vehicle_uuid = jsonObject.get("vehicle_uuid");
|
||||
String vehicle_code = jsonObject.get("vehicle_code");
|
||||
JSONObject positionObj = WQLObject.getWQLObject("ST_CacheLine_Position").query("position_code='" + position_code + "'").uniqueResult(0);
|
||||
positionObj.put("vehicle_uuid", vehicle_uuid);
|
||||
positionObj.put("vehicle_code", vehicle_code);
|
||||
WQLObject.getWQLObject("ST_CacheLine_Position").update(positionObj);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.impl;
|
||||
package org.nl.wms.cacheline.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -10,7 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.cacheLine.service.CacheLineHandService;
|
||||
import org.nl.wms.cacheline.service.CacheLineHandService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
@@ -800,5 +800,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
|
||||
srb.put("code", 1);
|
||||
srb.put("desc", "操作成功!");
|
||||
return srb;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.impl;
|
||||
package org.nl.wms.cacheline.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -10,8 +10,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.cacheLine.service.MateriorecordService;
|
||||
import org.nl.wms.cacheLine.service.dto.MateriorecordDto;
|
||||
import org.nl.wms.cacheline.service.MateriorecordService;
|
||||
import org.nl.wms.cacheline.service.dto.MateriorecordDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
@@ -1,5 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.impl;
|
||||
|
||||
package org.nl.wms.cacheline.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -12,8 +11,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.cacheLine.service.VehicleService;
|
||||
import org.nl.wms.cacheLine.service.dto.VehicleDto;
|
||||
import org.nl.wms.cacheline.service.VehicleService;
|
||||
import org.nl.wms.cacheline.service.dto.VehicleDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.cacheLine.service.impl;
|
||||
package org.nl.wms.cacheline.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -11,8 +11,9 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.cacheLine.service.VehilematerialService;
|
||||
import org.nl.wms.cacheLine.service.dto.VehilematerialDto;
|
||||
|
||||
import org.nl.wms.cacheline.service.VehilematerialService;
|
||||
import org.nl.wms.cacheline.service.dto.VehilematerialDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
@@ -0,0 +1,74 @@
|
||||
[交易说明]
|
||||
交易名: Acs交互
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.produceorder_uuid TYPEAS s_string
|
||||
输入.material_uuid TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ST_CacheLine_Position position
|
||||
LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON position.vehicle_uuid = vehicle.vehicle_uuid
|
||||
WHERE
|
||||
vehicle.vehicle_status = '01'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ST_CacheLine_Position position
|
||||
LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON position.vehicle_uuid = vehicle.vehicle_uuid
|
||||
WHERE
|
||||
vehicle.vehicle_status = '02'
|
||||
OPTION 输入.produceorder_uuid <> ""
|
||||
vehicle.produceorder_uuid=输入.produceorder_uuid
|
||||
ENDOPTION
|
||||
OPTION 输入.material_uuid <> ""
|
||||
vehicle.material_uuid=输入.material_uuid
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -97,7 +97,6 @@ IF 输入.flag = "3"
|
||||
FROM
|
||||
IF_CacheLine_Ivt
|
||||
where 1=1
|
||||
|
||||
OPTION 输入.extdevice_code <> ""
|
||||
extdevice_code=输入.extdevice_code
|
||||
ENDOPTION
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.nl.wms.common;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
public class StructFindUtil {
|
||||
public static JSONObject getInStruct(JSONObject jsonObject) {
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
String area_type = jsonObject.getString("area_type");
|
||||
String vehicle_code = jsonObject.getString("vehicle_code");
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("托盘不能为空!");
|
||||
}
|
||||
//根据托盘找托盘类型,
|
||||
JSONObject vehicleObj = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code='" + vehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicleObj)) {
|
||||
throw new BadRequestException("未找到托盘号为'" + vehicle_code + "' 托盘信息!");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
throw new BadRequestException("物料不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(area_type)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
String vehice_type = vehicleObj.getString("vehicle_type");
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "2")
|
||||
.addParam("material_id", material_id).addParam("area_type", area_type).addParam("vehice_type", vehice_type).process().uniqueResult(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static JSONObject getOutStruct(JSONObject jsonObject) {
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
String area_type = jsonObject.getString("area_type");
|
||||
String is_full = jsonObject.getString("is_full");
|
||||
String workprocedure_id = jsonObject.getString("workprocedure_id");
|
||||
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
throw new BadRequestException("物料不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(area_type)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
throw new BadRequestException("是否满托不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(workprocedure_id)) {
|
||||
throw new BadRequestException("工序不能为空!");
|
||||
}
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "3")
|
||||
.addParam("material_id", material_id).addParam("area_type", area_type)
|
||||
.addParam("is_full", is_full).addParam("workprocedure_id", workprocedure_id)
|
||||
.process().uniqueResult(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static JSONObject getEmptyVehicleInStruct(JSONObject jsonObject) {
|
||||
String area_type = jsonObject.getString("area_type");
|
||||
String vehicle_code = jsonObject.getString("vehicle_code");
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("托盘不能为空!");
|
||||
}
|
||||
//根据托盘找托盘类型,
|
||||
JSONObject vehicleObj = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code='" + vehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicleObj)) {
|
||||
throw new BadRequestException("未找到托盘号为'" + vehicle_code + "' 托盘信息!");
|
||||
}
|
||||
if (StrUtil.isEmpty(area_type)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
String vehice_type = vehicleObj.getString("vehicle_type");
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "4")
|
||||
.addParam("area_type", area_type).addParam("vehice_type", vehice_type).process().uniqueResult(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static JSONObject getEmptyVehicleOutStruct(JSONObject jsonObject) {
|
||||
String area_type = jsonObject.getString("area_type");
|
||||
String vehicle_type = jsonObject.getString("vehicle_type");
|
||||
if (StrUtil.isEmpty(area_type)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "5")
|
||||
.addParam("area_type", area_type).addParam("vehicle_type", vehicle_type).process().uniqueResult(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,14 +13,15 @@ import java.util.List;
|
||||
/**
|
||||
* Title: AbstractAcsTask.java Description:任务抽象类
|
||||
* <p>
|
||||
* Task状态:00生成 ,01:下发,02、执行中,99、完成
|
||||
* 完成方式:00自动,01:手动
|
||||
* Task状态:01生成 ,02:确定起点,03、确定终点,04、起点和终点都确认,05:下发,可以下发, 06、执行中 07、完成
|
||||
* 完成方式:01自动,02:wcs删除,03、wms删除,04、发给wcs失败自动删除
|
||||
*
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午5:53:28
|
||||
*/
|
||||
public abstract class AbstractAcsTask {
|
||||
|
||||
|
||||
/**
|
||||
* @discription 在如果任务无法形成会一直定时刷新判断
|
||||
* @author ldjun
|
||||
@@ -28,6 +29,8 @@ public abstract class AbstractAcsTask {
|
||||
*/
|
||||
public List<AcsTaskDto> schedule() {
|
||||
this.autoCreate();
|
||||
this.findStartPoint();
|
||||
this.findNextPoint();
|
||||
return addTask();
|
||||
}
|
||||
|
||||
@@ -39,19 +42,19 @@ public abstract class AbstractAcsTask {
|
||||
public List<AcsTaskDto> addTask() {
|
||||
//任务基础表【sch_base_task】
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray tasks = taskTab.query("is_auto_issue='1' AND handle_class = '" + this.getClass().getName() + "' and task_status = '" + TaskStatusEnum.CREATED.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
JSONArray tasks = taskTab.query("handle_class = '" + this.getClass().getName() + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
List<AcsTaskDto> arr = new ArrayList<>();
|
||||
for (int i = 0, j = tasks.size(); i < j; i++) {
|
||||
JSONObject json = tasks.getJSONObject(i);
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setTask_uuid(json.getString("taskdtl_id"));
|
||||
taskDto.setTask_id(json.getString("task_id"));
|
||||
taskDto.setTask_code(json.getString("task_code"));
|
||||
taskDto.setTask_type(json.getString("task_type"));
|
||||
taskDto.setTask_type("1");
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setStart_device_code(json.getString("start_point_code"));
|
||||
taskDto.setNext_device_code(json.getString("next_point_code"));
|
||||
taskDto.setVehicle_code(json.getString("vehicle_code"));
|
||||
arr.add(taskDto);
|
||||
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@@ -66,6 +69,23 @@ public abstract class AbstractAcsTask {
|
||||
*/
|
||||
public abstract void updateTaskStatus(JSONObject taskObj, String status);
|
||||
|
||||
/**
|
||||
* @returninvoke
|
||||
* @discription 确定任务起点
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午6:01:30
|
||||
*/
|
||||
|
||||
public abstract void findStartPoint();
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @discription 确定下一点位
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午6:01:06
|
||||
*/
|
||||
public abstract void findNextPoint();
|
||||
|
||||
/**
|
||||
* @param form 创建任务需要的参数
|
||||
* @return 返回任务标识
|
||||
@@ -79,32 +99,6 @@ public abstract class AbstractAcsTask {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WCS的任务集合
|
||||
* @discription 下发给wcs任务
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午5:52:28
|
||||
*/
|
||||
public JSONObject notifyAcs(String taskdtl_id) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONArray arr = taskTab.query("taskdtl_id = '" + taskdtl_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0, j = arr.size(); i < j; i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setTask_uuid(json.getString("taskdtl_id"));
|
||||
taskDto.setExt_task_uuid(json.getString("taskdtl_id"));
|
||||
taskDto.setTask_code(json.getString("task_code"));
|
||||
taskDto.setTask_type(json.getString("acs_task_type"));
|
||||
taskDto.setStart_device_code(json.getString("start_point_code"));
|
||||
taskDto.setNext_device_code(json.getString("next_point_code"));
|
||||
taskDto.setVehicle_code(json.getString("vehicle_code"));
|
||||
jsonArray.add(JSONObject.parseObject(JSON.toJSONString(taskDto)));
|
||||
|
||||
}
|
||||
return AcsUtil.notifyAcs("api/wms/task", jsonArray);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return WCS的任务集合
|
||||
@@ -112,49 +106,50 @@ public abstract class AbstractAcsTask {
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午5:52:28
|
||||
*/
|
||||
public JSONObject renotifyAcs(String taskdtl_id) {
|
||||
public JSONObject renotifyAcs(String task_id) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONArray arr = taskTab.query("taskdtl_id = '" + taskdtl_id + "'").getResultJSONArray(0);
|
||||
JSONArray arr = taskTab.query("task_id = '" + task_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0, j = arr.size(); i < j; i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setTask_uuid(json.getString("taskdtl_id"));
|
||||
taskDto.setTask_id(json.getString("task_id"));
|
||||
taskDto.setTask_code(json.getString("task_code"));
|
||||
taskDto.setTask_type("");
|
||||
taskDto.setTask_type("1");
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setStart_device_code(json.getString("start_point_code"));
|
||||
taskDto.setNext_device_code(json.getString("next_point_code"));
|
||||
taskDto.setVehicle_code(json.getString("vehicle_code"));
|
||||
jsonArray.add(JSONObject.parseObject(JSON.toJSONString(taskDto)));
|
||||
jsonArray.add(JSONObject.parse(JSON.toJSONString(taskDto)));
|
||||
|
||||
}
|
||||
return AcsUtil.notifyAcs("api/wms/task", jsonArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskdtl_id 任务标识
|
||||
* @param task_id 任务标识
|
||||
* @return
|
||||
* @discription 强制结束完成任务
|
||||
* @author ldjun
|
||||
* @created 2020年6月19日 上午10:34:58
|
||||
*/
|
||||
public abstract void forceFinish(String taskdtl_id);
|
||||
public abstract void forceFinish(String task_id);
|
||||
|
||||
/**
|
||||
* @param taskdtl_id
|
||||
* @param task_id
|
||||
* @return
|
||||
* @discription 任务搬回原起点。
|
||||
* @author ldjun
|
||||
* @created 2020年6月22日 下午8:40:58
|
||||
*/
|
||||
public abstract void pullBack(String taskdtl_id);
|
||||
public abstract void pullBack(String task_id);
|
||||
|
||||
/**
|
||||
* A-B不确定进行到什么状态的取消任务
|
||||
* 取消任务
|
||||
*
|
||||
* @param taskdtl_id
|
||||
* @param task_id
|
||||
*/
|
||||
public abstract void cancel(String taskdtl_id);
|
||||
public abstract void cancel(String task_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,9 +5,12 @@ package org.nl.wms.sch.manage;
|
||||
*/
|
||||
public enum TaskStatusEnum {
|
||||
CREATED("01", "生成"),
|
||||
ISSUE("02", "下发"),
|
||||
EXECUTING("03", "执行中"),
|
||||
FINISHED("99", "完成");
|
||||
SURE_START("02", "确定起点"),
|
||||
SURE_END("03", "确定终点"),
|
||||
START_AND_POINT("04", "起点终点确认"),
|
||||
ISSUE("05", "下发"),
|
||||
EXECUTING("06", "执行中"),
|
||||
FINISHED("07", "完成");
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
@@ -5,9 +5,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AcsTaskDto {
|
||||
//任务标识
|
||||
private String task_uuid;
|
||||
//外部任务标识(Acs用)
|
||||
private String ext_task_uuid;
|
||||
private String task_id;
|
||||
//任务编码
|
||||
private String task_code;
|
||||
//任务类型
|
||||
@@ -26,5 +24,7 @@ public class AcsTaskDto {
|
||||
private String remark;
|
||||
//扩展参数
|
||||
private String params;
|
||||
//路由类型
|
||||
private String route_plan_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.basedata.st.IvtChangeTypeEnum;
|
||||
import org.nl.wms.basedata.st.StoreIvtServiceImpl;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wms.sch.service.impl.PointServiceImpl;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
public class CallMaterialTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = CallMaterialTask.class.getName();
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
*改变任务状态
|
||||
**/
|
||||
String task_id = taskObj.getString("task_id");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("bill_status", "40");
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
map.put("update_optname", SecurityUtils.getNickName());
|
||||
map.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").update(map, "task_id='" + jsonTask.getString("task_id") + "'");
|
||||
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
// 更新任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("taskfinish_mode", taskObj.getString("taskfinish_mode"));
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("remark", "任务执行完成");
|
||||
///审核单据 增加库存 改变出入库表的状态
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject mstObj = mstTab.query("task_id='" + task_id + "' and is_delete='0'").uniqueResult(0);
|
||||
//审核 加库存可和用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
mstObj.put("bill_status", "50");
|
||||
mstObj.put("confirm_optid", SecurityUtils.getCurrentUserId());
|
||||
mstObj.put("confirm_optname", SecurityUtils.getNickName());
|
||||
mstObj.put("confirm_time", DateUtil.now());
|
||||
mstTab.update(mstObj);
|
||||
|
||||
String iostorinv_id = mstObj.getString("iostorinv_id");
|
||||
String next_point_code = mstObj.getString("end_point_code");
|
||||
String start_point_code = mstObj.getString("start_point_code");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", mstObj.getString("material_id"));
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", mstObj.getString("qty_unit_id"));
|
||||
param.put("pcsn", mstObj.getString("pcsn"));
|
||||
param.put("change_qty", mstObj.getString("qty"));
|
||||
param.put("vehicle_code", mstObj.getString("vehicle_code"));
|
||||
param.put("workprocedure_id", mstObj.getString("ivt_workprocedure_id"));
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
PointDto nextPointDto = pointService.findByCode(next_point_code);
|
||||
if (ObjectUtil.isNull(nextPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
}
|
||||
PointDto startPointDto = pointService.findByCode(start_point_code);
|
||||
if (ObjectUtil.isNull(startPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
}
|
||||
param.put("struct_id", startPointDto.getPoint_id());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_IVT);
|
||||
//解锁仓位,托盘信息,回写到点位上去
|
||||
String vehicle_code = jsonTask.getString("vehicle_code");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject endpointObj = pointTab.query("point_code='" + jsonTask.getString("next_point_code") + "'").uniqueResult(0);
|
||||
endpointObj.put("lock_type", "00");
|
||||
endpointObj.put("point_status", "02");
|
||||
endpointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(endpointObj);
|
||||
|
||||
JSONObject startPointObj = pointTab.query("point_code='" + jsonTask.getString("start_point_code") + "'").uniqueResult(0);
|
||||
startPointObj.put("lock_type", "00");
|
||||
startPointObj.put("point_status", "00");
|
||||
startPointObj.put("vehicle_code", "");
|
||||
pointTab.update(startPointObj);
|
||||
//假如是最底下的仓位,则要解锁对面的仓位
|
||||
JSONObject structRealObj = WQLObject.getWQLObject("ST_IVT_StructRelaStruct").query("struct_id = '" + startPointObj.getString("point_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(structRealObj)) {
|
||||
JSONObject relaPointObj = pointTab.query("point_id='" + structRealObj.getString("bindstruct_id") + "'").uniqueResult(0);
|
||||
relaPointObj.put("lock_type", "00");
|
||||
relaPointObj.put("point_status", "02");
|
||||
relaPointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(relaPointObj);
|
||||
}
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
String task_status = TaskStatusEnum.SURE_START.getCode();
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
JSONArray taskArry = taskTab.query("task_status='" + task_status + "' AND handle_class='" + THIS_CLASS + "' AND is_delete='0' ").getResultJSONArray(0);
|
||||
for (int i = 0; i < taskArry.size(); i++) {
|
||||
JSONObject taskObj = taskArry.getJSONObject(i);
|
||||
String task_id = taskObj.getString("task_id");
|
||||
//1 将任务修改为分配 2将终点写入,完成分配,3 加锁点位
|
||||
//找一个合适的仓位
|
||||
WQLObject ProcedureIOStable = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject IosObj = ProcedureIOStable.query("task_id='" + task_id + "' and is_delete ='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(IosObj)) {
|
||||
throw new BadRequestException("未找到任务号为'" + taskObj.getString("task_code") + "'的入库单据!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", IosObj.getString("material_id"));
|
||||
param.put("area_type", IosObj.getString("start_area"));
|
||||
JSONObject inStructObj = StructFindUtil.getOutStruct(param);
|
||||
if (ObjectUtil.isEmpty(inStructObj)) {
|
||||
throw new BadRequestException("未找到合适的出库仓位!");
|
||||
}
|
||||
//修改单据状态,将终点填入
|
||||
IosObj.put("bill_status", "20");
|
||||
IosObj.put("start_point_code", inStructObj.getString("struct_code"));
|
||||
ProcedureIOStable.update(IosObj);
|
||||
//终点加锁
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point").update(lock_map, "point_code = '" + inStructObj.getString("struct_code") + "'");
|
||||
//修改任务状态
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("update_optname", SecurityUtils.getNickName());
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
//请求参数 终点不能为空 物料,数量,客户,批次,创建方式,托盘,是否满托不能为空! 起点点位不为空时,单据编号不能为空!
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String task_status = TaskStatusEnum.SURE_START.getCode();
|
||||
String material_id = form.getString("material_id");
|
||||
|
||||
String create_mode = form.getString("create_mode");
|
||||
String pcsn = form.getString("pcsn");
|
||||
String is_full = form.getString("is_full");
|
||||
String workprocedure_id = form.getString("workprocedure_id");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
String iostorinv_id = form.getString("iostorinv_id");
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
throw new BadRequestException("终点不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
throw new BadRequestException("物料标识不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(create_mode)) {
|
||||
throw new BadRequestException("创建方式不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
throw new BadRequestException("是否满托不能为空!");
|
||||
}
|
||||
//判断终点有没有未完成的指令
|
||||
JSONObject beforTaskObj = taskTable.
|
||||
query("is_delete='0' and next_point_code='" + next_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) {
|
||||
throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String start_area = "";
|
||||
String startArea_type = "";
|
||||
String bill_type = "";
|
||||
String qty = "";
|
||||
String qty_unit_id = "";
|
||||
String ivt_workprocedure_id = "";
|
||||
WQLObject iosTable = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
if (StrUtil.isNotEmpty(start_point_code)) {
|
||||
if (StrUtil.isEmpty(iostorinv_id)) {
|
||||
throw new BadRequestException("入库单据号不能为空!");
|
||||
}
|
||||
JSONObject IosObj = iosTable.query("iostorinv_id='" + iostorinv_id + "'").uniqueResult(0);
|
||||
IosObj.put("bill_status", "20");
|
||||
iosTable.update(IosObj);
|
||||
PointDto StartPoint = pointService.findByCode(start_point_code);
|
||||
JSONObject ivtObj = WQLObject.getWQLObject("ST_IVT_StructIvt").query("struct_id='" + StartPoint.getPoint_id() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtObj)) {
|
||||
throw new BadRequestException("仓位为'" + StartPoint.getPoint_code() + "'的库存信息不存在!");
|
||||
}
|
||||
qty = ivtObj.getString("canuse_qty");
|
||||
qty_unit_id = ivtObj.getString("qty_unit_id");
|
||||
ivt_workprocedure_id = ivtObj.getString("ivt_workprocedure_id");
|
||||
|
||||
}
|
||||
PointDto nextPoint = pointService.findByCode(next_point_code);
|
||||
//如果没给终点,根据起点去找工序,找一个合适的仓位 并且生成入库单,并且锁定点位
|
||||
/* if (StrUtil.isEmpty(start_point_code)) {
|
||||
if (StrUtil.isEmpty(workprocedure_id)) {
|
||||
|
||||
JSONObject workInfo = WQL.getWO("QSTRUCT_RULE").addParam("flag", "1").addParam("code", next_point_code)
|
||||
.process().uniqueResult(0);
|
||||
workprocedure_id = workInfo.getString("workprocedure_id");
|
||||
|
||||
WorkProcedureEnum workProcedureEnum = WorkProcedureEnum.get(workprocedure_id);
|
||||
switch (workProcedureEnum) {
|
||||
//混黏工序
|
||||
case HNGX:
|
||||
startArea_type = AreaEnum.KLHJ.getCode();
|
||||
bill_type = BillTypeEnum.HNCK.getCode();
|
||||
break;
|
||||
// 压制工序
|
||||
case YZGX:
|
||||
startArea_type = AreaEnum.KLHJ.getCode();
|
||||
bill_type = BillTypeEnum.YZCK.getCode();
|
||||
ivt_workprocedure_id = WorkProcedureEnum.HNGX.getId();
|
||||
break;
|
||||
//烧制工序
|
||||
case SZGX:
|
||||
startArea_type = AreaEnum.CYHJ.getCode();
|
||||
bill_type = BillTypeEnum.SZCK.getCode();
|
||||
ivt_workprocedure_id = WorkProcedureEnum.YZGX.getId();
|
||||
break;
|
||||
//分拣工序
|
||||
case FJGX:
|
||||
startArea_type = AreaEnum.CYZC.getCode();
|
||||
bill_type = BillTypeEnum.FJCK.getCode();
|
||||
ivt_workprocedure_id = WorkProcedureEnum.SZGX.getId();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// (机械手呼叫空托盘,需要呼叫半满托盘)如果请求有工序,假如是压制工序,则库存工序是压制,起点是出窑货架
|
||||
WorkProcedureEnum workProcedureEnum = WorkProcedureEnum.get(workprocedure_id);
|
||||
switch (workProcedureEnum) {
|
||||
// 压制工序
|
||||
case YZGX:
|
||||
startArea_type = AreaEnum.CYHJ.getCode();
|
||||
bill_type = BillTypeEnum.YZCK.getCode();
|
||||
ivt_workprocedure_id = WorkProcedureEnum.YZGX.getId();
|
||||
break;
|
||||
//分拣工序
|
||||
case FJGX:
|
||||
startArea_type = AreaEnum.BZZC.getCode();
|
||||
bill_type = BillTypeEnum.FJCK.getCode();
|
||||
ivt_workprocedure_id = WorkProcedureEnum.FJGX.getId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", material_id);
|
||||
param.put("area_type", startArea_type);
|
||||
param.put("workprocedure_id", ivt_workprocedure_id);
|
||||
param.put("is_full", is_full);
|
||||
JSONObject outStructObj = StructFindUtil.getOutStruct(param);
|
||||
if (ObjectUtil.isEmpty(outStructObj)) {
|
||||
throw new BadRequestException("未找到合适的出库仓位!");
|
||||
}
|
||||
qty = outStructObj.getString("canuse_qty");
|
||||
qty_unit_id = outStructObj.getString("qty_unit_id");
|
||||
|
||||
start_point_code = outStructObj.getString("struct_code");
|
||||
vehicle_code = outStructObj.getString("vehicle_code");
|
||||
//创建出库单据
|
||||
JSONObject iosObj = new JSONObject();
|
||||
iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
iosObj.put("iostorinv_id", iostorinv_id);
|
||||
iosObj.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
iosObj.put("io_type", "1");
|
||||
iosObj.put("bill_type", bill_type);
|
||||
iosObj.put("workprocedure_id", workprocedure_id);
|
||||
iosObj.put("ivt_workprocedure_id", ivt_workprocedure_id);
|
||||
iosObj.put("material_id", material_id);
|
||||
iosObj.put("vehicle_code", outStructObj.getString("vehicle_code"));
|
||||
iosObj.put("qty", qty);
|
||||
iosObj.put("qty_unit_id", qty_unit_id);
|
||||
//默认是分配状态
|
||||
iosObj.put("bill_status", "20");
|
||||
iosObj.put("start_point_code", start_point_code);
|
||||
iosObj.put("end_point_code", next_point_code);
|
||||
iosObj.put("start_area", startArea_type);
|
||||
iosObj.put("end_area", nextPoint.getArea_type());
|
||||
iosObj.put("cust_id", cust_id);
|
||||
iosObj.put("create_mode", create_mode);
|
||||
iosObj.put("task_id", task_id);
|
||||
iosObj.put("pcsn", pcsn);
|
||||
iosObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
iosObj.put("create_name", SecurityUtils.getNickName());
|
||||
iosObj.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").insert(iosObj);
|
||||
}*/
|
||||
|
||||
task_status = TaskStatusEnum.START_AND_POINT.getCode();
|
||||
|
||||
PointDto startPoint = pointService.findByCode(start_point_code);
|
||||
start_area = nextPoint.getArea_type();
|
||||
//终点点加锁
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point").update(lock_map, "point_code = '" + next_point_code + "'");
|
||||
|
||||
//起点点加锁
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject startPointObj = pointTable.query("point_code='" + start_point_code + "'").uniqueResult(0);
|
||||
startPointObj.put("lock_type", "01");
|
||||
pointTable.update(startPointObj);
|
||||
//假如是最底下的仓位,则要锁定对面的仓位
|
||||
JSONObject structRealObj = WQLObject.getWQLObject("ST_IVT_StructRelaStruct").query("struct_id = '" + startPointObj.getString("point_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(structRealObj)) {
|
||||
JSONObject relaPointObj = pointTable.query("point_id='" + structRealObj.getString("bindstruct_id") + "'").uniqueResult(0);
|
||||
relaPointObj.put("lock_type", "01");
|
||||
pointTable.update(relaPointObj);
|
||||
}
|
||||
|
||||
//减少库存可用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", material_id);
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", qty_unit_id);
|
||||
param.put("change_qty", qty);
|
||||
param.put("struct_id", startPoint.getPoint_id());
|
||||
param.put("vehicle_code", startPoint.getVehicle_code());
|
||||
param.put("workprocedure_id", ivt_workprocedure_id);
|
||||
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_CAN_USE);
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", task_id);
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "02");
|
||||
taskObj.put("taskdtl_type", "02");
|
||||
taskObj.put("task_status", task_status);
|
||||
taskObj.put("start_point_code", start_point_code);
|
||||
taskObj.put("start_area", start_area);
|
||||
taskObj.put("request_param", form.toJSONString());
|
||||
taskObj.put("next_point_code", next_point_code);
|
||||
taskObj.put("next_area", nextPoint.getArea_type());
|
||||
taskObj.put("vehicle_code", vehicle_code);
|
||||
taskObj.put("handle_class", THIS_CLASS);
|
||||
taskObj.put("is_auto_issue", "1");
|
||||
taskObj.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
taskObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("create_time", DateUtil.now());
|
||||
taskObj.put("is_delete", "0");
|
||||
taskTable.insert(taskObj);
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,16 @@ public class PointToPointTask extends AbstractAcsTask {
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").update(map, "taskdtl_id = '" + taskObj.getString("taskdtl_id") + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.basedata.st.IvtChangeTypeEnum;
|
||||
import org.nl.wms.basedata.st.StoreIvtServiceImpl;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wms.sch.service.impl.PointServiceImpl;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SendMaterialTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = SendMaterialTask.class.getName();
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
*改变任务状态
|
||||
**/
|
||||
String task_id = taskObj.getString("task_id");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
map.put("update_optname", SecurityUtils.getNickName());
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("bill_status", "40");
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").update(map, "task_id='" + jsonTask.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
// 更新任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("taskfinish_mode", taskObj.getString("taskfinish_mode"));
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("remark", "任务执行完成");
|
||||
///审核单据 增加库存 改变出入库表的状态
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject mstObj = mstTab.query("task_id='" + task_id + "' and is_delete='0'").uniqueResult(0);
|
||||
//审核 加库存可和用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
mstObj.put("bill_status", "50");
|
||||
mstObj.put("confirm_optid", SecurityUtils.getCurrentUserId());
|
||||
mstObj.put("confirm_optname", SecurityUtils.getNickName());
|
||||
mstObj.put("confirm_time", DateUtil.now());
|
||||
mstTab.update(mstObj);
|
||||
|
||||
String iostorinv_id = mstObj.getString("iostorinv_id");
|
||||
String bill_code = mstObj.getString("bill_code");
|
||||
String bill_type_scode =mstObj.getString("bill_type");
|
||||
String next_point_code = mstObj.getString("end_point_code");
|
||||
String start_point_code = mstObj.getString("start_point_code");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", mstObj.getString("material_id"));
|
||||
param.put("bill_code", bill_code);
|
||||
param.put("bill_type_scode", bill_type_scode);
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", mstObj.getString("qty_unit_id"));
|
||||
param.put("pcsn", mstObj.getString("pcsn"));
|
||||
param.put("change_qty", mstObj.getString("qty"));
|
||||
param.put("vehicle_code", mstObj.getString("vehicle_code"));
|
||||
param.put("workprocedure_id", mstObj.getString("workprocedure_id"));
|
||||
param.put("is_full", mstObj.getString("is_full"));
|
||||
param.put("stewing_time", mstObj.getString("stewing_time"));
|
||||
param.put("producetask_id", mstObj.getString("producetask_id"));
|
||||
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
PointDto nextPointDto = pointService.findByCode(next_point_code);
|
||||
if (ObjectUtil.isNull(nextPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
}
|
||||
PointDto startPointDto = pointService.findByCode(start_point_code);
|
||||
if (ObjectUtil.isNull(startPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
}
|
||||
param.put("struct_id", nextPointDto.getPoint_id());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.ADD_IVT_AND_CAN_USE);
|
||||
//解锁仓位,托盘信息,回写到点位上去
|
||||
String vehicle_code = jsonTask.getString("vehicle_code");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject endpointObj = pointTab.query("point_code='" + jsonTask.getString("next_point_code") + "'").uniqueResult(0);
|
||||
endpointObj.put("lock_type", "00");
|
||||
endpointObj.put("point_status", "02");
|
||||
endpointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(endpointObj);
|
||||
//假如是最底下的仓位,则要锁定对面的仓位
|
||||
JSONObject structRealObj = WQLObject.getWQLObject("ST_IVT_StructRelaStruct").query("struct_id = '" + endpointObj.getString("point_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(structRealObj)) {
|
||||
JSONObject relaPointObj = pointTab.query("point_id='" + structRealObj.getString("bindstruct_id") + "'").uniqueResult(0);
|
||||
relaPointObj.put("lock_type", "00");
|
||||
relaPointObj.put("point_status", "02");
|
||||
relaPointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(relaPointObj);
|
||||
}
|
||||
|
||||
JSONObject startPointObj = pointTab.query("point_code='" + jsonTask.getString("start_point_code") + "'").uniqueResult(0);
|
||||
startPointObj.put("lock_type", "00");
|
||||
startPointObj.put("point_status", "00");
|
||||
startPointObj.put("vehicle_code", "");
|
||||
pointTab.update(startPointObj);
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
String task_status = TaskStatusEnum.SURE_START.getCode();
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
JSONArray taskArry = taskTab.query("task_status='" + task_status + "' AND handle_class='" + THIS_CLASS + "' AND is_delete='0' ").getResultJSONArray(0);
|
||||
for (int i = 0; i < taskArry.size(); i++) {
|
||||
JSONObject taskObj = taskArry.getJSONObject(i);
|
||||
String task_id = taskObj.getString("task_id");
|
||||
//1 将任务修改为分配 2将终点写入,完成分配,3 加锁点位
|
||||
//找一个合适的仓位
|
||||
WQLObject ProcedureIOStable = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject IosObj = ProcedureIOStable.query("task_id='" + task_id + "' and is_delete ='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(IosObj)) {
|
||||
throw new BadRequestException("未找到任务号为'" + taskObj.getString("task_code") + "'的入库单据!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", IosObj.getString("material_id"));
|
||||
param.put("area_type", IosObj.getString("end_area"));
|
||||
param.put("vehicle_code", IosObj.getString("vehicle_code"));
|
||||
JSONObject inStructObj = StructFindUtil.getInStruct(param);
|
||||
if (ObjectUtil.isEmpty(inStructObj)) {
|
||||
throw new BadRequestException("未找到合适的入库仓位!");
|
||||
}
|
||||
//修改单据状态,将终点填入
|
||||
IosObj.put("bill_status", "20");
|
||||
IosObj.put("end_point_code", inStructObj.getString("struct_code"));
|
||||
ProcedureIOStable.update(IosObj);
|
||||
//终点加锁
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point").update(lock_map, "point_code = '" + inStructObj.getString("struct_code") + "'");
|
||||
//修改任务状态
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("update_optname", SecurityUtils.getNickName());
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
//请求参数 载具、起点 物料,数量,客户,批次,创建方式 是否满托不能为空! 终点可以不为空时,入库单据编号不能为空
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String material_id = form.getString("material_id");
|
||||
String stewing_time = form.getString("stewing_time");
|
||||
String producetask_id = form.getString("producetask_id");
|
||||
String is_full = form.getString("is_full");
|
||||
String qty = form.getString("qty");
|
||||
String cust_id = form.getString("cust_id");
|
||||
String create_mode = form.getString("create_mode");
|
||||
String pcsn = form.getString("pcsn");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("载具不能为空!");
|
||||
}
|
||||
//判断起点有没有未完成的指令
|
||||
JSONObject beforTaskObj = taskTable.
|
||||
query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) {
|
||||
throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
PointService pointService = SpringContextHolder.getBean(PointService.class);
|
||||
PointDto startPoint = pointService.findByCode(start_point_code);
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String qty_unit_id = "";
|
||||
String endArea_type = "";
|
||||
String bill_type = "";
|
||||
WQLObject iosTable = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
//如果给了终点,更新入库单据,给pc、手持调用
|
||||
if (StrUtil.isNotEmpty(next_point_code)) {
|
||||
String iostorinv_id = form.getString("iostorinv_id");
|
||||
if (StrUtil.isEmpty(iostorinv_id)) {
|
||||
throw new BadRequestException("入库单据号不能为空!");
|
||||
}
|
||||
JSONObject IosObj = iosTable.query("iostorinv_id='" + iostorinv_id + "'").uniqueResult(0);
|
||||
IosObj.put("bill_status", "20");
|
||||
iosTable.update(IosObj);
|
||||
}
|
||||
//如果没给终点,根据起点去找工序,找一个合适的仓位 并且生成入库单,并且锁定点位
|
||||
/*if (StrUtil.isEmpty(next_point_code)) {
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
throw new BadRequestException("物料标识不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new BadRequestException("数量数值不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(cust_id)) {
|
||||
throw new BadRequestException("客户不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(create_mode)) {
|
||||
throw new BadRequestException("创建方式不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
throw new BadRequestException("是否满托不能为空!");
|
||||
}
|
||||
JSONObject workInfo = WQL.getWO("QSTRUCT_RULE").addParam("flag", "1").addParam("code", start_point_code)
|
||||
.process().uniqueResult(0);
|
||||
String workprocedure_id = workInfo.getString("workprocedure_id");
|
||||
WorkProcedureEnum workProcedureEnum = WorkProcedureEnum.get(workprocedure_id);
|
||||
|
||||
switch (workProcedureEnum) {
|
||||
//混黏工序
|
||||
case HNGX:
|
||||
qty_unit_id = BussConstant.HN_IN_QTY_UNIT_ID;
|
||||
endArea_type = AreaEnum.KLHJ.getCode();
|
||||
bill_type = BillTypeEnum.HNRK.getCode();
|
||||
break;
|
||||
// 压制工序
|
||||
case YZGX:
|
||||
qty_unit_id = BussConstant.HN_IN_QTY_UNIT_ID;
|
||||
endArea_type = AreaEnum.CYHJ.getCode();
|
||||
bill_type = BillTypeEnum.YZRK.getCode();
|
||||
break;
|
||||
//烧制工序
|
||||
case SZGX:
|
||||
qty_unit_id = BussConstant.YZ_IN_QTY_UNIT_ID;
|
||||
bill_type = BillTypeEnum.SZRK.getCode();
|
||||
endArea_type = AreaEnum.CYZC.getCode();
|
||||
break;
|
||||
//分拣工序
|
||||
case FJGX:
|
||||
qty_unit_id = BussConstant.HN_IN_QTY_UNIT_ID;
|
||||
bill_type = BillTypeEnum.SZRK.getCode();
|
||||
endArea_type = AreaEnum.BZZC.getCode();
|
||||
break;
|
||||
default:
|
||||
qty_unit_id = BussConstant.HN_IN_QTY_UNIT_ID;
|
||||
break;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", material_id);
|
||||
param.put("area_type", endArea_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
JSONObject inStructObj = StructFindUtil.getInStruct(param);
|
||||
if (ObjectUtil.isEmpty(inStructObj)) {
|
||||
throw new BadRequestException("未找到合适的入库仓位!");
|
||||
}
|
||||
next_point_code = inStructObj.getString("struct_code");
|
||||
//创建入库单据
|
||||
//假如静置时间为0 或者为空,则取物料表上的静置时间
|
||||
if (StrUtil.isEmpty(stewing_time) || StrUtil.equals(stewing_time, "0")) {
|
||||
stewing_time = WQLObject.getWQLObject("md_me_material").query("material_id ='" + material_id + "'").
|
||||
uniqueResult(0).getString("stewing_time");
|
||||
}
|
||||
JSONObject iosObj = new JSONObject();
|
||||
iosObj.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
iosObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
iosObj.put("io_type", "0");
|
||||
iosObj.put("bill_type", bill_type);
|
||||
iosObj.put("workprocedure_id", workprocedure_id);
|
||||
iosObj.put("ivt_workprocedure_id", workprocedure_id);
|
||||
iosObj.put("material_id", material_id);
|
||||
iosObj.put("vehicle_code", vehicle_code);
|
||||
iosObj.put("producetask_id", producetask_id);
|
||||
iosObj.put("stewing_time", stewing_time);
|
||||
iosObj.put("qty", qty);
|
||||
iosObj.put("qty_unit_id", qty_unit_id);
|
||||
//默认是分配状态
|
||||
iosObj.put("bill_status", "20");
|
||||
iosObj.put("start_point_code", start_point_code);
|
||||
iosObj.put("end_point_code", next_point_code);
|
||||
iosObj.put("start_area", startPoint.getArea_type());
|
||||
iosObj.put("end_area", endArea_type);
|
||||
iosObj.put("cust_id", cust_id);
|
||||
iosObj.put("create_mode", create_mode);
|
||||
iosObj.put("task_id", task_id);
|
||||
iosObj.put("pcsn", pcsn);
|
||||
iosObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
iosObj.put("create_name", SecurityUtils.getNickName());
|
||||
iosObj.put("create_time", DateUtil.now());
|
||||
iosObj.put("is_full", is_full);
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").insert(iosObj);
|
||||
}*/
|
||||
String task_status = TaskStatusEnum.START_AND_POINT.getCode();
|
||||
PointDto nextPoint = pointService.findByCode(next_point_code);
|
||||
//终点点加锁
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject endPointObj = pointTable.query("point_code='" + next_point_code + "'").uniqueResult(0);
|
||||
endPointObj.put("lock_type", "01");
|
||||
pointTable.update(endPointObj);
|
||||
//假如是最底下的仓位,则要锁定对面的仓位
|
||||
JSONObject structRealObj = WQLObject.getWQLObject("ST_IVT_StructRelaStruct").query("struct_id = '" + endPointObj.getString("point_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(structRealObj)) {
|
||||
JSONObject relaPointObj = pointTable.query("point_id='" + structRealObj.getString("bindstruct_id") + "'").uniqueResult(0);
|
||||
relaPointObj.put("lock_type", "01");
|
||||
pointTable.update(relaPointObj);
|
||||
}
|
||||
CodeUtil.getNewCode("TASK_CODE");
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", task_id);
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "01");
|
||||
taskObj.put("taskdtl_type", "01");
|
||||
taskObj.put("acs_task_type", "1");
|
||||
taskObj.put("task_status", task_status);
|
||||
taskObj.put("start_point_code", start_point_code);
|
||||
taskObj.put("start_area", startPoint.getArea_type());
|
||||
taskObj.put("request_param", form.toJSONString());
|
||||
taskObj.put("next_point_code", next_point_code);
|
||||
taskObj.put("next_area", nextPoint.getArea_type());
|
||||
taskObj.put("vehicle_code", vehicle_code);
|
||||
taskObj.put("handle_class", THIS_CLASS);
|
||||
taskObj.put("is_auto_issue", "1");
|
||||
taskObj.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
taskObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("create_time", DateUtil.now());
|
||||
taskObj.put("is_delete", "0");
|
||||
taskTable.insert(taskObj);
|
||||
return task_id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
server:
|
||||
port: 8011
|
||||
port: 8010
|
||||
#海亮sqlserver
|
||||
erp:
|
||||
sqlserver:
|
||||
enabled: false
|
||||
jdbcurl: jdbc:sqlserver://192.168.81.155;DatabaseName=hllg
|
||||
enabled: true
|
||||
jdbcurl: jdbc:sqlserver://192.168.81.156;DatabaseName=hllg
|
||||
username: sa
|
||||
password: root
|
||||
|
||||
@@ -17,10 +17,10 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
#password: ${DB_PWD:Root.123456}
|
||||
#password: ${DB_PWD:P@ssw0rd}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
@@ -66,15 +66,15 @@ spring:
|
||||
multi-statement-alagvslow: true
|
||||
data:
|
||||
mongodb:
|
||||
host: 192.168.46.225
|
||||
host: 47.111.78.178
|
||||
port: 27017
|
||||
database: nlacs
|
||||
redis:
|
||||
#数据库索引
|
||||
|
||||
database: ${REDIS_DB:6}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
#host: ${REDIS_HOST:localhost}
|
||||
database: ${REDIS_DB:1}
|
||||
#host: ${REDIS_HOST:47.111.78.178}
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
@@ -151,7 +151,7 @@ file:
|
||||
|
||||
jetcache:
|
||||
defaultCacheType: LOCAL
|
||||
statIntervalMinutes: 14
|
||||
statIntervalMinutes: 15
|
||||
areaInCacheName: false
|
||||
hiddenPackages: com.yb
|
||||
local:
|
||||
@@ -171,5 +171,5 @@ jetcache:
|
||||
maxIdle: 200
|
||||
maxTotal: 1000
|
||||
uri:
|
||||
- redis://127.0.0.1:6379
|
||||
- redis://47.111.78.178:6379
|
||||
|
||||
|
||||
Reference in New Issue
Block a user