fix:分切计划改为按照母卷按照数组下发
This commit is contained in:
@@ -53,8 +53,8 @@ public class MesToLmsController {
|
||||
@PostMapping("/cutPlanTransfer")
|
||||
@Log("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> cutPlanTransfer(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.cutPlanTransfer(jo), HttpStatus.OK);
|
||||
public ResponseEntity<Object> cutPlanTransfer(@RequestBody JSONArray ja) {
|
||||
return new ResponseEntity<>(mesToLmsService.cutPlanTransfer(ja), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/callNextAssAndMomRoll")
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface MesToLmsService {
|
||||
/**
|
||||
* 分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流
|
||||
*/
|
||||
JSONObject cutPlanTransfer(JSONObject param);
|
||||
JSONObject cutPlanTransfer(JSONArray ja);
|
||||
|
||||
/**
|
||||
* 分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -533,205 +534,208 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject cutPlanTransfer(JSONObject param) {
|
||||
log.info("cutPlanTransfer接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
String orderType = param.getString("OrderType"); // 分切订单类型
|
||||
String ContainerName = param.getString("ContainerName"); // 子卷号
|
||||
String ProductName = param.getString("ProductName"); // 产品编码
|
||||
String Description = param.getString("Description"); // 产品名称
|
||||
String Warehouse = param.getString("Warehouse"); // 来源卷位置
|
||||
String ResourceName = param.getString("ResourceName"); // 分切机台编码
|
||||
String SplitGroup = param.getString("SplitGroup"); // 分切组
|
||||
String ManufactureSort = param.getString("ManufactureSort"); // 生产顺序
|
||||
String MfgOrderName = param.getString("MfgOrderName"); // 生产订单
|
||||
String ManufactureDate = param.getString("ManufactureDate"); // 生产日期
|
||||
String PaperTubeOrFRP = param.getString("PaperTubeOrFRP"); // 管件类型
|
||||
String SplitBreadth = param.getString("SplitBreadth"); // 子卷幅宽
|
||||
String SplitHeight = param.getString("SplitHeight"); // 子卷理论长度
|
||||
String SplitWeight = param.getString("SplitWeight"); // 子卷理论重量
|
||||
String Attribute2 = param.getString("Attribute2"); // 销售订单及行号
|
||||
String Attribute3 = param.getString("Attribute3"); // 上下轴
|
||||
String Attribute4 = param.getString("Attribute4"); // 位置左右
|
||||
String Attribute5 = param.getString("Attribute5"); // 是否套轴
|
||||
String Attribute6 = param.getString("Attribute6"); // 是否套轴
|
||||
public JSONObject cutPlanTransfer(JSONArray ja) {
|
||||
log.info("cutPlanTransfer接口输入参数为:-------------------" + ja.toString());
|
||||
|
||||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan");
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
try {
|
||||
// 基础校验
|
||||
if (ObjectUtil.isEmpty(orderType)) {
|
||||
throw new BadRequestException("分切订单类型不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ContainerName)) {
|
||||
throw new BadRequestException("子卷号不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ProductName)) {
|
||||
throw new BadRequestException("产品编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(Description)) {
|
||||
throw new BadRequestException("产品名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(Warehouse)) {
|
||||
throw new BadRequestException("来源卷位置不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ResourceName)) {
|
||||
throw new BadRequestException("分切机台编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitGroup)) {
|
||||
throw new BadRequestException("分切组不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ManufactureSort)) {
|
||||
throw new BadRequestException("生产顺序不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(MfgOrderName)) {
|
||||
throw new BadRequestException("生产订单不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ManufactureDate)) {
|
||||
throw new BadRequestException("生产日期不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(PaperTubeOrFRP)) {
|
||||
throw new BadRequestException("管件类型不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitBreadth)) {
|
||||
throw new BadRequestException("子卷幅宽不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitHeight)) {
|
||||
throw new BadRequestException("子卷理论长度不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitWeight)) {
|
||||
throw new BadRequestException("子卷理论重量不能为空");
|
||||
}
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject param = ja.getJSONObject(i);
|
||||
String orderType = param.getString("OrderType"); // 分切订单类型
|
||||
String ContainerName = param.getString("ContainerName"); // 子卷号
|
||||
String ProductName = param.getString("ProductName"); // 产品编码
|
||||
String Description = param.getString("Description"); // 产品名称
|
||||
String Warehouse = param.getString("Warehouse"); // 来源卷位置
|
||||
String ResourceName = param.getString("ResourceName"); // 分切机台编码
|
||||
String SplitGroup = param.getString("SplitGroup"); // 分切组
|
||||
String ManufactureSort = param.getString("ManufactureSort"); // 生产顺序
|
||||
String MfgOrderName = param.getString("MfgOrderName"); // 生产订单
|
||||
String ManufactureDate = param.getString("ManufactureDate"); // 生产日期
|
||||
String PaperTubeOrFRP = param.getString("PaperTubeOrFRP"); // 管件类型
|
||||
String SplitBreadth = param.getString("SplitBreadth"); // 子卷幅宽
|
||||
String SplitHeight = param.getString("SplitHeight"); // 子卷理论长度
|
||||
String SplitWeight = param.getString("SplitWeight"); // 子卷理论重量
|
||||
String Attribute2 = param.getString("Attribute2"); // 销售订单及行号
|
||||
String Attribute3 = param.getString("Attribute3"); // 上下轴
|
||||
String Attribute4 = param.getString("Attribute4"); // 位置左右
|
||||
String Attribute5 = param.getString("Attribute5"); // 是否套轴
|
||||
String Attribute6 = param.getString("Attribute6"); // 是否套轴
|
||||
|
||||
/* orderType
|
||||
* 1.当订单类型为1(常规)时 ParentContainerName 来源母卷号不能为空
|
||||
* 2.当订单类型为2(改制)时 RestructContainerName 改制来源子卷号、PackageBoxSN 子卷立库木箱号 不能为空
|
||||
*/
|
||||
if (StrUtil.equals(orderType, "1")) {
|
||||
if (ObjectUtil.isEmpty(param.getString("ParentContainerName"))) {
|
||||
throw new BadRequestException("来源母卷号不能为空");
|
||||
// 基础校验
|
||||
if (ObjectUtil.isEmpty(orderType)) {
|
||||
throw new BadRequestException("分切订单类型不能为空");
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(param.getString("RestructContainerName"))) {
|
||||
throw new BadRequestException("改制来源子卷号不能为空");
|
||||
if (ObjectUtil.isEmpty(ContainerName)) {
|
||||
throw new BadRequestException("子卷号不能为空");
|
||||
}
|
||||
}
|
||||
/* PaperTubeOrFRP
|
||||
* 1.当管件类型为1(纸筒)时 PaperTubeMaterial 纸筒物料编码、PaperTubeDescription 纸筒物料描述、PaperTubeModel 纸筒规格 不能为空
|
||||
* 2.当管件类型为2(FRP管)时 FRPMaterial FRP管物料编码、FRPDescription FRP管物料描述、FRPModel FRP管规格 不能为空
|
||||
*/
|
||||
String qzz_generation = "0";
|
||||
String qzz_size = "0";
|
||||
if (StrUtil.equals(PaperTubeOrFRP, "1")) {
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeMaterial"))) {
|
||||
throw new BadRequestException("纸筒物料编码不能为空");
|
||||
if (ObjectUtil.isEmpty(ProductName)) {
|
||||
throw new BadRequestException("产品编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeDescription"))) {
|
||||
throw new BadRequestException("纸筒物料描述不能为空");
|
||||
if (ObjectUtil.isEmpty(Description)) {
|
||||
throw new BadRequestException("产品名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeModel"))) {
|
||||
throw new BadRequestException("纸筒规格不能为空");
|
||||
if (ObjectUtil.isEmpty(Warehouse)) {
|
||||
throw new BadRequestException("来源卷位置不能为空");
|
||||
}
|
||||
if (param.getString("PaperTubeDescription").contains("3.12")) {
|
||||
qzz_generation = "4";
|
||||
} else if (param.getString("PaperTubeDescription").contains("3.15")) {
|
||||
qzz_generation = "5";
|
||||
if (ObjectUtil.isEmpty(ResourceName)) {
|
||||
throw new BadRequestException("分切机台编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitGroup)) {
|
||||
throw new BadRequestException("分切组不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ManufactureSort)) {
|
||||
throw new BadRequestException("生产顺序不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(MfgOrderName)) {
|
||||
throw new BadRequestException("生产订单不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ManufactureDate)) {
|
||||
throw new BadRequestException("生产日期不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(PaperTubeOrFRP)) {
|
||||
throw new BadRequestException("管件类型不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitBreadth)) {
|
||||
throw new BadRequestException("子卷幅宽不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitHeight)) {
|
||||
throw new BadRequestException("子卷理论长度不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(SplitWeight)) {
|
||||
throw new BadRequestException("子卷理论重量不能为空");
|
||||
}
|
||||
|
||||
/* orderType
|
||||
* 1.当订单类型为1(常规)时 ParentContainerName 来源母卷号不能为空
|
||||
* 2.当订单类型为2(改制)时 RestructContainerName 改制来源子卷号、PackageBoxSN 子卷立库木箱号 不能为空
|
||||
*/
|
||||
if (StrUtil.equals(orderType, "1")) {
|
||||
if (ObjectUtil.isEmpty(param.getString("ParentContainerName"))) {
|
||||
throw new BadRequestException("来源母卷号不能为空");
|
||||
}
|
||||
} else {
|
||||
qzz_generation = "4";
|
||||
if (ObjectUtil.isEmpty(param.getString("RestructContainerName"))) {
|
||||
throw new BadRequestException("改制来源子卷号不能为空");
|
||||
}
|
||||
}
|
||||
/* PaperTubeOrFRP
|
||||
* 1.当管件类型为1(纸筒)时 PaperTubeMaterial 纸筒物料编码、PaperTubeDescription 纸筒物料描述、PaperTubeModel 纸筒规格 不能为空
|
||||
* 2.当管件类型为2(FRP管)时 FRPMaterial FRP管物料编码、FRPDescription FRP管物料描述、FRPModel FRP管规格 不能为空
|
||||
*/
|
||||
String qzz_generation = "0";
|
||||
String qzz_size = "0";
|
||||
if (StrUtil.equals(PaperTubeOrFRP, "1")) {
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeMaterial"))) {
|
||||
throw new BadRequestException("纸筒物料编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeDescription"))) {
|
||||
throw new BadRequestException("纸筒物料描述不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("PaperTubeModel"))) {
|
||||
throw new BadRequestException("纸筒规格不能为空");
|
||||
}
|
||||
if (param.getString("PaperTubeDescription").contains("3.12")) {
|
||||
qzz_generation = "4";
|
||||
} else if (param.getString("PaperTubeDescription").contains("3.15")) {
|
||||
qzz_generation = "5";
|
||||
} else {
|
||||
qzz_generation = "4";
|
||||
}
|
||||
|
||||
// 解析描述数组
|
||||
String[] tubeArray = param.getString("PaperTubeDescription").split("\\|");
|
||||
// 定义尺寸与长度
|
||||
qzz_size = Character.toString(tubeArray[2].charAt(0));
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPMaterial"))) {
|
||||
throw new BadRequestException("FRP管物料编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPDescription"))) {
|
||||
throw new BadRequestException("FRP管物料描述不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPModel"))) {
|
||||
throw new BadRequestException("FRP管规格不能为空");
|
||||
}
|
||||
if (param.getString("FRPDescription").contains("3.12")) {
|
||||
qzz_generation = "4";
|
||||
} else if (param.getString("FRPDescription").contains("3.15")) {
|
||||
qzz_generation = "5";
|
||||
// 解析描述数组
|
||||
String[] tubeArray = param.getString("PaperTubeDescription").split("\\|");
|
||||
// 定义尺寸与长度
|
||||
qzz_size = Character.toString(tubeArray[2].charAt(0));
|
||||
} else {
|
||||
qzz_generation = "4";
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPMaterial"))) {
|
||||
throw new BadRequestException("FRP管物料编码不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPDescription"))) {
|
||||
throw new BadRequestException("FRP管物料描述不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(param.getString("FRPModel"))) {
|
||||
throw new BadRequestException("FRP管规格不能为空");
|
||||
}
|
||||
if (param.getString("FRPDescription").contains("3.12")) {
|
||||
qzz_generation = "4";
|
||||
} else if (param.getString("FRPDescription").contains("3.15")) {
|
||||
qzz_generation = "5";
|
||||
} else {
|
||||
qzz_generation = "4";
|
||||
}
|
||||
|
||||
// 解析描述数组
|
||||
String[] tubeArray = param.getString("FRPDescription").split("\\|");
|
||||
// 定义尺寸与长度
|
||||
qzz_size = Character.toString(tubeArray[2].charAt(0));
|
||||
}
|
||||
|
||||
// 解析描述数组
|
||||
String[] tubeArray = param.getString("FRPDescription").split("\\|");
|
||||
// 定义尺寸与长度
|
||||
qzz_size = Character.toString(tubeArray[2].charAt(0));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("order_type", orderType);
|
||||
json.put("container_name", ContainerName);
|
||||
json.put("product_name", ProductName);
|
||||
json.put("description", Description);
|
||||
json.put("parent_container_name", param.getString("ParentContainerName"));
|
||||
json.put("restruct_container_name", param.getString("RestructContainerName"));
|
||||
json.put("package_box_sn", param.getString("PackageBoxSN"));
|
||||
json.put("ware_house", Warehouse);
|
||||
json.put("resource_name", ResourceName);
|
||||
json.put("split_group", SplitGroup);
|
||||
json.put("manufacture_sort", ManufactureSort);
|
||||
json.put("mfg_order_name", MfgOrderName);
|
||||
json.put("manufacture_date", ManufactureDate);
|
||||
json.put("paper_tube_or_FRP", PaperTubeOrFRP);
|
||||
json.put("paper_tube_material", param.getString("PaperTubeMaterial"));
|
||||
json.put("paper_tube_description", param.getString("PaperTubeDescription"));
|
||||
json.put("paper_tube_model", param.getString("PaperTubeModel"));
|
||||
json.put("FRP_material", param.getString("FRPMaterial"));
|
||||
json.put("FRP_description", param.getString("FRPDescription"));
|
||||
json.put("FRP_model", param.getString("FRPModel"));
|
||||
json.put("split_breadth", SplitBreadth);
|
||||
json.put("split_height", SplitHeight);
|
||||
json.put("split_weight", SplitWeight);
|
||||
if (Attribute3.equals("U")) {
|
||||
json.put("up_or_down", "1");
|
||||
} else {
|
||||
json.put("up_or_down", "2");
|
||||
}
|
||||
if (Attribute4.equals("L")) {
|
||||
json.put("left_or_right", "1");
|
||||
} else {
|
||||
json.put("left_or_right", "2");
|
||||
}
|
||||
json.put("qzz_size", qzz_size);
|
||||
if (ResourceName.startsWith("B5") || ResourceName.startsWith("B6")) {
|
||||
json.put("is_paper_ok", "1");
|
||||
}
|
||||
if (Attribute5.equals("0")) {
|
||||
json.put("is_paper_ok", "2");
|
||||
}
|
||||
json.put("sale_order_name", Attribute2);
|
||||
json.put("material_type", Attribute6);
|
||||
json.put("start_time", DateUtil.now());
|
||||
json.put("status", "01");
|
||||
json.put("qzz_generation", qzz_generation);
|
||||
json.put("is_parent_ok", "0");
|
||||
json.put("is_child_tz_ok", "0");
|
||||
json.put("is_child_ps_ok", "0");
|
||||
json.put("is_delete", "0");
|
||||
tab.insert(json);
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("order_type", orderType);
|
||||
json.put("container_name", ContainerName);
|
||||
json.put("product_name", ProductName);
|
||||
json.put("description", Description);
|
||||
json.put("parent_container_name", param.getString("ParentContainerName"));
|
||||
json.put("restruct_container_name", param.getString("RestructContainerName"));
|
||||
json.put("package_box_sn", param.getString("PackageBoxSN"));
|
||||
json.put("ware_house", Warehouse);
|
||||
json.put("resource_name", ResourceName);
|
||||
json.put("split_group", SplitGroup);
|
||||
json.put("manufacture_sort", ManufactureSort);
|
||||
json.put("mfg_order_name", MfgOrderName);
|
||||
json.put("manufacture_date", ManufactureDate);
|
||||
json.put("paper_tube_or_FRP", PaperTubeOrFRP);
|
||||
json.put("paper_tube_material", param.getString("PaperTubeMaterial"));
|
||||
json.put("paper_tube_description", param.getString("PaperTubeDescription"));
|
||||
json.put("paper_tube_model", param.getString("PaperTubeModel"));
|
||||
json.put("FRP_material", param.getString("FRPMaterial"));
|
||||
json.put("FRP_description", param.getString("FRPDescription"));
|
||||
json.put("FRP_model", param.getString("FRPModel"));
|
||||
json.put("split_breadth", SplitBreadth);
|
||||
json.put("split_height", SplitHeight);
|
||||
json.put("split_weight", SplitWeight);
|
||||
if (Attribute3.equals("U")) {
|
||||
json.put("up_or_down", "1");
|
||||
} else {
|
||||
json.put("up_or_down", "2");
|
||||
}
|
||||
if (Attribute4.equals("L")) {
|
||||
json.put("left_or_right", "1");
|
||||
} else {
|
||||
json.put("left_or_right", "2");
|
||||
}
|
||||
json.put("qzz_size", qzz_size);
|
||||
if (ResourceName.startsWith("B5") || ResourceName.startsWith("B6")) {
|
||||
json.put("is_paper_ok", "1");
|
||||
}
|
||||
if (Attribute5.equals("0")) {
|
||||
json.put("is_paper_ok", "2");
|
||||
}
|
||||
json.put("sale_order_name", Attribute2);
|
||||
json.put("material_type", Attribute6);
|
||||
json.put("start_time", DateUtil.now());
|
||||
json.put("status", "01");
|
||||
json.put("qzz_generation", qzz_generation);
|
||||
json.put("is_parent_ok", "0");
|
||||
json.put("is_child_tz_ok", "0");
|
||||
json.put("is_child_ps_ok", "0");
|
||||
json.put("is_delete", "0");
|
||||
tab.insert(json);
|
||||
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
}
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
|
||||
log.info("cutPlanTransfer接口输出参数为:-------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user