计划bug修改-- 计划的选择方式修改

highway
zhaoxiaolin 1 year ago
parent fdd2069372
commit d6d5ff4ae3

@ -17,12 +17,12 @@ spring:
# 服务注册地址
#--spring.cloud.nacos.discovery.namespace=chj --spring.cloud.nacos.config.namespace=chj
namespace: lanju-op
group: chj
group: zxl
server-addr: 140.249.53.142:8848
config:
#命名空间
namespace: lanju-op
group: chj
group: zxl
# 配置中心地址
server-addr: 140.249.53.142:8848
# 配置文件格式

@ -4,6 +4,8 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -97,4 +99,53 @@ public class MesReportWorkController extends BaseController {
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(mesReportWorkService.deleteMesReportWorkByIds(ids));
}
/**
*
*/
@RequiresPermissions("mes:processFinish:list")
@GetMapping("/getProcessFinishList")
public TableDataInfo getProcessFinishList(MesProcessReport mesReportWork) {
startPage();
List<MesProcessReport> list = mesReportWorkService.getProcessFinishList(mesReportWork);
TableDataInfo tableDataInfo = getDataTable(list);
tableDataInfo.setTotal(4);//TODO;zxl;测试用
return tableDataInfo;
}
/**
*
*/
@RequiresPermissions("mes:processFinish:list")
@Log(title = "工单各工序完成记录", businessType = BusinessType.EXPORT)
@PostMapping("/processFinishExport")
public void processFinishExport(HttpServletResponse response, MesProcessReport mesProcessReport) {
List<MesProcessReport> list = mesReportWorkService.getProcessFinishList(mesProcessReport);
ExcelUtil<MesProcessReport> util = new ExcelUtil<MesProcessReport>(MesProcessReport.class);
util.exportExcel(response, list, "工单各工序完成数据");
}
/**
*
*/
@RequiresPermissions("mes:production:list")
@GetMapping("/getProductionList")
public TableDataInfo getProductionList(MesReportProduction mesReportProduction) {
startPage();
List<MesReportProduction> list = mesReportWorkService.getProductionList(mesReportProduction);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:production:list")
@GetMapping("/productionExport")
public void productionExport(HttpServletResponse response, MesReportProduction mesReportProduction) {
List<MesReportProduction> list = mesReportWorkService.getProductionList(mesReportProduction);
ExcelUtil<MesReportProduction> util = new ExcelUtil<MesReportProduction>(MesReportProduction.class);
util.exportExcel(response, list, "工单各工序完成数据");
}
}

