|
|
@ -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); |
|
|
|