计划bug+报工上位机接口提供

highway
zhaoxiaolin 1 year ago
parent 716dfd6db5
commit 42b0c4622d

@ -142,4 +142,13 @@ public class SapRFW {
'}';
}
}
@Override
public String toString() {
return "{" +
"aufnr:"+aufnr+","+
"gamng:"+gamng+","+
"lt_gs:"+lt_gs.toString()+","+
"lt_hw:"+lt_hw.toString()+","+
"}";
}
}

@ -73,7 +73,7 @@ public class RyTask {
remotePlanService.syncSAPOrders();
}
/**每5分钟报工一次**/
/**每5分钟报工一次(废弃)**/
public void reportWorkTask(){
logger.info("++报工接口+开始++reportWorkTask+++++");
remoteMesService.reportWorkTask();

@ -6,6 +6,7 @@ import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.system.api.domain.dto.BoardDTO;
@ -102,6 +103,19 @@ public class WCSInterfaceController extends BaseController {
}
return success(wCInterfaceService.getMesBoardEquProductionToday(boardDTO));
}
/**上位机报工**/
@PostMapping("/reportWork")
public AjaxResult reportWork(@RequestBody MesReportWork mesReportWork) {
if(StringUtils.isBlank(mesReportWork.getFactoryCode())){
return error("[factoryCode] is null");
}
if(StringUtils.isBlank(mesReportWork.getReportCode())){
return error("[reportCode] is null");
}
return success(wCInterfaceService.reportWork(mesReportWork));
}
/************************************************************/
/****************************数据库清理************************/
/************************************************************/

@ -3,6 +3,7 @@ package com.op.mes.mapper;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataItemsDTO;
@ -48,4 +49,6 @@ public interface MesMapper {
void deleteBkDateByTable(@Param("startDate") String startDate, @Param("endDate")String endDate);
void deleteBkDate(@Param("table")String addMonthTable,@Param("startDate") String startDate, @Param("endDate")String endDate);
void addSapLog(SysSapLog sysSapLog);
}

@ -89,4 +89,8 @@ public interface MesReportWorkMapper {
List<MesHourReport> getEquNames(MesHourReport mesHourReport);
List<MesShift> selectProShift();
MesReportWork getProdResult(MesReportWork work);
ProOrderWorkorder getOrderByCode(String workorderCode);
}

@ -2,6 +2,7 @@ package com.op.mes.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.MesShift;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
@ -33,4 +34,6 @@ public interface IWCSInterfaceService {
R dataClearTask(List<String> tables);
R dataBKTask(List<String> tables);
R reportWork(MesReportWork mesReportWork);
}

