Merge remote-tracking branch 'origin/master'

master
shaoyong 10 months ago
commit 8c658b1e46

@ -28,6 +28,9 @@ public interface RemoteSapService {
@PostMapping("/sap/shopUpdateSync")
public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder);
@PostMapping("/sap/shopOrderBomUpdate")
public R shopOrderBomUpdate(@RequestBody(required = false) List<Map<String, Object>> mapList);
@PostMapping("/sap/sapRouterSync")
public R<Boolean> sapRouterSync(@RequestBody SapRouterQuery sapRouterQuery);

@ -166,6 +166,16 @@ public class SapBaseProduct extends BaseEntity {
@Excel(name = "补料比例")
private String appendPercent;
private String meins;
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public void setProductId(String productId) {
this.productId = productId;
}

@ -79,6 +79,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("sap shopUpdateSync失败" + throwable.getMessage());
}
@Override
public R shopOrderBomUpdate(List<Map<String, Object>> mapList) {
return R.fail("sap shopOrderBomUpdate失败" + throwable.getMessage());
}
@Override
public R sapBackflushMP(List<SapBackflushMPQuery> sapBackflushMPQueryList) {
return R.fail("反冲物料领料过账失败" + throwable.getMessage());

@ -456,6 +456,17 @@ public class MesReportWorkController extends BaseController {
public List<MesPrepareDetailDTO> getNewPrepareData(@RequestBody MesPrepareDetail mesPrepareDetail) {
return mesReportWorkService.getNewPrepareData(mesPrepareDetail);
}
/**删除新增的报工物料组成**/
@DeleteMapping("/deleteBomRowNow/{id}")
public AjaxResult deleteBomRowNow(@PathVariable String id) {
return toAjax(mesReportWorkService.deleteBomRowNow(id));
}
//获取仓库下拉列表
@GetMapping("/getWarehouseList")
public List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume) {
List<MesReportWorkConsume> rlist = mesReportWorkService.getWarehouseList(workConsume);
return rlist;
}
}

@ -109,6 +109,25 @@ public class MesReportWorkConsume extends BaseEntity {
private String pMaterialCode;
private String workorderCodeSap;
private String warehouseCode;
private String warehouseName;
public String getWarehouseCode() {
return warehouseCode;
}
public void setWarehouseCode(String warehouseCode) {
this.warehouseCode = warehouseCode;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getWorkorderCodeSap() {
return workorderCodeSap;
}

@ -79,4 +79,6 @@ public interface MesReportWorkConsumeMapper {
List<MesReportWorkConsume> getSonConsumeList(MesReportWorkConsume mesReportWorkConsume);
List<MesReportWorkConsume> getBomList(MesReportWorkConsume mesReportWorkConsume);
MesReportWorkConsume getNewConsumeInfo(String workorderCode);
}

@ -137,5 +137,9 @@ public interface MesReportWorkMapper {
ProOrderWorkorder getSonWorkOrder(String workorderCode);
public MesReportWork getReportWorkHz1(MesReportWork mesReportWork);
int deleteBomRowNow(String id);
List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume);
List<MesReportWorkConsume> getUpdateAttr1Boms(MesReportWork workorderCode);
}

@ -111,4 +111,8 @@ public interface IMesReportWorkService {
List<MesReportWorkTabs> getAllLevelReportList(MesReportWork mesReportWork);
List<MesPrepareDetailDTO> getNewPrepareData(MesPrepareDetail mesPrepareDetail);
int deleteBomRowNow(String id);
List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume);
}

