opt:物料基础功能优化
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package org.nl.wms.basedata.master.materialbase.service.dao;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -64,4 +67,7 @@ public class MaterialbaseProc implements Serializable {
|
||||
|
||||
private String create_time;
|
||||
|
||||
public void copyFrom(JSONObject source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.basedata.master.materialbase.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.MaterialbaseProc;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
public interface MaterialbaseProcMapper extends BaseMapper<MaterialbaseProc> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseProcMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -9,13 +9,11 @@ import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.IBstIvtScaleboundService;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.IBstIvtScalehistoryService;
|
||||
@@ -26,7 +24,6 @@ import org.nl.b_lms.pdm.info.dao.PdmBiContainerinfo;
|
||||
import org.nl.b_lms.pdm.info.dao.PdmBiOrderbominfo;
|
||||
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
|
||||
import org.nl.b_lms.pdm.info.service.IPdmBiOrderbominfoService;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.tasks.ProcessTask;
|
||||
@@ -45,6 +42,8 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.Materialbase;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseMapper;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.nl.wms.pda.mps.service.InService;
|
||||
@@ -57,7 +56,6 @@ import org.nl.wms.st.instor.service.impl.ProductScrapServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -101,7 +99,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MaterialbaseMapper materialbaseMapper;
|
||||
/**
|
||||
* 生箔烘箱:
|
||||
* 母卷批次创建信息发送智能物流(MES生箔工序Move In)
|
||||
@@ -819,8 +818,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
throw new BadRequestException("未查询到母卷:" + parent_container_name + ",对应的生箔信息!");
|
||||
}
|
||||
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
LambdaQueryWrapper<Materialbase> lamater = new LambdaQueryWrapper<Materialbase>();
|
||||
lamater.eq(Materialbase::getMaterial_code,raw_jo.getString("product_name"));
|
||||
lamater.eq(Materialbase::getIs_delete,"0");
|
||||
Materialbase materialbase = materialbaseMapper.selectOne(lamater);
|
||||
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + ",信息!");
|
||||
}
|
||||
|
||||
@@ -856,7 +859,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
||||
jsonCool.put("io_type", "1");
|
||||
jsonCool.put("material_id", mater_jo.getString("material_id"));
|
||||
jsonCool.put("material_id", materialbase.getMaterial_id());
|
||||
jsonCool.put("pcsn", parent_container_name);
|
||||
jsonCool.put("bill_status", "50");
|
||||
jsonCool.put("task_id", task_id);
|
||||
@@ -906,16 +909,20 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
JSONArray rows = new JSONArray();
|
||||
JSONObject dtl = new JSONObject();
|
||||
//查询该物料
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
LambdaQueryWrapper<Materialbase> lamater = new LambdaQueryWrapper<Materialbase>();
|
||||
lamater.eq(Materialbase::getMaterial_code,sub_jo.getString("product_name"));
|
||||
lamater.eq(Materialbase::getIs_delete,"0");
|
||||
Materialbase materialbase = materialbaseMapper.selectOne(lamater);
|
||||
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
|
||||
}
|
||||
dtl.put("material_id", mater_jo.getString("material_id"));
|
||||
dtl.put("material_id", materialbase.getMaterial_id());
|
||||
dtl.put("pcsn", plan_jo.getString("restruct_container_name"));
|
||||
dtl.put("box_no", package_box_sn);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + materialbase.getBase_unit_id() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
|
||||
throw new BadRequestException("未查询到物料计量单位:" + materialbase.getBase_unit_id() + ",信息!");
|
||||
}
|
||||
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
|
||||
dtl.put("qty_unit_name", unit.getString("unit_name"));
|
||||
@@ -969,6 +976,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
throw new BadRequestException("分切计划对应的分切机不存在:" + ResourceName);
|
||||
}
|
||||
if ("0".equals(cut_jo.getString("is_used"))) {
|
||||
//1-进站
|
||||
if ("1".equals(Status)) {
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
@@ -1017,7 +1025,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
plan_jo.put("is_child_ps_ok", "1");
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
|
||||
@@ -1096,7 +1105,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
}
|
||||
|
||||
//出站
|
||||
if ("2".equals(Status)) {
|
||||
JSONObject jsonObject = param.getJSONObject(0);
|
||||
JSONObject plan = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + jsonObject.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
|
||||
@@ -1124,6 +1133,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
|
||||
}
|
||||
String qzzno = plan_jo.getString("qzzno");
|
||||
//是否下轴
|
||||
String need_down = row.getString("Attribute1");
|
||||
if (StrUtil.isEmpty(need_down)) {
|
||||
throw new BadRequestException("子卷:" + row.getString("ContainerGroup") + "对应的是否需要下轴字段不能为空!");
|
||||
@@ -1492,11 +1502,17 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
change_jo.put("changeinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
change_jo.put("changeinv_id", changeinv_id);
|
||||
change_jo.put("seq_no", detail_count + 1);
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + container_row.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
|
||||
//查询物料
|
||||
LambdaQueryWrapper<Materialbase> lamater = new LambdaQueryWrapper<Materialbase>();
|
||||
lamater.eq(Materialbase::getMaterial_code,container_row.getString("product_name"));
|
||||
lamater.eq(Materialbase::getIs_delete,"0");
|
||||
Materialbase materialbase = materialbaseMapper.selectOne(lamater);
|
||||
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
throw new BadRequestException("物料不存在:" + container_row.getString("product_name"));
|
||||
}
|
||||
change_jo.put("material_id", mater_jo.getString("material_id"));
|
||||
change_jo.put("material_id", materialbase.getMaterial_id());
|
||||
change_jo.put("pcsn", container_row.getString("container_name"));
|
||||
change_jo.put("package_box_sn", container_row.getString("package_box_sn"));
|
||||
change_jo.put("mfg_order_name", SaleOrderItem);
|
||||
@@ -1515,11 +1531,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
|
||||
change_jo.put("isUnPackBox", isUnPackBox);
|
||||
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + materialbase.getBase_unit_id() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("计量单位不存在:" + mater_jo.getString("base_unit_id"));
|
||||
throw new BadRequestException("计量单位不存在:" + materialbase.getBase_unit_id());
|
||||
}
|
||||
change_jo.put("qty_unit_id", mater_jo.getString("base_unit_id"));
|
||||
change_jo.put("qty_unit_id", materialbase.getBase_unit_id());
|
||||
change_jo.put("qty_unit_name", unit.getString("unit_name"));
|
||||
change_jo.put("qty", container_row.getString("net_weight"));
|
||||
WQLObject.getWQLObject("ST_IVT_StructIvtChangeDtl").insert(change_jo);
|
||||
|
||||
@@ -6,19 +6,21 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseProcMapper;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.Materialbase;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.MaterialbaseProc;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseMapper;
|
||||
import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseProcMapper;
|
||||
import org.nl.wms.ext.sap.service.SapToLmsService;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||
import org.nl.wms.st.instor.service.RecutPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -36,6 +38,13 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
|
||||
private final RecutPlanService recutPlanService;
|
||||
|
||||
@Autowired
|
||||
private MaterialbaseMapper materialbaseMapper;
|
||||
|
||||
@Autowired
|
||||
private MaterialbaseProcMapper materialbaseProcMapper;
|
||||
|
||||
|
||||
public JSONObject getReCutInfo2(JSONObject json) {
|
||||
log.info("getReCutInfo的输入参数为:------------------------" + json.toString());
|
||||
|
||||
@@ -275,47 +284,52 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
if (StrUtil.isEmpty(MATNR)) {
|
||||
throw new BadRequestException("物料编码不能为空!");
|
||||
}
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbaseproc").query("MATNR ='" + MATNR + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
row.put("id",IdUtil.getSnowflake(1, 1).nextId());
|
||||
row.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("md_me_materialbaseproc").insert(row);
|
||||
LambdaQueryWrapper<MaterialbaseProc> lam = new LambdaQueryWrapper<MaterialbaseProc>();
|
||||
lam.eq(MaterialbaseProc::getMATNR,MATNR);
|
||||
MaterialbaseProc materialbaseProc = materialbaseProcMapper.selectOne(lam);
|
||||
|
||||
if (ObjectUtil.isEmpty(materialbaseProc)) {
|
||||
materialbaseProc = new MaterialbaseProc();
|
||||
materialbaseProc.copyFrom(row);
|
||||
materialbaseProc.setId(IdUtil.getSnowflake(1, 1).nextId()+"");
|
||||
materialbaseProc.setCreate_time(DateUtil.now());
|
||||
materialbaseProcMapper.insert(materialbaseProc);
|
||||
} else {
|
||||
row.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("md_me_materialbaseproc").update(row);
|
||||
materialbaseProc.setCreate_time(DateUtil.now());
|
||||
materialbaseProcMapper.updateById(materialbaseProc);
|
||||
}
|
||||
|
||||
JSONObject base_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + MATNR + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(base_jo)) {
|
||||
JSONObject mater_base_jo = new JSONObject();
|
||||
mater_base_jo.put("material_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
mater_base_jo.put("material_code", MATNR);
|
||||
mater_base_jo.put("material_name", MATNR01);
|
||||
LambdaQueryWrapper<Materialbase> lamater = new LambdaQueryWrapper<Materialbase>();
|
||||
lamater.eq(Materialbase::getMaterial_code,MATNR);
|
||||
lamater.eq(Materialbase::getIs_delete,"0");
|
||||
Materialbase materialbase = materialbaseMapper.selectOne(lamater);
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
materialbase = new Materialbase();
|
||||
materialbase.setMaterial_id( IdUtil.getSnowflake(1, 1).nextId()+"");
|
||||
materialbase.setMaterial_code(MATNR);
|
||||
materialbase.setMaterial_name(MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + MEINS + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
mater_base_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
mater_base_jo.put("create_id", "1");
|
||||
mater_base_jo.put("create_name", "管理员");
|
||||
mater_base_jo.put("create_time", DateUtil.now());
|
||||
mater_base_jo.put("update_optid", "1");
|
||||
mater_base_jo.put("update_optname", "管理员");
|
||||
mater_base_jo.put("update_time", DateUtil.now());
|
||||
mater_base_jo.put("is_used", "1");
|
||||
mater_base_jo.put("is_delete", "0");
|
||||
WQLObject.getWQLObject("md_me_materialbase").insert(mater_base_jo);
|
||||
materialbase.setBase_unit_id(unit.getString("measure_unit_id"));
|
||||
materialbase.setCreate_id("1");
|
||||
materialbase.setCreate_name("管理员");
|
||||
materialbase.setCreate_time(DateUtil.now());
|
||||
materialbase.setIs_used("1");
|
||||
materialbase.setIs_delete("0");
|
||||
materialbaseMapper.insert(materialbase);
|
||||
} else {
|
||||
base_jo.put("material_name", MATNR01);
|
||||
materialbase.setMaterial_name(MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + MEINS + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
base_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
base_jo.put("update_optid", "1");
|
||||
base_jo.put("update_optname", "管理员");
|
||||
base_jo.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("md_me_materialbase").update(base_jo);
|
||||
materialbase.setBase_unit_id(unit.getString("measure_unit_id"));
|
||||
materialbase.setUpdate_id("1");
|
||||
materialbase.setUpdate_name("管理员");
|
||||
materialbase.setUpdate_time(DateUtil.now());
|
||||
materialbaseMapper.updateById(materialbase);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface InService {
|
||||
JSONObject queryMaterialInfo(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 出站确认
|
||||
* 子卷入站
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
|
||||
@@ -76,6 +76,7 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
//切输送线点位库存表
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
|
||||
|
||||
@@ -158,6 +158,9 @@ export default {
|
||||
],
|
||||
material_name: [
|
||||
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
base_unit_id: [
|
||||
{ required: true, message: '单位不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user