@ -6,25 +6,32 @@ import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.MesShift;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.mes.mapper.MesMapper;
import com.op.mes.mapper.MesReportWorkMapper;
import com.op.mes.mapper.ProRfidProcessDetailMapper;
import com.op.mes.service.IWCSInterfaceService;
import com.op.system.api.RemoteSapService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.sap.SapRFW;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
@ -54,6 +61,9 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
@Autowired
private RemoteUserService remoteUserService;
@Autowired
private RemoteSapService remoteSapService;
/**
* JSON
* {
@ -259,6 +269,76 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return R.ok(true);
}
@Override
public R reportWork(MesReportWork mesReportWork) {
DynamicDataSourceContextHolder.push("ds_"+mesReportWork.getFactoryCode());// 这是数据源的key
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
List<MesReportWork> reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork);
if(CollectionUtils.isEmpty(reportWorks)){
return R.fail("未查询报工单");
}
MesReportWork work = reportWorks.get(0);
SapRFW sapRFW = new SapRFW();
sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号
sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量
SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改
ltgs.setConf_activity1(work.getSac1());//人工
ltgs.setConf_activity2(work.getSac2());
ltgs.setConf_activity3(work.getSac3());//机器
ltgs.setConf_activity4(work.getSac4());
ltgs.setConf_activity5(work.getSac5());//折旧
ltgs.setConf_activity6(work.getSac6());
SapRFW.lt_hw lthw = sapRFW.getLt_hw();//MES生产订单报工货物移动修改
lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO;
lthw.setMaterial(work.getProcessCode());
//添加调用sap日志
SysSapLog sysSapLog = new SysSapLog();
sysSapLog.setId(IdUtils.fastSimpleUUID());
sysSapLog.setMesssge(sapRFW.toString());
sysSapLog.setMethod("reportWork");
sysSapLog.setReqcode("请求");
sysSapLog.setCreateTime(DateUtils.getNowDate());
mesMapper.addSapLog(sysSapLog);
R r = remoteSapService.sapRFWOrder(sapRFW);
//上传成功更改mes_report_work状态
if (r.getCode() == 200) {
work.setUploadStatus("1");
} else {
work.setUploadStatus("2");
work.setUploadMsg(r.getMsg());
}
work.setUploadTime(DateUtils.getNowDate());
mesReportWorkMapper.updateSyncSapStatus(work);
//工单完成数量>工单数量:关闭订单
MesReportWork proResult = mesReportWorkMapper.getProdResult(work);
ProOrderWorkorder topOrder = this.getTopOrder(work.getWorkorderCode());
if(proResult.getQuantityFeedback().compareTo(new BigDecimal(topOrder.getQuantitySplit()))>=0){
//工单完成,关闭工单
remoteSapService.sapCloseOrder(work.getOrderCode());
work.setStatus("w4");
work.setUpdateTime(DateUtils.getNowDate());
//pro_work_order status->w4报工
mesReportWorkMapper.updateWorkOrderStatus(work);
}
return R.ok();
}
//根据工单子单编码获取最顶级订单的母单
private ProOrderWorkorder getTopOrder(String workorderCode) {
//pro_order_workorder
ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode);
while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) {
//pro_order_workorder
topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder());
}
return topOrder;
}
public void dateBKFunc(String poolName,List<String> tables){
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@ -322,6 +402,8 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return "保存成功条数:"+saveNum;
}
public static void main(String args[]){
DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate today = LocalDate.now();

@ -236,8 +236,8 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
try {
dateSources.forEach(dateSource -> {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++报工开始++++++++++");
Runnable run = () -> reportWorkByFactory(dateSource.get("poolName"));
executorService.execute(run);
//Runnable run = () -> reportWorkByFactory(dateSource.get("poolName"));
//executorService.execute(run);
});
} catch (Exception e) {
logger.error("service == deviceOfflineTimingTask == exception", e);
@ -249,17 +249,16 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
}
//报工
public void reportWorkByFactory(String poolName) {
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
MesReportWork mesReportWork = new MesReportWork();
MesReportWork mesReportWork = new MesReportWork();
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
List<MesReportWork> reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork);
for(MesReportWork work:reportWorks){
for(MesReportWork work:reportWorks) {
SapRFW sapRFW = new SapRFW();
sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号
sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量
SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改
ltgs.setConf_activity1(work.getSac1());
ltgs.setConf_activity1(work.getSac1());//人工
ltgs.setConf_activity2(work.getSac2());
ltgs.setConf_activity3(work.getSac3());
ltgs.setConf_activity4(work.getSac4());
@ -270,9 +269,9 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
lthw.setMaterial(work.getProcessCode());
R r = remoteSapService.sapRFWOrder(sapRFW);
//上传成功更改mes_report_work状态
if(r.getCode() == 200){
if (r.getCode() == 200) {
work.setUploadStatus("1");
}else{
} else {
work.setUploadStatus("2");
work.setUploadMsg(r.getMsg());
}

@ -12,6 +12,7 @@ import com.op.mes.domain.*;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.service.IWCSInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesReportWorkMapper;
@ -29,6 +30,8 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
@Autowired
private MesReportWorkMapper mesReportWorkMapper;
@Autowired
private IWCSInterfaceService iWCSInterfaceService;
/**
*
*
@ -63,6 +66,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
@DS("#header.poolName")
public int insertMesReportWork(MesReportWork mesReportWork) {
mesReportWork.setCreateTime(DateUtils.getNowDate());
iWCSInterfaceService.reportWork(mesReportWork);
return mesReportWorkMapper.insertMesReportWork(mesReportWork);
}

@ -156,6 +156,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="createNewTable">
SELECT TOP 0 * INTO ${tableNew} FROM mes_material_transfer_result
</insert>
<insert id="addSapLog">
insert into sys_sap_log
(id,messsge,create_time,reqcode,method,remark,status)
values(
#{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status})
</insert>
<select id="copyBkDateByTable">
insert into ${table}
select * FROM mes_material_transfer_result

@ -189,6 +189,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
left join pro_route rte on rte.route_code = ow.route_code
where mrw.upload_status != #{uploadStatus} and mrw.prod_type = #{prodType}
<if test="productDateEnd != null ">
and ow.order_code = #{orderCode}
</if>
order by mrw.create_time
</select>
<select id="getDailyReport" resultType="com.op.mes.domain.MesDailyReport">
@ -330,6 +333,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT bst.Shift_Id shiftId,bst.Shift_Desc shiftDesc
FROM base_shifts_t bst
</select>
<select id="getProdResult" resultType="com.op.mes.domain.MesReportWork">
select
mrw.workorder_code,
sum(mrw.quantity_feedback) quantityFeedback
from mes_report_work mrw
where mrw.del_flag = '0' and mrw.workorder_code = #{workorderode}
group by mrw.workorder_code
</select>
<select id="getOrderByCode" resultType="com.op.mes.domain.ProOrderWorkorder">
select workorder_code workorderCode,
parent_order parentOrder,
quantity_split quantitySplit
from pro_order_workorder where workorder_code = #{workorderCode}
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work

@ -2,6 +2,7 @@ package com.op.plan.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -171,6 +172,15 @@ public class ProOrderController extends BaseController {
return success(proOrderService.getProShifts());
}
/**
*
* @return
*/
@PutMapping("/getProSortNo")
public int getProSortNo(@RequestBody ProOrder proOrder) {
return proOrderService.getProSortNo(proOrder);
}
/**
* list
*

@ -158,7 +158,7 @@ public class ProOrderWorkorderController extends BaseController {
@Log(title = "生产工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{workorderIds}")
public AjaxResult remove(@PathVariable String[] workorderIds) {
//什么时候可以删除工单TODO;没进入生产之前都可以?
//没进入生产之前都可以删除
// 根据工单的ids查工单的信息
List<ProOrderWorkorder> proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds);
if (ObjectUtils.isEmpty(proOrderWorkorders)) {
@ -195,15 +195,11 @@ public class ProOrderWorkorderController extends BaseController {
} else {
throw new ServiceException("工单已进行生产,不允许删除!");
}
// 判断是否含有湿料计划 boolean值存在为true不存在为false
// if (proWetMaterialPlanDetailService.selectProWetMaterialPlanDetailByWorkId(proOrderWorkorder.getWorkorderId())) {
// throw new ServiceException("工单已创建湿料计划,不能删除!");
// }
}
String[] orderWorkerIds = strings.toArray(new String[0]);
// 删除成品工单
if (proWorkOrder.size() > 0) {
if (orderWorkerIds.length > 0) {
proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds);
}
return toAjax(1);

@ -62,6 +62,16 @@ public class ProOrder extends TreeEntity {
private String bomBo;
private String syncUser;
private String productDate;
public String getProductDate() {
return productDate;
}
public void setProductDate(String productDate) {
this.productDate = productDate;
}
public String getBomBo() {
return bomBo;
}
@ -138,7 +148,7 @@ public class ProOrder extends TreeEntity {
private String materialCode;
private String materialName;
private Integer sortNo;
// 车数
private Integer carNum;
@ -338,6 +348,14 @@ public class ProOrder extends TreeEntity {
return prodType;
}
public Integer getSortNo() {
return sortNo;
}
public void setSortNo(Integer sortNo) {
this.sortNo = sortNo;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -150,6 +150,7 @@ public class ProOrderWorkorder extends TreeEntity {
// 车数
private Integer carNum;
private Integer sortNo;
public Integer getCarNum() {
return carNum;
@ -506,6 +507,14 @@ public class ProOrderWorkorder extends TreeEntity {
this.prodLineCodeArray = prodLineCodeArray;
}
public Integer getSortNo() {
return sortNo;
}
public void setSortNo(Integer sortNo) {
this.sortNo = sortNo;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -65,6 +65,8 @@ public class ProOrderDTO {
private Integer carNum;
private Integer sortNo;
public Integer getCarNum() {
return carNum;
}
@ -83,6 +85,14 @@ public class ProOrderDTO {
private List<ProOrderDTO> children;
public Integer getSortNo() {
return sortNo;
}
public void setSortNo(Integer sortNo) {
this.sortNo = sortNo;
}
@Override
public String toString() {
return "ProOrderDTO{" +

@ -29,6 +29,15 @@ public class SplitOrderDTO {
private String materialCode;
private String materialName;
private Integer sortNo;
public Integer getSortNo() {
return sortNo;
}
public void setSortNo(Integer sortNo) {
this.sortNo = sortNo;
}
public String getMaterialCode() {
return materialCode;

@ -148,5 +148,7 @@ public interface ProOrderWorkorderMapper {
* @return
*/
List<ProOrderWorkorder> selectProOrderWorkorderByOrderId(String orderId);
int getProSortNo(ProOrder proOrder);
}