@ -306,26 +306,29 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
*
* * ----------------------------------------
* *
* * =
* * = *
* * =sumpc
* * =sum()
* * = sum*
* * =
* * =
* * ----------------------------------------
* *
* * =sum()
* * = *
* * =sumpc
* * =sum()
* * = sum(*)线
* * =
* * =
* * <p>
* *
* * =sum()
* * = 4*sum()
* * =sumpc
* * =sum()
* * = 4*sum() 4
* * =
* * =
* * ----------------------------------------
* *
* * =
* * =
* * =sum()
* * = sum(*)
* * =
* * =
* @param mesReportWork
@ -343,19 +346,28 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
if (CollectionUtils.isEmpty(workOrders)) {
return R.fail("子母工单信息缺失");
}
/**修改sap物料损耗组成**/
R updateBomsSap = this.updateAttr1BomsSap(workOrders);
if(updateBomsSap.getCode()== 500){
return updateBomsSap;
}
R sapRson = null;
if(workOrders.size()==1){
/**(一层报工)工单报工**/
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode());
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz1(mesReportWork);
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(sHzWorks==null){
return R.fail("未查询到一层报工单");
}
//机器=sum(工时数) 【设备开机时间】 Sac1
//人工 = sum每批的工时数*每批用人数) Sac2
//子工单报工
logger.info("==========================一层工单报工开始");
sapRson = this.reportHzToSap(sHzWorks,1);
sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================一层工单报工结束:"+JSONObject.toJSONString(sapRson));
}else if(workOrders.size()==2){
/**(两层报工)子工单先报工,然后母工单报工**/
@ -368,7 +380,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
}
//子工单报工
logger.info("==========================子工单报工开始");
sapRson = this.reportHzToSap(sHzWorks,2);
sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================子工单报工结束:"+JSONObject.toJSONString(sapRson));
if(sapRson.getCode()== 200){
//一定是子单报工成功返回后,再母单报工
@ -385,25 +397,32 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
//母工单报工
logger.info("==========================母工单报工开始");
pHzWork.setQuantityFeedback(sHzWorks.getQuantityFeedback());
pHzWork.setSac2("4");//母单报工固定值
R sapR = this.reportHzToSap(pHzWork,2);
//pHzWork.setSac2("4");//母单报工固定值(上位机插入数据时候默认4)
R sapR = this.reportHzToSap(pHzWork);
logger.info("==========================母工单报工结束"+JSONObject.toJSONString(sapR));
return sapR;
}
}else if(workOrders.size()>=3){
for(MesReportWork workOrder:workOrders){
MesReportWork hzWorks = null;
for(int n=0;n<workOrders.size();n++){
MesReportWork workOrder = workOrders.get(n);
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(workOrder.getWorkorderCode());
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz1(mesReportWork);
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if (sHzWorks == null) {
return R.fail(workOrder.getWorkorderCode()+"未查询到报工单");
}
if(n==0){
hzWorks = sHzWorks;
}
//三层以上工单报工
logger.info("==========================三层以上工单("+sHzWorks.getWorkorderCodeSap()+")报工开始");
sapRson = this.reportHzToSap(sHzWorks,3);
logger.info("==========================三层以上工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:"
logger.info("==========================三层(第"+n+"层)以上工单("+sHzWorks.getWorkorderCodeSap()+")报工开始");
sHzWorks.setQuantityFeedback(hzWorks.getQuantityFeedback());
sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================三层(第"+n+"层)以上工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:"
+ JSONObject.toJSONString(sapRson));
if (sapRson.getCode() == 200) {
try {
@ -421,31 +440,48 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
}
return sapRson;
}
//修改报工物料组成
private R updateAttr1BomsSap(List<MesReportWork> workOrderCodes) {
//是否有变动的物料损耗组成
List<MesReportWorkConsume> updateBoms = mesReportWorkMapper.getUpdateAttr1Boms(workOrderCodes.get(workOrderCodes.size()-1));
if(!CollectionUtils.isEmpty(updateBoms)){
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> mapBom = null;
for(MesReportWorkConsume updateBom:updateBoms){
mapBom = new HashMap<String, Object>();
mapBom.put("P_AUFNR",updateBom.getWorkorderCodeSap());// 订单号 例如000100308287
mapBom.put("P_MATNR",updateBom.getMaterialCode());// 物料号 例如000000040000015089
mapBom.put("P_GMEIN",updateBom.getUnit());// 基本计量单位 例如m
mapBom.put("P_WERKS",workOrderCodes.get(0).getFactoryCode());//物料工厂 例如1000
mapBom.put("P_LGORT",updateBom.getWarehouseCode());//仓库编号 例如0013
mapList.add(mapBom);
}
logger.info(workOrderCodes.get(workOrderCodes.size()-1).getWorkorderCode()
+ "报工损耗物料组件修改请求:" + JSONObject.toJSONString(mapList));
R bomUpdateR = remoteSapService.shopOrderBomUpdate(mapList);
logger.info(workOrderCodes.get(workOrderCodes.size()-1).getWorkorderCode()
+ "报工损耗物料组件修改结果:" + JSONObject.toJSONString(bomUpdateR));
return bomUpdateR;
}
return R.ok();
}
/**
*
* @param workOrder
* @return
*/
private R reportHzToSap(MesReportWork workOrder,int cengji) {
private R reportHzToSap(MesReportWork workOrder) {
Date nowTime = DateUtils.getNowDate();
SapRFW sapRFW = new SapRFW();
sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号
sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量
SapRFW.lt_gs ltgs = new SapRFW.lt_gs();//生产订单报工工时修改
ltgs.setConf_activity1(workOrder.getSac1());//机器
BigDecimal newMan = null;
if(cengji == 3){
//订单是三层的情况
newMan = new BigDecimal(workOrder.getSac2());
}else{
//订单是一层、二层的情况
newMan = new BigDecimal(workOrder.getSac1())
.multiply(new BigDecimal(workOrder.getSac2()));
}
ltgs.setConf_activity2(newMan.toString());//人工
ltgs.setConf_activity2(workOrder.getSac2());//人工
ltgs.setConf_activity3(workOrder.getSac1());//折旧
ltgs.setConf_activity4(newMan.toString());//其它
ltgs.setConf_activity4(workOrder.getSac2());//其它
// ltgs.setConf_activity5(workOrder.getSac5());
// ltgs.setConf_activity6(workOrder.getSac6());
sapRFW.setLt_gs(ltgs);
@ -481,6 +517,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
mesReportWorkMapper.updateSyncSapStatus(workOrder);
return r;
// return R.ok();//测试
}

@ -1,10 +1,8 @@
package com.op.mes.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
@ -16,6 +14,7 @@ import com.op.mes.mapper.MesReportWorkMapper;
import com.op.system.api.domain.dto.BaseBomDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.mes.BaseTeamTDTO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -171,7 +170,36 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer
mesReportWorkConsume.setUpdateTime(nowTime);
mesReportWorkConsume.setUpdateBy(updateBy);
}
return mesReportWorkConsumeMapper.submitConsumePS(mesReportWorkConsumes);
List<MesReportWorkConsume> updates = mesReportWorkConsumes
.stream()
.filter(u -> u.getCreateTime()!=null).collect(Collectors.toList());
List<MesReportWorkConsume> adds = mesReportWorkConsumes
.stream()
.filter(u -> u.getCreateTime()==null).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(adds)){
Map<String,MesReportWorkConsume> consumeInfoMap = new HashMap<>();
for(MesReportWorkConsume add:adds){
MesReportWorkConsume newConsumeInfo = consumeInfoMap.get(add.getWorkorderCode());
if(newConsumeInfo==null){
MesReportWorkConsume mapItem = mesReportWorkConsumeMapper.getNewConsumeInfo(add.getWorkorderCode());
consumeInfoMap.put(add.getWorkorderCode(),mapItem);
}
newConsumeInfo = consumeInfoMap.get(add.getWorkorderCode());
add.setRecordId(IdUtils.fastSimpleUUID());
add.setReportCode(newConsumeInfo.getReportCode());
add.setWorkorderCode(newConsumeInfo.getWorkorderCode());
add.setCreateTime(nowTime);
add.setCreateTime(nowTime);
add.setAttr1("1");//新增标识
add.setParentOrder(newConsumeInfo.getParentOrder());
}
int addNum =mesReportWorkConsumeMapper.addConsumePS(adds);
System.out.println("addNum:"+addNum);
}
int updateNum =mesReportWorkConsumeMapper.submitConsumePS(updates);
System.out.println("addNum:"+updateNum);
return updateNum;
}
@Override

@ -237,6 +237,18 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return details;
}
@Override
@DS("#header.poolName")
public int deleteBomRowNow(String id) {
return mesReportWorkMapper.deleteBomRowNow(id);
}
@Override
@DS("#header.poolName")
public List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume) {
return mesReportWorkMapper.getWarehouseList(workConsume);
}
@Override
@DS("#header.poolName")
public int submitReportPS(List<MesReportWork> mesReportWorks) {
@ -550,6 +562,8 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return dtos;
}
public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();