@ -0,0 +1,150 @@
package com.op.mes.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* mes_report_work
*
* @author Open Platform
* @date 2023-08-24
*/
public class MesProcessReport extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "生产日期")
private String productDate;
@Excel(name = "订单编号")
private String orderCode;
@Excel(name = "排产数量")
private BigDecimal quantity;
@Excel(name = "产品编码")
private String productCode;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "产品型号")
private String productSpc;
@Excel(name = "工单编号")
private String workorderCode;
@Excel(name = "工序编码")
private String processCode;
@Excel(name = "工序名称")
private String processName;
@Excel(name = "完成数量")
private BigDecimal quantityFeedback;
@Excel(name = "单位")
private String unit;
private String productDateStart;
private String productDateEnd;
public String getProductDateStart() {
return productDateStart;
}
public void setProductDateStart(String productDateStart) {
this.productDateStart = productDateStart;
}
public String getProductDateEnd() {
return productDateEnd;
}
public void setProductDateEnd(String productDateEnd) {
this.productDateEnd = productDateEnd;
}
public String getProductDate() {
return productDate;
}
public void setProductDate(String productDate) {
this.productDate = productDate;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
public BigDecimal getQuantityFeedback() {
return quantityFeedback;
}
public void setQuantityFeedback(BigDecimal quantityFeedback) {
this.quantityFeedback = quantityFeedback;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductSpc() {
return productSpc;
}
public void setProductSpc(String productSpc) {
this.productSpc = productSpc;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}

@ -0,0 +1,150 @@
package com.op.mes.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* mes_report_work
*
* @author Open Platform
* @date 2023-08-24
*/
public class MesReportProduction extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "工厂编码")
private String factoryCode;
@Excel(name = "工厂名称")
private String factoryName;
@Excel(name = "车间编码")
private String carCode;
@Excel(name = "工厂名称")
private String carName;
@Excel(name = "工厂编码")
private String machineCode;
@Excel(name = "工厂名称")
private String machineName;
@Excel(name = "订单编号")
private String orderCode;
@Excel(name = "产品编码")
private String productCode;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "计划产量")
private String quantity;
@Excel(name = "报工产量")
private String quantityFeedback;
@Excel(name = "规格型号")
private String productSpc;
@Excel(name = "工厂编码")
private String unit;
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getCarName() {
return carName;
}
public void setCarName(String carName) {
this.carName = carName;
}
public String getMachineCode() {
return machineCode;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public String getMachineName() {
return machineName;
}
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getQuantityFeedback() {
return quantityFeedback;
}
public void setQuantityFeedback(String quantityFeedback) {
this.quantityFeedback = quantityFeedback;
}
public String getProductSpc() {
return productSpc;
}
public void setProductSpc(String productSpc) {
this.productSpc = productSpc;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}

@ -124,6 +124,78 @@ public class MesReportWork extends BaseEntity {
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
@Excel(name = "计划生产日期")
private String productDate;
private String productDateStart;
private String productDateEnd;
@Excel(name = "订单编号")
private String orderCode;
@Excel(name = "规格型号")
private String productSpc;
@Excel(name = "工序名称")
private String processName;
@Excel(name = "工序编码")
private String processCode;
private String factoryCode;
private String factoryName;
private String carCode;
private String carName;
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getCarName() {
return carName;
}
public void setCarName(String carName) {
this.carName = carName;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProductDateStart() {
return productDateStart;
}
public void setProductDateStart(String productDateStart) {
this.productDateStart = productDateStart;
}
public String getProductDateEnd() {
return productDateEnd;
}
public void setProductDateEnd(String productDateEnd) {
this.productDateEnd = productDateEnd;
}
public void setId(String id) {
this.id = id;
@ -316,6 +388,38 @@ public class MesReportWork extends BaseEntity {
return attr4;
}
public String getProductDate() {
return productDate;
}
public void setProductDate(String productDate) {
this.productDate = productDate;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProductSpc() {
return productSpc;
}
public void setProductSpc(String productSpc) {
this.productSpc = productSpc;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -2,6 +2,8 @@ package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.MesReportWork;
/**
@ -58,4 +60,8 @@ public interface MesReportWorkMapper {
* @return
*/
public int deleteMesReportWorkByIds(String[] ids);
public List<MesProcessReport> getProcessFinishList(MesProcessReport mesReportWork);
public List<MesReportProduction> getProductionList(MesReportProduction mesReportProduction);
}

@ -1,6 +1,9 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.MesReportWork;
/**
@ -57,4 +60,8 @@ public interface IMesReportWorkService {
* @return
*/
public int deleteMesReportWorkById(String id);
public List<MesProcessReport> getProcessFinishList(MesProcessReport mesReportWork);
public List<MesReportProduction> getProductionList(MesReportProduction mesReportProduction);
}

@ -1,14 +1,19 @@
package com.op.mes.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesReportWorkMapper;
import com.op.mes.domain.MesReportWork;
import com.op.mes.service.IMesReportWorkService;
import org.springframework.util.CollectionUtils;
/**
* Service
@ -94,4 +99,71 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
public int deleteMesReportWorkById(String id) {
return mesReportWorkMapper.deleteMesReportWorkById(id);
}
@Override
@DS("#header.poolName")
public List<MesProcessReport> getProcessFinishList(MesProcessReport mesReportWork) {
List<MesProcessReport> dtos = new ArrayList<>();
dtos = mesReportWorkMapper.getProcessFinishList(mesReportWork);
MesProcessReport dto = null;
if(CollectionUtils.isEmpty(dtos)){
dto = new MesProcessReport();
dto.setProductDate("2023-08-31");
dto.setOrderCode("000100220788");
dto.setWorkorderCode("000100220788-1");
dto.setProductCode("000000020000004232");
dto.setProductName("榄菊小盘艾草型蚊香3+1家庭特惠装(1901)");
dto.setProductSpc("23mm");
dto.setProcessCode("ProdGX01");
dto.setProcessName("包装线工序01");
dto.setQuantityFeedback(new BigDecimal("500"));
dto.setQuantity(new BigDecimal("1000"));
dto.setUnit("KAR");
dtos.add(dto);
dto = new MesProcessReport();
dto.setProductDate("2023-08-31");
dto.setOrderCode("000100220789");
dto.setWorkorderCode("000100220789-1");
dto.setProductCode("000000020000004234");
dto.setProductName("白坯");
dto.setProductSpc("23mm");
dto.setProcessCode("BPGX01");
dto.setProcessName("收胚机工序");
dto.setQuantityFeedback(new BigDecimal("80"));
dto.setUnit("车");
dtos.add(dto);
dto = new MesProcessReport();
dto.setProductDate("2023-08-31");
dto.setOrderCode("000100220789");
dto.setWorkorderCode("000100220789-1");
dto.setProductCode("000000020000004234");
dto.setProductName("白坯");
dto.setProductSpc("23mm");
dto.setProcessCode("BPGX02");
dto.setProcessName("烘房工序");
dto.setQuantityFeedback(new BigDecimal("70"));
dto.setUnit("车");
dtos.add(dto);
dto = new MesProcessReport();
dto.setProductDate("2023-08-31");
dto.setOrderCode("000100220789");
dto.setWorkorderCode("000100220789-1");
dto.setProductCode("000000020000004234");
dto.setProductName("白坯");
dto.setProductSpc("23mm");
dto.setProcessCode("BPGX02");
dto.setProcessName("收坯工序");
dto.setQuantityFeedback(new BigDecimal("100"));
dto.setUnit("车");
dtos.add(dto);
}
return dtos;
}
@Override
@DS("#header.poolName")
public List<MesReportProduction> getProductionList(MesReportProduction mesReportProduction) {
return mesReportWorkMapper.getProductionList(mesReportProduction);
}
}

@ -79,6 +79,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMesReportWorkVo"/>
where id = #{id}
</select>
<select id="getProcessFinishList" resultType="com.op.mes.domain.MesProcessReport">
select
pow.product_date productDate,
pow.order_code orderCode,
pow.quantity_split quantity,
pow.product_code productCode,
pow.product_name productName,
pow.product_spc productSpc,
prpd.workorder_code workorderCode,
ps.process_code processCode,
ps.process_name processName,
count(0) quantityFeedback,
'车' unit
from pro_rfid_process_detail prpd
left join pro_order_workorder pow on pow.workorder_code = prpd.workorder_code
left join pro_process ps on ps.process_id = prpd.now_process_id
where prpd.bind_status = 0
<if test="orderCode != null and orderCode != ''">
and pow.order_code like concat('%', #{orderCode}, '%')
</if>
<if test="productCode != null and productCode != ''">
and pow.product_code like concat('%', #{productCode}, '%')
</if>
<if test="productName != null and productName != ''">
and pow.product_name like concat('%', #{productName}, '%')
</if>
<if test="workorderCode != null and workorderCode != ''">
and pow.workorder_code like concat('%', #{workorderCode}, '%')
</if>
<if test="productSpc != null and productSpc != ''">
and pow.product_spc like concat('%', #{productSpc}, '%')
</if>
<if test="productDateStart != null "> and CONVERT(varchar(10),prpd.create_time, 120) >= #{productDateStart}</if>
<if test="productDateEnd != null "> and #{productDateEnd} >= CONVERT(varchar(10),prpd.create_time, 120)</if>
group by
pow.order_code,
pow.product_date,
pow.product_code,
pow.product_name,
pow.product_spc,
pow.quantity_split,
prpd.workorder_code,
prpd.now_process_id,
ps.process_name,
ps.process_code
order by pow.product_date desc,prpd.workorder_code
</select>
<select id="getProductionList" resultType="com.op.mes.domain.MesReportProduction">
select sf2.factory_code factoryCode,
sf2.factory_name factoryName,
sf1.factory_code carCode,
sf1.factory_name carName,
sf.factory_code machineCode,
sf.factory_name machineName,
pow.order_code orderCode,
pow.product_code productCode,
pow.product_name productName,
mrw.quantity,
mrw.quantity_feedback quantityFeedback,
mrw.spec productSpc,
mrw.unit
from mes_report_work mrw
left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code
left join sys_factory sf on sf.factory_code = pow.prod_line_code <!--线体-->
left join sys_factory sf1 on sf.parent_id = sf1.factory_id <!--车间-->
left join sys_factory sf2 on sf1.parent_id = sf2.factory_id <!--工厂-->
where 1=1
<if test="machineName != null and machineName != ''">and sf.factory_name like concat('%', #{machineName}, '%')</if>
<if test="carName != null and carName != ''">and sf1.factory_name like concat('%', #{carName}, '%')</if>
<if test="factoryName != null and factoryName != ''">and sf2.factory_name like concat('%', #{factoryName}, '%')</if>
<if test="productCode != null and productCode != ''">and pow.product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''">and pow.product_name like concat('%', #{productName}, '%')</if>
<if test="orderCode != null and orderCode != ''">and pow.order_code like concat('%', #{orderCode}, '%')</if>
<if test="productDateStart != null "> and CONVERT(varchar(10),mrw.feedback_time, 120) >= #{productDateStart}</if>
<if test="productDateEnd != null "> and #{productDateEnd} >= CONVERT(varchar(10),mrw.feedback_time, 120)</if>
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work

@ -265,4 +265,5 @@ public class ProOrderController extends BaseController {
public R syncSAPOrders() {
return proOrderService.syncSAPOrders();
}
}

@ -81,6 +81,8 @@ public class ProOrderWorkorder extends TreeEntity {
@Excel(name = "线体")
private String prodLineCode;
private String[][] prodLineCodeArray;
// TODO 暂时存放线体编码
private String prodLineName;
@ -457,6 +459,14 @@ public class ProOrderWorkorder extends TreeEntity {
this.productDateEnd = productDateEnd;
}
public String[][] getProdLineCodeArray() {
return prodLineCodeArray;
}
public void setProdLineCodeArray(String[][] prodLineCodeArray) {
this.prodLineCodeArray = prodLineCodeArray;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -12,6 +12,7 @@ public class SplitOrderDTO {
private List<Batch> formFields;
// 产线
private String prodLineCode;
private String[][] prodLineCodeArray;
// 日期
private Date productDate;
// 班次
@ -89,6 +90,13 @@ public class SplitOrderDTO {
this.product = product;
}
public String[][] getProdLineCodeArray() {
return prodLineCodeArray;
}
public void setProdLineCodeArray(String[][] prodLineCodeArray) {
this.prodLineCodeArray = prodLineCodeArray;
}
public SplitOrderDTO() {
}

@ -0,0 +1,69 @@
package com.op.plan.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
/**
* Treeselect
*
* @author OP
*/
public class CascaderDTO implements Serializable {
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
private String value;
/** 节点名称 */
private String label;
/** 子节点 */
private List<CascaderDTO> children;
//
// public TreeSelect() {
//
// }
//
// public TreeSelect(SysDept dept) {
// this.id = dept.getDeptId();
// this.label = dept.getDeptName();
// this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
// }
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<CascaderDTO> getChildren() {
return children;
}
public void setChildren(List<CascaderDTO> children) {
this.children = children;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

@ -1,13 +1,16 @@
package com.op.plan.mapper;
import java.util.List;
import java.util.Map;
import com.op.plan.domain.Convert;
import com.op.plan.domain.ProLine;
import com.op.plan.domain.ProOrder;
import com.op.plan.domain.ProShift;
import com.op.plan.domain.*;
import com.op.plan.domain.vo.CascaderDTO;
import com.op.system.api.model.SapProOrder;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -182,4 +185,10 @@ public interface ProOrderMapper {
* @return
*/
List<ProLine> selectEquipment(String[] codes);
List<CascaderDTO> getRouteProcess(String routeCode);
List<CascaderDTO> getRouteProcessEquips(@Param("list") List<CascaderDTO> level);
@MapKey("value")
Map<String, CascaderDTO> getEquipInfoByCodes(String equipCodes);
}

@ -6,6 +6,7 @@ import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.plan.domain.*;
import com.op.plan.domain.dto.SplitOrderDTO;
import com.op.plan.domain.vo.CascaderDTO;
/**
* Service
@ -132,7 +133,7 @@ public interface IProOrderService {
* @param routeCode
* @return
*/
List<ProLine> getProEquipment(String routeCode);
List<CascaderDTO> getProEquipment(String routeCode);
/**
* Code

@ -8,7 +8,9 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.op.plan.domain.vo.CascaderDTO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.context.SecurityContextHolder;
@ -98,6 +100,30 @@ public class ProOrderServiceImpl implements IProOrderService {
}
}
}
//校验各工序设备是否已选择
List<CascaderDTO> processes= proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode());
if(splitOrderDTO.getProdLineCodeArray().length == 0){
checkout = false;
return error(500, "必须选择工单生产设备!");
}else{
String codeArray = JSONArray.toJSONString(splitOrderDTO.getProdLineCodeArray());
for(int i=0;i<processes.size();i++){
if(codeArray.indexOf(processes.get(i).getValue())<0){
checkout = false;
return error(500, "所有有工序节点都必须选择生产设备!");
}
}
String[][] array = splitOrderDTO.getProdLineCodeArray();
for(int m=0;m<array.length;m++){
if(array[m].length<2){
checkout = false;
return error(500, "工序没有生产设备可选择,请维护工艺!");
}
}
splitOrderDTO.setProdLineCode(codeArray);
}
// 如果不重复
if (checkout) {
@ -215,7 +241,21 @@ public class ProOrderServiceImpl implements IProOrderService {
// 通过班次id查询班次名称
String shiftDesc = proOrderMapper.selectShiftNameById(proOrderWorkorder.getShiftId());
// 通过设备code查询出机型名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorder.getProdLineCode());
String prodLineName = "";
String equipCods = "'";
JSONArray codeArray = JSONArray.parseArray(proOrderWorkorder.getProdLineCode());
for(int c=0;c<codeArray.size();c++){
equipCods += codeArray.getJSONArray(c).getString(1)+"','";
}
Map<String,CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
Set<String> keys = equipMap.keySet();
for (String key : keys) {
prodLineName += equipMap.get(key).getLabel()+",";
}
proOrderWorkorder.setProdLineCode(prodLineName);
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorder.getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
@ -225,7 +265,7 @@ public class ProOrderServiceImpl implements IProOrderService {
}
// 将查询结果设置到当前工单对象
proOrderWorkorder.setShiftDesc(shiftDesc);
proOrderWorkorder.setProdLineCode(prodLineName);
proOrderWorkorder.setBatchCodeList(batchCodes);
// 通过母工单workorder_id查询子工单
@ -509,9 +549,40 @@ public class ProOrderServiceImpl implements IProOrderService {
*/
@Override
@DS("#header.poolName")
public List<ProLine> getProEquipment(String routeCode) {
String[] split = proOrderMapper.selectEquipmentListByRouteCode(routeCode).split(",");
return proOrderMapper.selectEquipment(split);
public List<CascaderDTO> getProEquipment(String routeCode) {
List<CascaderDTO> level= proOrderMapper.getRouteProcess(routeCode);
List<CascaderDTO> level2= proOrderMapper.getRouteProcessEquips(level);
Map<String,CascaderDTO> equipMap = new HashMap<>();//设备字典
if(!CollectionUtils.isEmpty(level2)){
List<String> oldCodes = level2.stream()
.filter(value -> StringUtils.isNotEmpty(value.getValue()))
.map(value -> value.getValue()).collect(Collectors.toList());
String equipCods = oldCodes.stream().reduce((sum,num) -> sum+","+num).get();
equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.replace(",","','"));
}
if(equipMap.isEmpty()){
return null;
}
List<CascaderDTO> children = null;
for(CascaderDTO level1:level){
children = new ArrayList<>();//最终结果
List<CascaderDTO> childrens = level2.stream()
.filter(dto ->dto.getLabel().equals(level1.getValue()))
.collect(Collectors.toList());
for(CascaderDTO child:childrens){
String[] equipstr = child.getValue().split(",");
for(String equipcode:equipstr){
if(equipMap.get(equipcode) != null){
children.add(equipMap.get(equipcode));
}
}
}
if(!CollectionUtils.isEmpty(children)){
level1.setChildren(children);
}
}
System.out.println(JSONArray.toJSONString(level));
return level;
}
/**
@ -882,5 +953,11 @@ public class ProOrderServiceImpl implements IProOrderService {
}
return success();
}
public static void main(String args[]){
String arrayStr = "[[\"GX01\",\"LG1\"],[\"GX01\",\"LG2\"],[\"GX02\",\"S1\"],[\"GX02\",\"S2\"],[\"GX03\",\"HF01\"],[\"GX04\",\"SPJ01\"]]";
JSONArray jsonArray = JSONArray.parseArray(arrayStr);
for(int c=0;c<jsonArray.size();c++){
System.out.println(jsonArray.getJSONArray(c).getString(1));
}
}
}

@ -1,5 +1,6 @@
package com.op.plan.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.R;
@ -11,6 +12,7 @@ import com.op.common.security.utils.SecurityUtils;
import com.op.plan.domain.*;
import com.op.plan.domain.dto.ProOrderDTO;
import com.op.plan.domain.dto.SplitOrderDTO;
import com.op.plan.domain.vo.CascaderDTO;
import com.op.plan.mapper.*;
import com.op.plan.service.IProOrderWorkorderService;
import com.op.system.api.RemoteSapService;
@ -76,8 +78,19 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
public List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder);
for (ProOrderWorkorder workorder : workorderList) {
// TODO 暂存线体code
workorder.setProdLineName(workorder.getProdLineCode());
String prodLineName = "";
String equipCods = "'";
JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode());
for(int c=0;c<codeArray.size();c++){
equipCods += codeArray.getJSONArray(c).getString(1)+"','";
}
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
Set<String> keys = equipMap.keySet();
for (String key : keys) {
prodLineName += equipMap.get(key).getLabel()+",";
}
workorder.setProdLineName(prodLineName);
// 通过设备code查询出机型名称
workorder.setProdLineCode(proOrderMapper.selectProdLineName(workorder.getProdLineCode()));
// 通过工艺编码code查询出机型名称
@ -445,11 +458,30 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
}
}
}
//校验各工序设备是否已选择
List<CascaderDTO> processes= proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode());
if(splitOrderDTO.getProdLineCodeArray().length == 0){
checkout = false;
return error(500, "必须选择工单生产设备!");
}else{
String codeArray = JSONArray.toJSONString(splitOrderDTO.getProdLineCodeArray());
for(int i=0;i<processes.size();i++){
if(codeArray.indexOf(processes.get(i).getValue())<0){
checkout = false;
return error(500, "所有有工序节点都必须选择生产设备!");
}
}
// for (ProOrderWorkorder proOrderWorkorder : workOrderList){
// System.out.println("这里是你的工单!!!!!"+proOrderWorkorder.getWorkorderCode());
// System.out.println("这里是工单拆分数量!!!!!!"+proOrderWorkorder.getQuantitySplit());
// }
String[][] array = splitOrderDTO.getProdLineCodeArray();
for(int m=0;m<array.length;m++){
if(array[m].length<2){
checkout = false;
return error(500, "工序没有生产设备可选择,请维护工艺!");
}
}
splitOrderDTO.setProdLineCode(codeArray);
}
if (checkout){
// 删除所有工单s下的批次信息
@ -613,10 +645,28 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
private void formatProOrderWorkorder(ProOrderWorkorder proOrderWorkorder) {
// 通过班次id查询班次名称
String shiftDesc = proOrderMapper.selectShiftNameById(proOrderWorkorder.getShiftId());
// TODO 暂时存放线体code
proOrderWorkorder.setProdLineName(proOrderWorkorder.getProdLineCode());
// 通过设备code查询出机型名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(proOrderWorkorder.getWorkorderId()).getProdLineCode());
JSONArray codeArray = JSONArray.parseArray(proOrderWorkorder.getProdLineName());
String[][] array = new String[codeArray.size()][2];
for(int c1=0;c1<codeArray.size();c1++){
for(int c2=0;c2<2;c2++){
array[c1][c2] = codeArray.getJSONArray(c1).getString(c2);
}
}
proOrderWorkorder.setProdLineCodeArray(array);
String prodLineName = "";
String equipCods = "'";
for(int c=0;c<codeArray.size();c++){
equipCods += codeArray.getJSONArray(c).getString(1)+"','";
}
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
Set<String> keys = equipMap.keySet();
for (String key : keys) {
prodLineName += equipMap.get(key).getLabel()+",";
}
proOrderWorkorder.setProdLineCode(prodLineName);
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorder.getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
@ -626,7 +676,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
}
// 将查询结果设置到当前工单对象
proOrderWorkorder.setShiftDesc(shiftDesc);
proOrderWorkorder.setProdLineCode(prodLineName);
proOrderWorkorder.setBatchCodeList(batchCodes);
// 通过母工单workorder_id查询子工单

@ -151,6 +151,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{code}
</foreach>
</select>
<select id="getRouteProcess" resultType="com.op.plan.domain.vo.CascaderDTO">
select process_code value,
process_name label
from pro_route_process where route_id in(
select route_id from pro_route where route_code = #{routeCode}
)
order by order_num
</select>
<select id="getRouteProcessEquips" resultType="com.op.plan.domain.vo.CascaderDTO">
select equipment value,process_code label from pro_process where process_code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.value}
</foreach>
</select>
<select id="getEquipInfoByCodes" resultType="com.op.plan.domain.vo.CascaderDTO">
select equipment_code value,equipment_name label from base_equipment where equipment_code in
('${equipCodes}')
</select>
<insert id="insertProOrder" parameterType="ProOrder">
insert into pro_order

@ -5,6 +5,7 @@ import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.Date;
import java.util.List;
/**
* @ClassName : qua
@ -53,6 +54,7 @@ public class QcProCheck extends BaseEntity {
private String isqua;
@Excel(name = "附件")
private List<BaseFile> fileList;
private String fileId;
@Excel(name = "创建者")
@ -191,13 +193,7 @@ public class QcProCheck extends BaseEntity {
this.isqua = isqua;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
@Override
public String getCreateBy() {
@ -271,34 +267,21 @@ public class QcProCheck extends BaseEntity {
this.attr4 = attr4;
}
public QcProCheck(String id, String rfid, String factoryId, String factoryCode, String workorderId, String workorderCode, String workorderName, String orderId, String orderCode, String machineId, String machineCode, String badMeg, String productId, String productCode, String isqua, String fileId, String createBy, Date createTime, String updateBy, Date updateTime, String attr1, String attr2, String attr3, String attr4) {
this.id = id;
this.rfid = rfid;
this.factoryId = factoryId;
this.factoryCode = factoryCode;
this.workorderId = workorderId;
this.workorderCode = workorderCode;
this.workorderName = workorderName;
this.orderId = orderId;
this.orderCode = orderCode;
this.machineId = machineId;
this.machineCode = machineCode;
this.badMeg = badMeg;
this.productId = productId;
this.productCode = productCode;
this.isqua = isqua;
this.fileId = fileId;
this.createBy = createBy;
this.createTime = createTime;
this.updateBy = updateBy;
this.updateTime = updateTime;
this.attr1 = attr1;
this.attr2 = attr2;
this.attr3 = attr3;
this.attr4 = attr4;
public List<BaseFile> getFileList() {
return fileList;
}
public void setFileList(List<BaseFile> fileList) {
this.fileList = fileList;
}
public QcProCheck() {
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
@Override
@ -319,7 +302,8 @@ public class QcProCheck extends BaseEntity {
", productId='" + productId + '\'' +
", productCode='" + productCode + '\'' +
", isqua='" + isqua + '\'' +
", fileId='" + fileId + '\'' +
", fileId=" + fileId +
", fileList='" + fileList + '\'' +
", createBy='" + createBy + '\'' +
", createTime=" + createTime +
", updateBy='" + updateBy + '\'' +

@ -1,31 +0,0 @@
package com.op.quality.mapper;
import com.op.common.core.domain.R;
import com.op.quality.domain.QcProCheck;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ClassName : QuaMapper
* @Description :
* @Author :
* @Date: 2023-08-17 10:40
*/
@Mapper
public interface QcProCheckMapper {
List<QcProCheck> selectQcProCheckList();
int insertQcProCheck(QcProCheck qcProCheck);
int updateQcProCheckById(String rfid);
int deleteQcProCheckById(String rfid);
}

@ -1,6 +1,7 @@
package com.op.quality.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.quality.domain.BaseFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@ -2,7 +2,6 @@ package com.op.quality.service;
import com.op.common.core.domain.R;
//import com.op.quality.domain.BaseFile;
import com.op.quality.domain.BaseFile;
import com.op.quality.domain.QcProCheck;
import java.util.List;
@ -17,7 +16,7 @@ public interface QcProCheckService {
List<QcProCheck> selectQcProCheck();
R<Boolean> saveQcProCheck(QcProCheck qcProCheck, BaseFile baseFile);
R<Boolean> saveQcProCheck(QcProCheck qcProCheck);
int updateQcProCheck(String rfid);

@ -1,10 +1,12 @@
package com.op.quality.service.serviceImpl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.domain.R;
//import com.op.quality.domain.BaseFile;
import com.op.quality.domain.BaseFile;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcProCheck;
import com.op.quality.mapper.BaseFileMapper;
import com.op.quality.mapper.QcProCheckMapper;
@ -12,9 +14,9 @@ import com.op.quality.service.QcProCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
@ -30,6 +32,7 @@ public class QcProCheckServiceImpl implements QcProCheckService {
@Autowired
private BaseFileMapper baseFileMapper;
@Override
// @DS("#header.poolName")
public List<QcProCheck> selectQcProCheck() {
@ -38,25 +41,31 @@ public class QcProCheckServiceImpl implements QcProCheckService {
}
@Override
// @DS("#header.poolName")
public R<Boolean> saveQcProCheck(QcProCheck qcProCheck, BaseFile baseFile) {
// System.out.println("qian"+DynamicDataSourceContextHolder.peek());
public R<Boolean> saveQcProCheck(QcProCheck qcProCheck) {
DynamicDataSourceContextHolder.push("ds_1000");
// System.out.println("hou"+DynamicDataSourceContextHolder.peek());
qcProCheck.setId(UUID.randomUUID().toString().replace("-", ""));
if (baseFile.getFileAddress()==null){
qcProCheckMapper.insertQcProCheck(qcProCheck);
//上传附件
if (StringUtils.isNotEmpty(qcProCheck.getFileId())) {
String[] ids = qcProCheck.getFileId().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(qcProCheck.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
else {
baseFile.setFileId(UUID.randomUUID().toString().replace("-", ""));
qcProCheck.setFileId(baseFile.getFileId());
qcProCheckMapper.insertQcProCheck(qcProCheck);
baseFileMapper.insertBaseFile(baseFile);
baseFileMapper.insertBaseFileBatch(files);
}
return R.ok(true);
qcProCheckMapper.insertQcProCheck(qcProCheck);
return R.ok();
}

@ -1,158 +0,0 @@
package com.op.quality.utils;
import com.op.common.core.exception.file.FileException;
import com.op.common.core.exception.file.FileNameLengthLimitExceededException;
import com.op.common.core.exception.file.FileSizeLimitExceededException;
import com.op.common.core.exception.file.InvalidExtensionException;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.file.FileTypeUtils;
import com.op.common.core.utils.file.MimeTypeUtils;
import com.op.common.core.utils.uuid.Seq;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Objects;
/**
*
*
* @author OP
*/
public class FileUploadUtils {
/**
* 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
/**
* 100
*/
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
/**
*
*
* @param baseDir
* @param file
* @return
* @throws IOException
*/
public static final String upload(String baseDir, MultipartFile file) throws IOException {
try {
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (FileException fe) {
throw new IOException(fe.getDefaultMessage(), fe);
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
}
}
/**
*
*
* @param baseDir
* @param file
* @param allowedExtension
* @return
* @throws FileSizeLimitExceededException
* @throws FileNameLengthLimitExceededException
* @throws IOException
* @throws InvalidExtensionException
*/
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
assertAllowed(file, allowedExtension);
String fileName = extractFilename(file);
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
file.transferTo(Paths.get(absPath));
return getPathFileName(fileName);
}
/**
*
*/
public static final String extractFilename(MultipartFile file) {
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType),
FileTypeUtils.getExtension(file));
}
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists()) {
if (!desc.getParentFile().exists()) {
desc.getParentFile().mkdirs();
}
}
return desc.isAbsolute() ? desc : desc.getAbsoluteFile();
}
private static final String getPathFileName(String fileName) throws IOException {
String pathFileName = "/" + fileName;
return pathFileName;
}
/**
*
*
* @param file
* @throws FileSizeLimitExceededException
* @throws InvalidExtensionException
*/
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException {
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) {
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
String fileName = file.getOriginalFilename();
String extension = FileTypeUtils.getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
fileName);
} else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
fileName);
} else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
fileName);
} else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
fileName);
} else {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
}
}
}
/**
* MIMEMIME
*
* @param extension
* @param allowedExtension
* @return true/false
*/
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
for (String str : allowedExtension) {
if (str.equalsIgnoreCase(extension)) {
return true;
}
}
return false;
}
}

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
namespace: lanju-op
group: jgy
group: zxl
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
namespace: lanju-op
group: jgy
group: zxl
#命名空间
#group: local
# 配置中心地址

Loading…
Cancel
Save