@ -134,4 +134,6 @@ public interface IProOrderService {
* @return
*/
AjaxResult getCascadeProOrder(String orderCode);
int getProSortNo(ProOrder proOrder);
}

@ -131,7 +131,7 @@ public class ProOrderServiceImpl implements IProOrderService {
// 如果不重复
if (checkout) {
// 如果是白坯订单
/****白坯订单*****/
if (splitOrderDTO.getProduct().getProdType().equals("white")){
boolean flag = false;
@ -181,7 +181,11 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderMapper.updateWhiteOrder(proOrder);
// 设置工单通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(
proOrder, splitOrderDTO.getProductDate(),
splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),
splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo()
);
// 设置批次表通用信息
ProOrderWorkorderBatch proOrderWorkorderBatch = setCommonBatchAttribute();
// 设置工单
@ -198,7 +202,7 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder.setEndFlag(1);
proOrderWorkorder.setCarNum(splitOrderDTO.getCarNum());
// 插入工单
// 插入工单/**pro_order_workorder**/
proOrderWorkorderMapper.insertProOrderWorkorder(proOrderWorkorder);
setBatch(proOrderWorkorderBatch,splitOrderDTO.getFormFields(),proOrderWorkorder.getWorkorderId(),1L);
@ -235,12 +239,16 @@ public class ProOrderServiceImpl implements IProOrderService {
return success();
}else {
}else {/****成品订单*****/
// 创建订单对象并将信息copy进去
ProOrder proOrder = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), proOrder);
// 设置工单通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(
proOrder, splitOrderDTO.getProductDate(),
splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),
splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo()
);
// 创建批次表通用对象
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
// code
@ -263,12 +271,9 @@ public class ProOrderServiceImpl implements IProOrderService {
workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode);
// 3.设置父工单
workOrder.setParentOrder(parentOrder.toString());
// 工单对应车数-白坯订单操作
// if (proOrder.getProdType().equals("white")) {
// int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum());
// int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum);
// workOrder.setCarNum(carNum);
// }
workOrder.setSortNo(splitOrderDTO.getSortNo());
// 将工单信息更新至数据库
proOrderWorkorderMapper.insertProOrderWorkorder(workOrder);
// 生成批次表信息并更新至数据库
@ -296,34 +301,6 @@ public class ProOrderServiceImpl implements IProOrderService {
}
}
}
// 关闭订单,判断是否拆分完成
// ProOrder order = proOrderMapper.selectProOrderById(splitOrderDTO.getProduct().getId());
// Long quantitySplit = order.getQuantitySplit();
// Long quantity1 = order.getQuantity();
// if (quantity1.equals(quantitySplit)) {
// // 需要关闭订单的codeList
// List<String> orderCodes = new ArrayList<>();
// // 临时存放code
// StringBuilder orderCode = new StringBuilder();
// orderCode.append(order.getOrderCode());
// while(true) {
// orderCodes.add(orderCode.toString());
// String selectOrderCode = proOrderMapper.selectChildProOrderCodeByCode(orderCode.toString());
// if (selectOrderCode == null) {
// break;
// }
// orderCode.setLength(0);
// orderCode.append(selectOrderCode);
// }
//
// // 关闭订单
// for (String code : orderCodes) {
// remoteSapService.sapCloseOrder(code);
// }
//
// }
return success();
}
@ -695,6 +672,12 @@ public class ProOrderServiceImpl implements IProOrderService {
return success(proOrderVO);
}
@Override
@DS("#header.poolName")
public int getProSortNo(ProOrder proOrder) {
return proOrderWorkorderMapper.getProSortNo(proOrder);
}
public void getSAPOrderByFactory(String poolName) {
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
// SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime();
@ -845,7 +828,7 @@ public class ProOrderServiceImpl implements IProOrderService {
* @param proOrder
* @return
*/
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode) {
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode, Integer orderNum) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
// 更新者
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
@ -865,6 +848,8 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder.setProductSpc(proOrder.getProdSpc());
// 产线
proOrderWorkorder.setProdLineCode(proLineCode);
// 产线
proOrderWorkorder.setOrderNum(orderNum);
// 班次
proOrderWorkorder.setShiftId(shiftId);
// TODO 产品类型(pro_type)
@ -915,6 +900,7 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder.setQuantitySplit(Long.valueOf(proOrder.getAtrr1()));
// 设置工单产品类型
proOrderWorkorder.setProdType(proOrder.getOrderType());
return proOrderWorkorder;
}