@ -66,26 +66,25 @@
where record_id = #{recordId}
</select>
<select id="getMesListBom" resultType="com.op.system.api.domain.dto.BaseBomDTO">
select bbc.component,
bbc.component_unit unit,
bp.product_desc_zh componentName,
bp.product_group productGroup,
bp.product_group_name productGroupName
from base_bom_component bbc
left join base_product bp on SUBSTRING(bp.product_code, 8, 12) = bbc.component
left join mes_report_work_consume wc on wc.material_code = bbc.component and wc.workorder_code =
#{workorderCode}
where bbc.product_code = SUBSTRING(#{productCode}, 8, 12)
and bp.del_flag = '0' and wc.material_code is null
<if test="component != null and component != ''">and bbc.component like concat('%', #{component}, '%')</if>
<if test="componentName != null and componentName != ''">bp.product_desc_zh like concat('%', #{componentName},
'%')
select
bp.product_code component,
bp.product_desc_zh componentName,
bp.product_group productGroup,
bp.product_group_name productGroupName,
bp.meins unit
from base_product bp
where bp.del_flag = '0'
<if test="component != null and component != ''">
and bp.product_code like concat('%', #{component},'%')
</if>
<if test="componentName != null and componentName != ''">
and bp.product_desc_zh like concat('%', #{componentName},'%')
</if>
<if test="productGroup != null and productGroup != ''">and bp.product_group like concat('%', #{productGroup},
'%')
<if test="productGroup != null and productGroup != ''">
and bp.product_group like concat('%', #{productGroup},'%')
</if>
<if test="productGroupName != null and productGroupName != ''">and bp.product_group_name like concat('%',
#{productGroupName}, '%')
<if test="productGroupName != null and productGroupName != ''">
and bp.product_group_name like concat('%',#{productGroupName}, '%')
</if>
</select>
<select id="getTeamList" resultType="com.op.system.api.domain.mes.BaseTeamTDTO">
@ -103,12 +102,14 @@
mrwc.unit,
mrwc.create_time createTime,
mrwc.recoil,
pow.workorder_code_sap workorderCodeSap
pow.workorder_code_sap workorderCodeSap,
mrwc.attr1,
mrwc.warehouse_code warehouseCode
from mes_report_work_consume mrwc
left join pro_order_workorder pow on mrwc.workorder_code = pow.workorder_code
where mrwc.del_flag = '0' and pow.del_flag = '0'
and mrwc.workorder_code = #{workorderCode}
order by mrwc.recoil
order by mrwc.recoil,mrwc.attr1
</select>
<select id="getSonConsumeList" resultType="com.op.mes.domain.MesReportWorkConsume">
select mrwc.record_id recordId,
@ -143,6 +144,13 @@
<if test='parentOrder=="0"'>mrw.workorder_code = #{workorderCode}</if>
<if test='parentOrder!="0"'>mrw.parent_order = #{workorderCode}</if>
</select>
<select id="getNewConsumeInfo" resultType="com.op.mes.domain.MesReportWorkConsume">
select top 1 report_code reportCode,
workorder_code workorderCode,
parent_order parentOrder
from mes_report_work_consume
where workorder_code = #{workorderCode} and del_flag = '0'
</select>
<insert id="insertMesReportWorkConsume" parameterType="MesReportWorkConsume">
insert into mes_report_work_consume
@ -203,13 +211,15 @@
(
record_id,report_code,workorder_code,
material_code,material_name,quantity,unit,
create_by,create_time,parent_order,recoil
create_by,create_time,parent_order,recoil,
warehouse_code,warehouse_name
)values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.recordId},#{item.reportCode},#{item.workorderCode},
#{item.materialCode},#{item.materialName},#{item.quantity},#{item.unit},
#{item.createBy},#{item.createTime},#{item.parentOrder},#{item.recoil}
#{item.createBy},#{item.createTime},#{item.parentOrder},#{item.recoil},
#{item.warehouseCode},#{item.warehouseName}
)
</foreach>
</insert>
@ -243,7 +253,9 @@
set
quantity = #{item.quantity},
update_by = #{item.updateBy},
update_time = #{item.updateTime}
update_time = #{item.updateTime},
warehouse_code = #{item.warehouseCode},
warehouse_name = #{item.warehouseName}
where
record_id = #{item.recordId}
</foreach>

@ -472,7 +472,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getSapWorkOrder" resultType="com.op.mes.domain.MesReportWork">
select workorder_code_sap workorderCodeSap,
workorder_code workorderCode
workorder_code workorderCode,
factory_code factoryCode
from pro_order_workorder
where belong_work_order = #{workorderCode} and del_flag = '0' <!--and status = 'w2'-->
order by order_code
@ -480,7 +481,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getReportWorkHzList" resultType="com.op.mes.domain.MesReportWork">
select mrw.workorderCode,mrw.productCode,mrw.productName,mrw.machineCode,mrw.machineName,
mrw.shiftCode,mrw.quantityFeedback,
mrw.workTime,mrw.useMan,mrw.uploadStatus,mrw.unit,
mrw.workTime,mrw.uploadStatus,mrw.unit,
pow.order_code orderCode,pow.quantity_split quantity,
pow.workorder_code_sap workorderCodeSap,
pow.product_date productDate,
@ -495,7 +496,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
shift_code shiftCode,
sum(quantity_feedback) quantityFeedback,
sum(work_time) workTime,
use_man useMan,
upload_status uploadStatus,
upload_time uploadTime,
upload_msg uploadMsg,
@ -510,7 +510,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="machineName != null and machineName != ''"> and machine_name like concat('%', #{machineName}, '%')</if>
<if test="uploadStatus != null and uploadStatus != ''"> and upload_status = #{uploadStatus}</if>
group by workorder_code, product_code,product_name,machine_code,machine_name,shift_code
,upload_status,unit,use_man
,upload_status,unit
,upload_time,upload_msg
) mrw
left join pro_order_workorder pow on mrw.workorderCode = pow.workorder_code
@ -581,45 +581,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
workorder_code,
sum(quantity_feedback) quantity_feedback,
sum(work_time) sac1,
use_man sac2,
sum(work_time*use_man) sac2,
product_code,
product_name
from
mes_report_work
where upload_status != #{uploadStatus} and prod_type = #{prodType}
and workorder_code = #{workorderCode}
group by workorder_code,product_code,product_name,use_man
group by workorder_code,product_code,product_name
) mrw
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
left join base_equipment equ on equ.equipment_code = ow.workorder_name
</select>
<select id="getReportWorkHz1" resultType="com.op.mes.domain.MesReportWork">
select
ow.workorder_code workorderCode,
ow.workorder_code_sap workorderCodeSap,
mrw.quantity_feedback quantityFeedback,
mrw.product_code productCode,
mrw.product_name productName,
mrw.sac1,
mrw.sac2,
equ.sap_code sapCode
from (
select
workorder_code,
sum(quantity_feedback) quantity_feedback,
sum(work_time) sac1,
use_man sac2,
product_code,
product_name
from
mes_report_work
where upload_status != #{uploadStatus} and prod_type = #{prodType}
and workorder_code = #{workorderCode}
group by workorder_code,product_code,product_name,use_man
) mrw
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
left join base_equipment equ on equ.equipment_code = ow.workorder_name
</select>
<select id="getEndReport" resultType="com.op.mes.domain.MesReportWork">
select end_report endReport
from mes_report_work
@ -699,6 +672,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where parent_order = #{workorderCode}
and del_flag='0'
</select>
<select id="getWarehouseList" resultType="com.op.mes.domain.MesReportWorkConsume">
select warehouse_code warehouseCode,
warehouse_name warehouseName
from base_warehouse
where active_flag = '1' and del_flag = '0'
</select>
<select id="getUpdateAttr1Boms" resultType="com.op.mes.domain.MesReportWorkConsume">
select mrwc.material_code materialCode,
mrwc.material_name materialName,
mrwc.unit,
mrwc.workorder_code workorderCode,
pow.workorder_code_sap workorderCodeSap,
mrwc.warehouse_code warehouseCode
from mes_report_work_consume mrwc
left join pro_order_workorder pow on mrwc.workorder_code = pow.workorder_code
where mrwc.attr1 = '1' and mrwc.del_flag = '0'
and mrwc.parent_order = #{workorderCode}
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work
@ -896,4 +887,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteBomRowNow" parameterType="String">
update mes_report_work_consume
set del_flag = '1'
where record_id = #{id}
</delete>
</mapper>

@ -4,12 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.op.common.core.exception.ServiceException;
import com.op.plan.domain.ProOrder;
import com.op.plan.domain.dto.SplitOrderDTO;
import com.op.plan.service.IProWetMaterialPlanDetailService;
import com.op.plan.service.IProWetMaterialPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -40,8 +42,6 @@ import com.op.common.core.web.page.TableDataInfo;
public class ProOrderWorkorderController extends BaseController {
@Autowired
private IProOrderWorkorderService proOrderWorkorderService;
@Autowired
private IProWetMaterialPlanDetailService proWetMaterialPlanDetailService;
/**
* code
@ -255,6 +255,10 @@ public class ProOrderWorkorderController extends BaseController {
@Log(title = "下发生产工单", businessType = BusinessType.OTHER)
@PostMapping("/downWorkorder/{workorderIds}")
public AjaxResult downWorkorder(@PathVariable String[] workorderIds) {
List<String> orderNotW0 = proOrderWorkorderService.getOrderNotW0(workorderIds);
if(workorderIds.length != orderNotW0.size()){
return AjaxResult.error("存在已经派发的订单,请重新选择工单!");
}
return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds));
}
}

@ -152,6 +152,16 @@ public class ProOrder extends TreeEntity {
private Integer sortNo;
// 车数
private Integer carNum;
@Excel(name = "订单状态", readConverterExp = "0=正常,1=关闭")
private String delFlag;
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public Integer getCarNum() {
return carNum;

@ -190,5 +190,7 @@ public interface ProOrderWorkorderMapper {
int deletePrepareBatch(@Param("workorders")List<String> workorders);
int deletePrepareDetailBatch(@Param("workorders")List<String> workorders);
List<String> getOrderNotW0(@Param("workorderCodes") String[] workorderCodes);
}

@ -131,4 +131,6 @@ public interface IProOrderWorkorderService {
List<ProOrderWorkorder> getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder);
AjaxResult subChangeWorkOrderPro(SplitOrderDTO splitOrderDTO);
List<String> getOrderNotW0(String[] workorderIds);
}

@ -100,15 +100,15 @@ public class ProOrderServiceImpl implements IProOrderService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult subSplitOrder(SplitOrderDTO splitOrderDTO) {
boolean checkout = true;
// 校验批次编号是否存在(重复问题)
List<String> batchCodes = proOrderMapper.selectBatchCodes();
for (int i = 0; i < batchCodes.size(); i++) {
for (int j = 0; j < splitOrderDTO.getFormFields().size(); j++) {
if (batchCodes.get(i).equals(splitOrderDTO.getFormFields().get(j).getBatchCode())) {
checkout = false;
}
}
}
// // 校验批次编号是否存在(重复问题)
// List<String> batchCodes = proOrderMapper.selectBatchCodes();//这种校验不可取需要修改
// for (int i = 0; i < batchCodes.size(); i++) {
// for (int j = 0; j < splitOrderDTO.getFormFields().size(); j++) {
// if (batchCodes.get(i).equals(splitOrderDTO.getFormFields().get(j).getBatchCode())) {
// checkout = false;
// }
// }
// }
//校验各工序设备是否已选择
List<CascaderDTO> processes= proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode());
if(splitOrderDTO.getProdLineCodeArray().length == 0){
@ -134,7 +134,7 @@ public class ProOrderServiceImpl implements IProOrderService {
splitOrderDTO.setProdLineCode(codeArray);
}
// 如果不重复
// 如果校验通过
if (checkout) {
/****白坯订单*****/
@ -270,6 +270,7 @@ public class ProOrderServiceImpl implements IProOrderService {
// 获取单位换算值
Long conver = 1L;
String belongWorkOrder = "0";
ProOrderDTO productNameInfo = splitOrderDTO.getProduct();
while (run) {
// 先进行当前订单拆分操作
// 1.设置工单信息,并更新订单信息至数据库
@ -297,10 +298,10 @@ public class ProOrderServiceImpl implements IProOrderService {
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg());
}else{
workOrder.setProductCode(splitOrderDTO.getProduct().getChildren().get(0).getProdCode());
workOrder.setProductName(splitOrderDTO.getProduct().getChildren().get(0).getProdDesc());
}
workOrder.setProductCode(productNameInfo.getProdCode());
workOrder.setProductName(productNameInfo.getProdDesc());
workOrder.setBelongWorkOrder(belongWorkOrder);
workOrder.setProdType("LJ01");
@ -321,6 +322,8 @@ public class ProOrderServiceImpl implements IProOrderService {
parentOrder.append(workOrder.getWorkorderCode());
// code自增
endCode++;
productNameInfo = productNameInfo.getChildren().get(0);
} else {
if(!"0".equals(workOrder.getParentOrder())) {
// 设置子节点end_flag字段信息

@ -1092,6 +1092,12 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return error(500, "批次号不能重复");
}
@Override
@DS("#header.poolName")
public List<String> getOrderNotW0(String[] workorderIds) {
return proOrderWorkorderMapper.getOrderNotW0(workorderIds);
}
/**
*
* 湿

@ -30,13 +30,14 @@
<result property="prodType" column="prod_type"/>
<result property="prodSpc" column="prod_spc"/>
<result property="carNum" column="car_num"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectProOrderVo">
select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split,
unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3,
status, parent_order, create_by, create_time, update_by, update_time, prod_type,
factory_code, prod_spc ,car_num
factory_code, prod_spc ,car_num,del_flag
from pro_order
</sql>
@ -67,7 +68,7 @@
<if test="planDateStart != null ">and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}'</if>
<if test="planDateEnd != null ">and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120)</if>
and prod_type != 'white'
and del_flag = '0'
<if test="delFlag != null and delFlag != ''">and del_flag = #{delFlag}</if>
</where>
ORDER BY plan_pro_date DESC
</select>

@ -523,6 +523,17 @@
and pow.del_flag = '0'
</select>
<select id="getOrderNotW0" resultType="java.lang.String">
select
workorder_code
from pro_order_workorder pow
where pow.workorder_code in
<foreach item="workorderCode" collection="workorderCodes" open="(" separator="," close=")">
#{workorderCode}
</foreach>
and pow.status in ('w0')
and pow.del_flag = '0'
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail

@ -296,6 +296,7 @@
LEFT JOIN (SELECT Produce_Code,Material_Code,SUM(Plan_Number) Plan_Number FROM ods_procure_out_order GROUP BY Produce_Code,Material_Code)AS out_order ON out_order.Produce_Code= mes_prepare.workorder_name AND out_order.Material_Code=mes_prepare_detail.material_code
WHERE
mes_prepare_detail.prepare_id= #{ID}
ORDER BY mes_prepare_detail.recoil
</select>
<insert id="insertWmsRawMissionOut" >
insert into wms_raw_mission_out(id,

Loading…
Cancel
Save