@ -97,12 +97,11 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
for (int c = 0; c < codeArray.size(); c++) {
String equipCode = codeArray.getJSONArray(c).getString(1);
prodLineName += equipMap.get(equipCode).getLabel() + ",";
CascaderDTO eInfo = equipMap.get(equipCode);
if(eInfo != null){
prodLineName += eInfo.getLabel() + ",";
}
}
// Set<String> keys = equipMap.keySet();
// for (String key : keys) {
// prodLineName += equipMap.get(key).getLabel() + ",";
// }
workorder.setProdLineName(prodLineName);
// // 通过设备code查询出机型名称

@ -37,13 +37,14 @@
<result property="factoryCode" column="factory_code" />
<result property="endFlag" column="end_flag" />
<result property="carNum" column="car_num" />
<result property="sortNo" column="sort_no" />
</resultMap>
<sql id="selectProOrderWorkorderVo">
select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name,
product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date,
shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time, prod_type, factory_code , end_flag , car_num
update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no
from pro_order_workorder
</sql>
@ -201,6 +202,7 @@
<if test="factoryCode != null">factory_code,</if>
<if test="endFlag != null">end_flag,</if>
<if test="carNum != null">car_num,</if>
<if test="sortNo != null">sort_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workorderId != null">#{workorderId},</if>
@ -235,6 +237,7 @@
<if test="factoryCode != null">#{factoryCode},</if>
<if test="endFlag != null">#{endFlag},</if>
<if test="carNum != null">#{carNum},</if>
<if test="sortNo != null">#{sortNo},</if>
</trim>
</insert>
<insert id="createPrepare">
@ -341,6 +344,10 @@
<include refid="selectProOrderWorkorderVo"/>
where order_id = #{orderId} and del_flag = '0'
</select>
<select id="getProSortNo" resultType="java.lang.Integer">
select count(0)+1 from pro_order_workorder
where product_date = #{productDate} and end_flag='1'
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail
@ -422,7 +429,7 @@
<delete id="deleteProOrderWorkorderByWorkorderIds" parameterType="String">
update pro_order_workorder
set del_flag = '1'
where order_id in
where workorder_id in
<foreach item="workorderId" collection="array" open="(" separator="," close=")">
#{workorderId}
</foreach>

Loading…
Cancel
Save