生产订单管理模块

highway
wws 1 year ago
parent 974dd13455
commit 585b4e5692

@ -6,7 +6,6 @@ import com.alibaba.ttl.TransmittableThreadLocal;
import com.op.common.core.constant.SecurityConstants;
import com.op.common.core.text.Convert;
import com.op.common.core.utils.StringUtils;
import sun.plugin2.main.server.Plugin;
/**
* 线 idToken HeaderInterceptor

@ -24,6 +24,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYYMMDDHHMMSSsss = "yyyyMMddHHmmssSSS";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

@ -2,6 +2,8 @@ package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.mes.domain.dto.SplitOrderDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -29,67 +31,122 @@ import com.op.common.core.utils.poi.ExcelUtil;
@RestController
@RequestMapping("/order")
public class ProOrderController extends BaseController {
@Autowired
private IProOrderService proOrderService;
@Autowired
private IProOrderService proOrderService;
/**
*
*
* @param id
* @return
*/
@GetMapping(value = "/getWorkOrderList/{id}")
public AjaxResult getWorkOrderList(@PathVariable("id") String id) {
return proOrderService.getWorkOrderList(id);
}
;
/**
*
*
* @param id
* @return
*/
@GetMapping(value = "/getOrderList/{id}")
public AjaxResult getOrderList(@PathVariable("id") String id) {
return proOrderService.getOrderList(id);
}
/**
*
*
* @param splitOrderDTO
* @return
*/
@PostMapping("/subSplitOrder")
public AjaxResult subSplitOrder(@RequestBody SplitOrderDTO splitOrderDTO) {
return proOrderService.subSplitOrder(splitOrderDTO);
}
/**
*
*
* @return
*/
@GetMapping("/getConvert")
public AjaxResult getConvert() {
return success(proOrderService.getConvert());
}
/**
* 线
*
* @return
*/
@GetMapping("/getProdLineShift")
public AjaxResult getProdLineShift() {
return success(proOrderService.getProdLineShift());
}
/**
*
*/
@RequiresPermissions("mes:pro:order:list")
@GetMapping("/list")
public AjaxResult list(ProOrder proOrder) {
List<ProOrder> list = proOrderService.selectProOrderList(proOrder);
return success(list);
}
/**
*
*/
@RequiresPermissions("mes:pro:order:list")
@GetMapping("/list")
public AjaxResult list(ProOrder proOrder) {
List<ProOrder> list = proOrderService.selectProOrderList(proOrder);
return success(list);
}
/**
*
*/
@RequiresPermissions("mes:pro:order:export")
@Log(title = "订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProOrder proOrder) {
List<ProOrder> list = proOrderService.selectProOrderList(proOrder);
ExcelUtil<ProOrder> util = new ExcelUtil<ProOrder>(ProOrder.class);
util.exportExcel(response, list, "订单数据");
}
/**
*
*/
@RequiresPermissions("mes:pro:order:export")
@Log(title = "订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProOrder proOrder) {
List<ProOrder> list = proOrderService.selectProOrderList(proOrder);
ExcelUtil<ProOrder> util = new ExcelUtil<ProOrder>(ProOrder.class);
util.exportExcel(response, list, "订单数据");
}
/**
*
*/
@RequiresPermissions("mes:pro:order:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(proOrderService.selectProOrderById(id));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(proOrderService.selectProOrderById(id));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:add")
@Log(title = "订单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProOrder proOrder) {
return toAjax(proOrderService.insertProOrder(proOrder));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:add")
@Log(title = "订单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProOrder proOrder) {
return toAjax(proOrderService.insertProOrder(proOrder));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:edit")
@Log(title = "订单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProOrder proOrder) {
return toAjax(proOrderService.updateProOrder(proOrder));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:edit")
@Log(title = "订单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProOrder proOrder) {
return toAjax(proOrderService.updateProOrder(proOrder));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:remove")
@Log(title = "订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(proOrderService.deleteProOrderByIds(ids));
}
/**
*
*/
@RequiresPermissions("mes:pro:order:remove")
@Log(title = "订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(proOrderService.deleteProOrderByIds(ids));
}
}

@ -0,0 +1,38 @@
package com.op.mes.domain;
/**
*
*/
public class Batch {
// 批次号
private String batchCode;
// 批次数量
private Long batchQuantity;
@Override
public String toString() {
return "Batch{" +
"batchCode='" + batchCode + '\'' +
", batchQuantity=" + batchQuantity +
'}';
}
public String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public Long getBatchQuantity() {
return batchQuantity;
}
public void setBatchQuantity(Long batchQuantity) {
this.batchQuantity = batchQuantity;
}
public Batch() {
}
}

@ -0,0 +1,61 @@
package com.op.mes.domain;
//换算值实体类
public class Convert {
private Integer dictCode;
private String dictLabel;
private String dictValue;
private String dictSort;
@Override
public String toString() {
return "Convert{" +
"dictCode=" + dictCode +
", dictLabel='" + dictLabel + '\'' +
", dictValue='" + dictValue + '\'' +
", dictSort='" + dictSort + '\'' +
'}';
}
public Integer getDictCode() {
return dictCode;
}
public void setDictCode(Integer dictCode) {
this.dictCode = dictCode;
}
public String getDictLabel() {
return dictLabel;
}
public void setDictLabel(String dictLabel) {
this.dictLabel = dictLabel;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getDictSort() {
return dictSort;
}
public void setDictSort(String dictSort) {
this.dictSort = dictSort;
}
public Convert(Integer dictCode, String dictLabel, String dictValue, String dictSort) {
this.dictCode = dictCode;
this.dictLabel = dictLabel;
this.dictValue = dictValue;
this.dictSort = dictSort;
}
public Convert() {
}
}

@ -0,0 +1,39 @@
package com.op.mes.domain;
//线体实体类
public class ProLine {
private String key;
private String label;
@Override
public String toString() {
return "ProLine{" +
"key='" + key + '\'' +
", label='" + label + '\'' +
'}';
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public ProLine(String key, String label) {
this.key = key;
this.label = label;
}
public ProLine() {
}
}

@ -1,6 +1,7 @@
package com.op.mes.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -108,6 +109,18 @@ public class ProOrder extends TreeEntity {
/** 产品类型 */
@Excel(name = "产品类型")
private String prodType;
/** 物料型号 */
@Excel(name = "物料名称")
private String prodSpc;
public String getProdSpc() {
return prodSpc;
}
public void setProdSpc(String prodSpc) {
this.prodSpc = prodSpc;
}
public void setId(String id) {
this.id = id;
@ -253,6 +266,7 @@ public class ProOrder extends TreeEntity {
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("prodType", getProdType())
.append("prodSpc", getProdSpc())
.toString();
}
}

@ -0,0 +1,345 @@
package com.op.mes.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.web.domain.TreeEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* pro_order_workorder
*
* @author Open Platform
* @date 2023-07-18
*/
public class ProOrderWorkorder extends TreeEntity {
private static final long serialVersionUID = 1L;
/** 工单ID */
private String workorderId;
/** 工单编码 */
@Excel(name = "工单编码")
private String workorderCode;
/** 工单名称 */
@Excel(name = "工单名称")
private String workorderName;
/** 订单id */
@Excel(name = "订单id")
private String orderId;
/** 订单编码 */
@Excel(name = "订单编码")
private String orderCode;
/** 产品ID */
@Excel(name = "产品ID")
private String productId;
/** 产品编号 */
@Excel(name = "产品编号")
private String productCode;
/** 产品名称 */
@Excel(name = "产品名称")
private String productName;
/** 规格型号 */
@Excel(name = "规格型号")
private String productSpc;
/** 单位 */
@Excel(name = "单位")
private String unit;
/** 已生产数量 */
@Excel(name = "已生产数量")
private Long quantityProduced;
/** 已拆分数量 */
@Excel(name = "已拆分数量")
private Long quantitySplit;
/** 工艺编码 */
@Excel(name = "工艺编码")
private String routeCode;
/** 产线编码 */
@Excel(name = "产线编码")
private String prodLineCode;
/** 工单生产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "工单生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
/** 班次 */
@Excel(name = "班次")
private String shiftId;
/** 父工单 */
@Excel(name = "父工单")
private String parentOrder;
/** 所有父节点ID */
@Excel(name = "所有父节点ID")
private String ancestors;
/** 单据状态 */
@Excel(name = "单据状态")
private String status;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
/** 产品类型 */
@Excel(name = "产品类型")
private String prodType;
/** 批次号 */
private StringBuilder batchCodeList;
public StringBuilder getBatchCodeList() {
return batchCodeList;
}
public void setBatchCodeList(StringBuilder batchCodeList) {
this.batchCodeList = batchCodeList;
}
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String factoryCode;
public void setWorkorderId(String workorderId) {
this.workorderId = workorderId;
}
public String getWorkorderId() {
return workorderId;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderName(String workorderName) {
this.workorderName = workorderName;
}
public String getWorkorderName() {
return workorderName;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getOrderId() {
return orderId;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getOrderCode() {
return orderCode;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductId() {
return productId;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setProductSpc(String productSpc) {
this.productSpc = productSpc;
}
public String getProductSpc() {
return productSpc;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getUnit() {
return unit;
}
public void setQuantityProduced(Long quantityProduced) {
this.quantityProduced = quantityProduced;
}
public Long getQuantityProduced() {
return quantityProduced;
}
public void setQuantitySplit(Long quantitySplit) {
this.quantitySplit = quantitySplit;
}
public Long getQuantitySplit() {
return quantitySplit;
}
public void setRouteCode(String routeCode) {
this.routeCode = routeCode;
}
public String getRouteCode() {
return routeCode;
}
public void setProdLineCode(String prodLineCode) {
this.prodLineCode = prodLineCode;
}
public String getProdLineCode() {
return prodLineCode;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
public Date getProductDate() {
return productDate;
}
public void setShiftId(String shiftId) {
this.shiftId = shiftId;
}
public String getShiftId() {
return shiftId;
}
public void setParentOrder(String parentOrder) {
this.parentOrder = parentOrder;
}
public String getParentOrder() {
return parentOrder;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public String getAncestors() {
return ancestors;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setProdType(String prodType) {
this.prodType = prodType;
}
public String getProdType() {
return prodType;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("workorderId", getWorkorderId())
.append("workorderCode", getWorkorderCode())
.append("workorderName", getWorkorderName())
.append("orderId", getOrderId())
.append("orderCode", getOrderCode())
.append("productId", getProductId())
.append("productCode", getProductCode())
.append("productName", getProductName())
.append("productSpc", getProductSpc())
.append("unit", getUnit())
.append("quantityProduced", getQuantityProduced())
.append("quantitySplit", getQuantitySplit())
.append("routeCode", getRouteCode())
.append("prodLineCode", getProdLineCode())
.append("productDate", getProductDate())
.append("shiftId", getShiftId())
.append("parentOrder", getParentOrder())
.append("ancestors", getAncestors())
.append("status", getStatus())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("prodType", getProdType())
.append("factoryCode", getFactoryCode())
.append("batchCodeList",getBatchCodeList())
.toString();
}
}

@ -0,0 +1,159 @@
package com.op.mes.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/**
* pro_order_workorder_batch
*
* @author Open Platform
* @date 2023-07-18
*/
public class ProOrderWorkorderBatch extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 批次ID */
@Excel(name = "批次ID")
private String batchId;
/** 工单ID */
private String workorderId;
/** 批次号 */
@Excel(name = "批次号")
private String batchCode;
/** 批次数量 */
@Excel(name = "批次数量")
private Long batchQuantity;
/** 单据状态 */
@Excel(name = "单据状态")
private String status;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
/** 产品类型 */
@Excel(name = "产品类型")
private String prodType;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String factoryCode;
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getBatchId() {
return batchId;
}
public void setWorkorderId(String workorderId) {
this.workorderId = workorderId;
}
public String getWorkorderId() {
return workorderId;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getBatchCode() {
return batchCode;
}
public void setBatchQuantity(Long batchQuantity) {
this.batchQuantity = batchQuantity;
}
public Long getBatchQuantity() {
return batchQuantity;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setProdType(String prodType) {
this.prodType = prodType;
}
public String getProdType() {
return prodType;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("batchId", getBatchId())
.append("workorderId", getWorkorderId())
.append("batchCode", getBatchCode())
.append("batchQuantity", getBatchQuantity())
.append("status", getStatus())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("prodType", getProdType())
.append("factoryCode", getFactoryCode())
.toString();
}
}

@ -0,0 +1,39 @@
package com.op.mes.domain;
//班次实体类
public class ProShift {
private Integer shiftId;
private String shiftDesc;
@Override
public String toString() {
return "ProShift{" +
"shiftId=" + shiftId +
", shiftDesc='" + shiftDesc + '\'' +
'}';
}
public Integer getShiftId() {
return shiftId;
}
public void setShiftId(Integer shiftId) {
this.shiftId = shiftId;
}
public String getShiftDesc() {
return shiftDesc;
}
public void setShiftDesc(String shiftDesc) {
this.shiftDesc = shiftDesc;
}
public ProShift(Integer shiftId, String shiftDesc) {
this.shiftId = shiftId;
this.shiftDesc = shiftDesc;
}
public ProShift() {
}
}

@ -0,0 +1,254 @@
package com.op.mes.domain.dto;
import java.util.Date;
import java.util.List;
public class ProOrderDTO {
/** ID */
private String id;
/** 计划工厂编码 */
private String factoryCode;
/** 订单类型 */
private String orderType;
/** 订单号 */
private String orderCode;
/** 物料号 */
private String prodCode;
/** 物料名称 */
private String prodDesc;
/** 订单数量 */
private Long quantity;
/** 已拆分数量 */
private Long quantitySplit;
/** 单位 */
private String unit;
/** 任务清单 */
private String workerOrder;
/** 计划生产日期 */
private Date planProDate;
/** 计划完成日期 */
private Date planComplete;
/** */
private String atrr1;
/** */
private String atrr2;
/** */
private String atrr3;
/** 0未拆分 */
private String status;
/** 上级工单 */
private String parentOrder;
/** 产品类型 */
private String prodType;
/** 物料型号 */
private String ProdSpc;
private List<ProOrderDTO> children;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getOrderType() {
return orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProdCode() {
return prodCode;
}
public void setProdCode(String prodCode) {
this.prodCode = prodCode;
}
public String getProdDesc() {
return prodDesc;
}
public void setProdDesc(String prodDesc) {
this.prodDesc = prodDesc;
}
public Long getQuantity() {
return quantity;
}
public void setQuantity(Long quantity) {
this.quantity = quantity;
}
public Long getQuantitySplit() {
return quantitySplit;
}
public void setQuantitySplit(Long quantitySplit) {
this.quantitySplit = quantitySplit;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getWorkerOrder() {
return workerOrder;
}
public void setWorkerOrder(String workerOrder) {
this.workerOrder = workerOrder;
}
public Date getPlanProDate() {
return planProDate;
}
public void setPlanProDate(Date planProDate) {
this.planProDate = planProDate;
}
public Date getPlanComplete() {
return planComplete;
}
public void setPlanComplete(Date planComplete) {
this.planComplete = planComplete;
}
public String getAtrr1() {
return atrr1;
}
public void setAtrr1(String atrr1) {
this.atrr1 = atrr1;
}
public String getAtrr2() {
return atrr2;
}
public void setAtrr2(String atrr2) {
this.atrr2 = atrr2;
}
public String getAtrr3() {
return atrr3;
}
public void setAtrr3(String atrr3) {
this.atrr3 = atrr3;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getParentOrder() {
return parentOrder;
}
public void setParentOrder(String parentOrder) {
this.parentOrder = parentOrder;
}
public String getProdType() {
return prodType;
}
public void setProdType(String prodType) {
this.prodType = prodType;
}
public String getProdSpc() {
return ProdSpc;
}
public void setProdSpc(String prodSpc) {
ProdSpc = prodSpc;
}
public List<ProOrderDTO> getChildren() {
return children;
}
public void setChildren(List<ProOrderDTO> children) {
this.children = children;
}
@Override
public String toString() {
return "ProOrderDTO{" +
"id='" + id + '\'' +
", factoryCode='" + factoryCode + '\'' +
", orderType='" + orderType + '\'' +
", orderCode='" + orderCode + '\'' +
", prodCode='" + prodCode + '\'' +
", prodDesc='" + prodDesc + '\'' +
", quantity=" + quantity +
", quantitySplit=" + quantitySplit +
", unit='" + unit + '\'' +
", workerOrder='" + workerOrder + '\'' +
", planProDate=" + planProDate +
", planComplete=" + planComplete +
", atrr1='" + atrr1 + '\'' +
", atrr2='" + atrr2 + '\'' +
", atrr3='" + atrr3 + '\'' +
", status='" + status + '\'' +
", parentOrder='" + parentOrder + '\'' +
", prodType='" + prodType + '\'' +
", ProdSpc='" + ProdSpc + '\'' +
", children=" + children +
'}';
}
public ProOrderDTO() {
}
}

@ -0,0 +1,86 @@
package com.op.mes.domain.dto;
import com.op.mes.domain.Batch;
import com.op.mes.domain.ProOrder;
import java.util.Date;
import java.util.List;
//接受前端拆分模型
public class SplitOrderDTO {
//批次号与批次数量
private List<Batch> formFields;
//产线
private String prodLineCode;
//日期
private Date productDate;
//班次
private String shiftId;
//拆分数量
private Long splitNum;
//所有改变的订单列表
private ProOrderDTO product;
public List<Batch> getFormFields() {
return formFields;
}
public void setFormFields(List<Batch> formFields) {
this.formFields = formFields;
}
public String getProdLineCode() {
return prodLineCode;
}
public void setProdLineCode(String prodLineCode) {
this.prodLineCode = prodLineCode;
}
public Date getProductDate() {
return productDate;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
public String getShiftId() {
return shiftId;
}
public void setShiftId(String shiftId) {
this.shiftId = shiftId;
}
public Long getSplitNum() {
return splitNum;
}
public void setSplitNum(Long splitNum) {
this.splitNum = splitNum;
}
public ProOrderDTO getProduct() {
return product;
}
public void setProduct(ProOrderDTO product) {
this.product = product;
}
@Override
public String toString() {
return "SplitOrderDTO{" +
"formFields=" + formFields +
", prodLineCode='" + prodLineCode + '\'' +
", productDate=" + productDate +
", shiftId='" + shiftId + '\'' +
", splitNum=" + splitNum +
", product=" + product +
'}';
}
public SplitOrderDTO() {
}
}

@ -0,0 +1,45 @@
package com.op.mes.domain.vo;
import com.op.mes.domain.ProLine;
import com.op.mes.domain.ProShift;
import java.util.List;
public class LineAndShiftVo {
//线体
private List<ProLine> lines;
//班次
private List<ProShift> shifts;
@Override
public String toString() {
return "LineAndShiftVo{" +
"lines=" + lines +
", shifts=" + shifts +
'}';
}
public List<ProLine> getLines() {
return lines;
}
public void setLines(List<ProLine> lines) {
this.lines = lines;
}
public List<ProShift> getShifts() {
return shifts;
}
public void setShifts(List<ProShift> shifts) {
this.shifts = shifts;
}
public LineAndShiftVo(List<ProLine> lines, List<ProShift> shifts) {
this.lines = lines;
this.shifts = shifts;
}
public LineAndShiftVo() {
}
}

@ -2,60 +2,137 @@ package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.Convert;
import com.op.mes.domain.ProLine;
import com.op.mes.domain.ProOrder;
import com.op.mes.domain.ProShift;
import org.apache.ibatis.annotations.Select;
/**
* Mapper
*
*
* @author Open Platform
* @date 2023-07-13
*/
public interface ProOrderMapper {
/**
*
*
* @param id
* @return
*/
public ProOrder selectProOrderById(String id);
/**
*
*
* @param proOrder
* @return
*/
public List<ProOrder> selectProOrderList(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int insertProOrder(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int updateProOrder(ProOrder proOrder);
/**
*
*
* @param id
* @return
*/
public int deleteProOrderById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteProOrderByIds(String[] ids);
/**
*
*
* @param proOrder
* @return
*/
public int updateOrder(ProOrder proOrder);
/**
*
*
* @param id
* @return
*/
public ProOrder selectProOrderById(String id);
/**
*
*
* @param proOrder
* @return
*/
public List<ProOrder> selectProOrderList(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int insertProOrder(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int updateProOrder(ProOrder proOrder);
/**
*
*
* @param id
* @return
*/
public int deleteProOrderById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteProOrderByIds(String[] ids);
/**
* 线
*
* @return
*/
@Select(" SELECT sf.f_code [key],sf.factory_name label FROM sys_factory sf WHERE sf.f_type='l' AND sf.status = '1' AND sf.del_flag = '0' ")
public List<ProLine> selectProdLine();
/**
*
*
* @return
*/
@Select("SELECT bst.Shift_Id shiftId,bst.Shift_Desc_Global shiftDesc FROM base_shifts_t bst")
public List<ProShift> selectProShift();
/**
*
*
* @return
*/
public List<Convert> selectConvert();
/**
* code线
*
* @return
*/
@Select("SELECT sf.factory_name name FROM sys_factory sf WHERE sf.f_type='l' AND sf.status = '1' AND sf.del_flag = '0' AND sf.f_code = #{prodLineCode}")
String selectProdLineName(String prodLineCode);
/**
* batchCode
*
* @return
*/
@Select("SELECT batch_code FROM pro_order_workorder_batch WHERE status = '1' GROUP BY batch_code")
List<String> selectBatchCodes();
/**
* parent_order
*
* @param orderCode
* @return
*/
List<ProOrder> selectChildProOrderByCode(String orderCode);
/**
* code线
* @param prodLineCode
* @return
*/
@Select("SELECT sf.factory_name FROM sys_factory sf WHERE sf.f_code = #{prodLineCode}")
String selectBatchNameByCode(String prodLineCode);
/**
* idlist
* @param workorderId
* @return
*/
@Select("SELECT powb.batch_code FROM pro_order_workorder_batch powb LEFT JOIN pro_order_workorder pow ON powb.workorder_id = pow.workorder_id WHERE pow.workorder_id = #{workorderId}")
List<String> selectBatchCodesById(String workorderId);
}

@ -0,0 +1,64 @@
package com.op.mes.mapper;
import com.op.mes.domain.Batch;
import com.op.mes.domain.ProOrderWorkorderBatch;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* Mapper
*
* @author Open Platform
* @date 2023-07-18
*/
public interface ProOrderWorkorderBatchMapper {
/**
*
*
* @param workorderId
* @return
*/
public ProOrderWorkorderBatch selectProOrderWorkorderBatchByWorkorderId(String workorderId);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public List<ProOrderWorkorderBatch> selectProOrderWorkorderBatchList(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public int insertProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public int updateProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param workorderId
* @return
*/
public int deleteProOrderWorkorderBatchByWorkorderId(String workorderId);
/**
*
*
* @param workorderIds
* @return
*/
public int deleteProOrderWorkorderBatchByWorkorderIds(String[] workorderIds);
}

@ -0,0 +1,77 @@
package com.op.mes.mapper;
import com.op.mes.domain.ProOrderWorkorder;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* Mapper
*
* @author Open Platform
* @date 2023-07-18
*/
public interface ProOrderWorkorderMapper {
/**
*
*
* @param workorderId
* @return
*/
public ProOrderWorkorder selectProOrderWorkorderByWorkorderId(String workorderId);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public int insertProOrderWorkorder(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public int updateProOrderWorkorder(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param workorderId
* @return
*/
public int deleteProOrderWorkorderByWorkorderId(String workorderId);
/**
*
*
* @param workorderIds
* @return
*/
public int deleteProOrderWorkorderByWorkorderIds(String[] workorderIds);
/**
* id
*
* @param id
* @return
*/
List<ProOrderWorkorder> selectFirWorkOrder(String id);
/**
* code
* @param workorderCode
* @return
*/
List<ProOrderWorkorder> selectChildWorkOrder(String workorderCode);
}

@ -1,60 +1,104 @@
package com.op.mes.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.Convert;
import com.op.mes.domain.ProOrder;
import com.op.mes.domain.dto.SplitOrderDTO;
import com.op.mes.domain.vo.LineAndShiftVo;
/**
* Service
*
*
* @author Open Platform
* @date 2023-07-13
*/
public interface IProOrderService {
/**
*
*
* @param id
* @return
*/
public ProOrder selectProOrderById(String id);
/**
*
*
* @param proOrder
* @return
*/
public List<ProOrder> selectProOrderList(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int insertProOrder(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int updateProOrder(ProOrder proOrder);
/**
*
*
* @param ids
* @return
*/
public int deleteProOrderByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteProOrderById(String id);
/**
* 线
*
* @return
*/
public LineAndShiftVo getProdLineShift();
/**
*
*
* @param id
* @return
*/
public ProOrder selectProOrderById(String id);
/**
*
*
* @param proOrder
* @return
*/
public List<ProOrder> selectProOrderList(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int insertProOrder(ProOrder proOrder);
/**
*
*
* @param proOrder
* @return
*/
public int updateProOrder(ProOrder proOrder);
/**
*
*
* @param ids
* @return
*/
public int deleteProOrderByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteProOrderById(String id);
/**
*
*
* @return
*/
public List<Convert> getConvert();
/**
*
*
* @param splitOrderDTO
* @return
*/
public AjaxResult subSplitOrder(SplitOrderDTO splitOrderDTO);
/**
*
*
* @param id
* @return
*/
public AjaxResult getWorkOrderList(String id);
/**
*
*
* @param id
* @return
*/
public AjaxResult getOrderList(String id);
}

@ -0,0 +1,61 @@
package com.op.mes.service;
import com.op.mes.domain.ProOrderWorkorderBatch;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-18
*/
public interface IProOrderWorkorderBatchService {
/**
*
*
* @param workorderId
* @return
*/
public ProOrderWorkorderBatch selectProOrderWorkorderBatchByWorkorderId(String workorderId);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public List<ProOrderWorkorderBatch> selectProOrderWorkorderBatchList(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public int insertProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
public int updateProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch);
/**
*
*
* @param workorderIds
* @return
*/
public int deleteProOrderWorkorderBatchByWorkorderIds(String[] workorderIds);
/**
*
*
* @param workorderId
* @return
*/
public int deleteProOrderWorkorderBatchByWorkorderId(String workorderId);
}

@ -0,0 +1,62 @@
package com.op.mes.service;
import com.op.mes.domain.ProOrderWorkorder;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-18
*/
public interface IProOrderWorkorderService {
/**
*
*
* @param workorderId
* @return
*/
public ProOrderWorkorder selectProOrderWorkorderByWorkorderId(String workorderId);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public int insertProOrderWorkorder(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param proOrderWorkorder
* @return
*/
public int updateProOrderWorkorder(ProOrderWorkorder proOrderWorkorder);
/**
*
*
* @param workorderIds
* @return
*/
public int deleteProOrderWorkorderByWorkorderIds(String[] workorderIds);
/**
*
*
* @param workorderId
* @return
*/
public int deleteProOrderWorkorderByWorkorderId(String workorderId);
}

@ -1,15 +1,27 @@
package com.op.mes.service.impl;
import java.util.List;
import java.util.*;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.*;
import com.op.mes.domain.dto.ProOrderDTO;
import com.op.mes.domain.dto.SplitOrderDTO;
import com.op.mes.domain.vo.LineAndShiftVo;
import com.op.mes.mapper.ProOrderWorkorderBatchMapper;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.ProOrderMapper;
import com.op.mes.domain.ProOrder;
import com.op.mes.service.IProOrderService;
import org.springframework.transaction.annotation.Transactional;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
@ -19,81 +31,360 @@ import com.op.mes.service.IProOrderService;
*/
@Service
public class ProOrderServiceImpl implements IProOrderService {
@Autowired
private ProOrderMapper proOrderMapper;
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public ProOrder selectProOrderById(String id) {
return proOrderMapper.selectProOrderById(id);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public List<ProOrder> selectProOrderList(ProOrder proOrder) {
return proOrderMapper.selectProOrderList(proOrder);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public int insertProOrder(ProOrder proOrder) {
proOrder.setId(IdUtils.fastSimpleUUID());
proOrder.setCreateTime(DateUtils.getNowDate());
return proOrderMapper.insertProOrder(proOrder);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public int updateProOrder(ProOrder proOrder) {
proOrder.setUpdateTime(DateUtils.getNowDate());
return proOrderMapper.updateProOrder(proOrder);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProOrderByIds(String[] ids) {
return proOrderMapper.deleteProOrderByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProOrderById(String id) {
return proOrderMapper.deleteProOrderById(id);
}
}
@Autowired
private ProOrderMapper proOrderMapper;
@Autowired
private ProOrderWorkorderMapper proOrderWorkorderMapper;
@Autowired
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
/**
*
*
* @return
*/
@Override
@DS("master")
public List<Convert> getConvert() {
return proOrderMapper.selectConvert();
}
/**
*
*
* @param splitOrderDTO
* @return
*/
@Override
@Transactional
@DS("#header.poolName")
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;
}
}
}
// 如果不重复
if (checkout) {
ProOrder product = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
// 设置通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId());
// 生成对应工单表
// 一级
ProOrderWorkorder firWorkOrder = setWorkOrder(proOrderWorkorder, product);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
// 创建通用批次表对象
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), firWorkOrder.getWorkorderId());
// 二级
if (splitOrderDTO.getProduct().getChildren() != null) {
List<ProOrderDTO> secProOrderList = splitOrderDTO.getProduct().getChildren();
BeanUtils.copyProperties(secProOrderList.get(0), product);
// 设置父工单
proOrderWorkorder.setParentOrder(firWorkOrder.getWorkorderCode());
ProOrderWorkorder secWorkOrder = setWorkOrder(proOrderWorkorder, product);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(secWorkOrder);
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), secWorkOrder.getWorkorderId());
// 三级
if (secProOrderList.get(0).getChildren() != null) {
List<ProOrderDTO> thiProOrderList = secProOrderList.get(0).getChildren();
BeanUtils.copyProperties(thiProOrderList.get(0), product);
// 设置父工单
proOrderWorkorder.setParentOrder(secWorkOrder.getWorkorderCode());
ProOrderWorkorder thiWorkOrder = setWorkOrder(proOrderWorkorder, product);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(thiWorkOrder);
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), thiWorkOrder.getWorkorderId());
}
}
return success();
}
return error(500, "批次号不能重复");
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getWorkOrderList(String id) {
// 通过订单id查询所有工单信息list
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrder(id);
// 母工单循环遍历
for (int i = 0;i < proOrderWorkorderList.size();i++){
// 通过设备code查询出设备名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderList.get(i).getProdLineCode());
// 这里因为没有相对应字段所以用atrr1来表示批次号list
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorderList.get(i).getWorkorderId());
// 格式化数据
StringBuilder batchCodes = new StringBuilder();
for (int j = 0;j < batchCodeList.size();j++){
batchCodes.append(batchCodeList.get(j));
batchCodes.append(";");
}
// 通过母工单workorder_id查询子工单
// 二级
List<ProOrderWorkorder> secProOrderWorkorder = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorderList.get(i).getWorkorderCode());
if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null){
// 三级
List<ProOrderWorkorder> thiProOrderWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(secProOrderWorkorder.get(0).getWorkorderCode());
if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null){
// 将三级放入二级child
thiProOrderWorkorders.get(0).setProdLineCode(prodLineName);
thiProOrderWorkorders.get(0).setBatchCodeList(batchCodes);
secProOrderWorkorder.get(0).setChildren(thiProOrderWorkorders);
}
// 将二级放入到母工单child
secProOrderWorkorder.get(0).setProdLineCode(prodLineName);
secProOrderWorkorder.get(0).setBatchCodeList(batchCodes);
proOrderWorkorderList.get(i).setChildren(secProOrderWorkorder);
}
proOrderWorkorderList.get(i).setProdLineCode(prodLineName);
proOrderWorkorderList.get(i).setBatchCodeList(batchCodes);
}
return success(proOrderWorkorderList);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getOrderList(String id) {
// 注意判空不为空则放入 (避免空指针)
// 通过母工单id查询母订单详情
ProOrder proOrder = proOrderMapper.selectProOrderById(id);
// 查询二级
List<ProOrder> secProOrderList = proOrderMapper.selectChildProOrderByCode(proOrder.getOrderCode());
if (secProOrderList != null || secProOrderList.size() > 0) {
// 查询三级
List<ProOrder> thiProOrderList = proOrderMapper.selectChildProOrderByCode(secProOrderList.get(0).getOrderCode());
if (thiProOrderList != null || thiProOrderList.size() > 0) {
// 将三级Order放入二级
secProOrderList.get(0).setChildren(thiProOrderList);
}
}
// 将二级Order放入母订单
proOrder.setChildren(secProOrderList);
return success(proOrder);
}
/**
* 线
*
* @return
*/
@Override
@DS("#header.poolName")
public LineAndShiftVo getProdLineShift() {
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift());
return lineAndShiftVo;
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public ProOrder selectProOrderById(String id) {
return proOrderMapper.selectProOrderById(id);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public List<ProOrder> selectProOrderList(ProOrder proOrder) {
return proOrderMapper.selectProOrderList(proOrder);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public int insertProOrder(ProOrder proOrder) {
proOrder.setId(IdUtils.fastSimpleUUID());
proOrder.setCreateTime(DateUtils.getNowDate());
return proOrderMapper.insertProOrder(proOrder);
}
/**
*
*
* @param proOrder
* @return
*/
@Override
@DS("#header.poolName")
public int updateProOrder(ProOrder proOrder) {
proOrder.setUpdateTime(DateUtils.getNowDate());
return proOrderMapper.updateProOrder(proOrder);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProOrderByIds(String[] ids) {
return proOrderMapper.deleteProOrderByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProOrderById(String id) {
return proOrderMapper.deleteProOrderById(id);
}
/**
*
*
* @param proOrder
* @return
*/
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
// 更新者
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
// 创建者
proOrderWorkorder.setCreateBy(SecurityContextHolder.getUserName());
// 工单生产日期
proOrderWorkorder.setProductDate(date);
// 产品(物料)编码
proOrderWorkorder.setProductCode(proOrder.getProdCode());
// TODO 产品(物料)名称
proOrderWorkorder.setProductName("测试ing");
// 产品(物料)规格型号
proOrderWorkorder.setProductSpc(proOrder.getProdSpc());
// 产线
proOrderWorkorder.setProdLineCode(proLineCode);
// 班次
proOrderWorkorder.setShiftId(shiftId);
// TODO 产品类型(pro_type)
// 单据状态(1为正常)
proOrderWorkorder.setStatus("1");
return proOrderWorkorder;
}
/**
*
*
* @param proOrderWorkorder
* @param proOrder
* @return
*/
private ProOrderWorkorder setWorkOrder(ProOrderWorkorder proOrderWorkorder, ProOrder proOrder) {
// 获取当前时间
Date date = new Date();
// 订单表更新时间/更新者
proOrder.setUpdateBy(SecurityContextHolder.getUserName());
proOrder.setUpdateTime(date);
// 更新订单表
proOrderMapper.updateOrder(proOrder);
// 生成对应的工单表
// 生成id
proOrderWorkorder.setWorkorderId(IdUtils.fastSimpleUUID());
// 生成工单号
proOrderWorkorder.setWorkorderCode("GD" + DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, date));
// TODO 工单名称
proOrderWorkorder.setWorkorderName("测试ing");
// 订单id
proOrderWorkorder.setOrderId(proOrder.getId());
// 订单编码
proOrderWorkorder.setOrderCode(proOrder.getOrderCode());
// 单位
proOrderWorkorder.setUnit(proOrder.getUnit());
// 已拆分数量
proOrderWorkorder.setQuantitySplit(Long.valueOf(proOrder.getAtrr1()));
// TODO 工艺编码
// TODO 所有父节点
return proOrderWorkorder;
}
/**
*
*
* @return
*/
private ProOrderWorkorderBatch setCommonBatchAttribute() {
ProOrderWorkorderBatch workBatch = new ProOrderWorkorderBatch();
Date date = new Date();
// 更新者
workBatch.setUpdateBy(SecurityContextHolder.getUserName());
// 创建者
workBatch.setCreateBy(SecurityContextHolder.getUserName());
// 设置单据状态1正常
workBatch.setStatus("1");
return workBatch;
}
/**
*
*
* @param workBatch
* @param batchList
* @param workOrderId
*/
private void setBatch(ProOrderWorkorderBatch workBatch, List<Batch> batchList, String workOrderId) {
// 工单id
workBatch.setWorkorderId(workOrderId);
// TODO 产品类型
for (int i = 0; i < batchList.size(); i++) {
// 生成批次id
workBatch.setBatchId(IdUtils.fastSimpleUUID());
Batch batch = batchList.get(i);
// 获取批次号
workBatch.setBatchCode(batch.getBatchCode());
// 获取批次数量
workBatch.setBatchQuantity(batch.getBatchQuantity());
// 更新至数据库
proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(workBatch);
}
}
}

@ -0,0 +1,90 @@
package com.op.mes.service.impl;
import com.op.common.core.utils.DateUtils;
import com.op.mes.domain.ProOrderWorkorderBatch;
import com.op.mes.mapper.ProOrderWorkorderBatchMapper;
import com.op.mes.service.IProOrderWorkorderBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-18
*/
@Service
public class ProOrderWorkorderBatchServiceImpl implements IProOrderWorkorderBatchService {
@Autowired
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
/**
*
*
* @param workorderId
* @return
*/
@Override
public ProOrderWorkorderBatch selectProOrderWorkorderBatchByWorkorderId(String workorderId) {
return proOrderWorkorderBatchMapper.selectProOrderWorkorderBatchByWorkorderId(workorderId);
}
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
@Override
public List<ProOrderWorkorderBatch> selectProOrderWorkorderBatchList(ProOrderWorkorderBatch proOrderWorkorderBatch) {
return proOrderWorkorderBatchMapper.selectProOrderWorkorderBatchList(proOrderWorkorderBatch);
}
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
@Override
public int insertProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch) {
proOrderWorkorderBatch.setCreateTime(DateUtils.getNowDate());
return proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(proOrderWorkorderBatch);
}
/**
*
*
* @param proOrderWorkorderBatch
* @return
*/
@Override
public int updateProOrderWorkorderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch) {
proOrderWorkorderBatch.setUpdateTime(DateUtils.getNowDate());
return proOrderWorkorderBatchMapper.updateProOrderWorkorderBatch(proOrderWorkorderBatch);
}
/**
*
*
* @param workorderIds
* @return
*/
@Override
public int deleteProOrderWorkorderBatchByWorkorderIds(String[] workorderIds) {
return proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(workorderIds);
}
/**
*
*
* @param workorderId
* @return
*/
@Override
public int deleteProOrderWorkorderBatchByWorkorderId(String workorderId) {
return proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderId(workorderId);
}
}

@ -0,0 +1,91 @@
package com.op.mes.service.impl;
import com.op.common.core.utils.DateUtils;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import com.op.mes.service.IProOrderWorkorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-18
*/
@Service
public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
@Autowired
private ProOrderWorkorderMapper proOrderWorkorderMapper;
/**
*
*
* @param workorderId
* @return
*/
@Override
public ProOrderWorkorder selectProOrderWorkorderByWorkorderId(String workorderId) {
return proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId);
}
/**
*
*
* @param proOrderWorkorder
* @return
*/
@Override
public List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) {
return proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder);
}
/**
*
*
* @param proOrderWorkorder
* @return
*/
@Override
public int insertProOrderWorkorder(ProOrderWorkorder proOrderWorkorder) {
proOrderWorkorder.setCreateTime(DateUtils.getNowDate());
return proOrderWorkorderMapper.insertProOrderWorkorder(proOrderWorkorder);
}
/**
*
*
* @param proOrderWorkorder
* @return
*/
@Override
public int updateProOrderWorkorder(ProOrderWorkorder proOrderWorkorder) {
proOrderWorkorder.setUpdateTime(DateUtils.getNowDate());
return proOrderWorkorderMapper.updateProOrderWorkorder(proOrderWorkorder);
}
/**
*
*
* @param workorderIds
* @return
*/
@Override
public int deleteProOrderWorkorderByWorkorderIds(String[] workorderIds) {
return proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds);
}
/**
*
*
* @param workorderId
* @return
*/
@Override
public int deleteProOrderWorkorderByWorkorderId(String workorderId) {
return proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderId(workorderId);
}
}

@ -28,13 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="prodSpc" column="prod_spc" />
</resultMap>
<sql id="selectProOrderVo">
select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split
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
factory_code, prod_spc
from pro_order
</sql>
@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="parentOrder != null and parentOrder != ''"> and parent_order = #{parentOrder}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="prodSpc != null and prodSpc != ''"> and prod_spc = #{prodSpc}</if>
</where>
</select>
@ -66,6 +68,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectConvert" resultType="com.op.mes.domain.Convert">
SELECT dict_code dictCode , dict_label dictLabel , dict_value dictValue , dict_sort dictSort FROM sys_dict_data WHERE dict_type = 'convert_type'
</select>
<select id="selectChildProOrderByCode" parameterType="String" resultMap="ProOrderResult">
<include refid="selectProOrderVo"/>
where parent_order = #{orderCode}
</select>
<insert id="insertProOrder" parameterType="ProOrder">
insert into pro_order
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -92,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="prodType != null">prod_type,</if>
<if test="prodSpc != null">prod_spc,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -117,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="prodType != null">#{prodType},</if>
<if test="prodSpc != null">#{prodSpc},</if>
</trim>
</insert>
@ -145,6 +158,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="prodSpc != null">prod_spc = #{prodSpc},</if>
</trim>
where id = #{id}
</update>
<update id="updateOrder">
update pro_order
<trim prefix="SET" suffixOverrides=",">
<if test="atrr1 != null">quantity_split += #{atrr1},</if>
<if test="updateBy != null">create_by = #{updateBy},</if>
<if test="updateTime != null">create_time = #{updateTime},</if>
status = 1,
</trim>
where id = #{id}
</update>

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.mes.mapper.ProOrderWorkorderBatchMapper">
<resultMap type="ProOrderWorkorderBatch" id="ProOrderWorkorderBatchResult">
<result property="batchId" column="batch_id" />
<result property="workorderId" column="workorder_id" />
<result property="batchCode" column="batch_code" />
<result property="batchQuantity" column="batch_quantity" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="factoryCode" column="factory_code" />
</resultMap>
<sql id="selectProOrderWorkorderBatchVo">
select batch_id, workorder_id, batch_code, batch_quantity, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code from pro_order_workorder_batch
</sql>
<select id="selectProOrderWorkorderBatchList" parameterType="ProOrderWorkorderBatch" resultMap="ProOrderWorkorderBatchResult">
<include refid="selectProOrderWorkorderBatchVo"/>
<where>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="batchQuantity != null "> and batch_quantity = #{batchQuantity}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectProOrderWorkorderBatchByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderBatchResult">
<include refid="selectProOrderWorkorderBatchVo"/>
where workorder_id = #{workorderId}
</select>
<insert id="insertProOrderWorkorderBatch" parameterType="ProOrderWorkorderBatch">
insert into pro_order_workorder_batch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="batchId != null and batchId != ''">batch_id,</if>
<if test="workorderId != null">workorder_id,</if>
<if test="batchCode != null">batch_code,</if>
<if test="batchQuantity != null">batch_quantity,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="prodType != null">prod_type,</if>
<if test="factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="batchId != null and batchId != ''">#{batchId},</if>
<if test="workorderId != null">#{workorderId},</if>
<if test="batchCode != null">#{batchCode},</if>
<if test="batchQuantity != null">#{batchQuantity},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="prodType != null">#{prodType},</if>
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
<update id="updateProOrderWorkorderBatch" parameterType="ProOrderWorkorderBatch">
update pro_order_workorder_batch
<trim prefix="SET" suffixOverrides=",">
<if test="batchId != null and batchId != ''">batch_id = #{batchId},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if>
<if test="batchQuantity != null">batch_quantity = #{batchQuantity},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where workorder_id = #{workorderId}
</update>
<delete id="deleteProOrderWorkorderBatchByWorkorderId" parameterType="String">
delete from pro_order_workorder_batch where workorder_id = #{workorderId}
</delete>
<delete id="deleteProOrderWorkorderBatchByWorkorderIds" parameterType="String">
delete from pro_order_workorder_batch where workorder_id in
<foreach item="workorderId" collection="array" open="(" separator="," close=")">
#{workorderId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.mes.mapper.ProOrderWorkorderMapper">
<resultMap type="ProOrderWorkorder" id="ProOrderWorkorderResult">
<result property="workorderId" column="workorder_id" />
<result property="workorderCode" column="workorder_code" />
<result property="workorderName" column="workorder_name" />
<result property="orderId" column="order_id" />
<result property="orderCode" column="order_code" />
<result property="productId" column="product_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="productSpc" column="product_spc" />
<result property="unit" column="unit" />
<result property="quantityProduced" column="quantity_produced" />
<result property="quantitySplit" column="quantity_split" />
<result property="routeCode" column="route_code" />
<result property="prodLineCode" column="prod_line_code" />
<result property="productDate" column="product_date" />
<result property="shiftId" column="shift_id" />
<result property="parentOrder" column="parent_order" />
<result property="ancestors" column="ancestors" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="factoryCode" column="factory_code" />
</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 from pro_order_workorder
</sql>
<select id="selectProOrderWorkorderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
<where>
<if test="workorderCode != null and workorderCode != ''"> and workorder_code = #{workorderCode}</if>
<if test="workorderName != null and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="productSpc != null and productSpc != ''"> and product_spc = #{productSpc}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="quantityProduced != null "> and quantity_produced = #{quantityProduced}</if>
<if test="quantitySplit != null "> and quantity_split = #{quantitySplit}</if>
<if test="routeCode != null and routeCode != ''"> and route_code = #{routeCode}</if>
<if test="prodLineCode != null and prodLineCode != ''"> and prod_line_code = #{prodLineCode}</if>
<if test="productDate != null "> and product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''"> and shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''"> and parent_order = #{parentOrder}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectProOrderWorkorderByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where workorder_id = #{workorderId}
</select>
<select id="selectFirWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
SELECT pow.*
FROM pro_order_workorder pow LEFT JOIN pro_order po
ON pow.order_id = po.id
WHERE po.id = #{id}
</select>
<select id="selectChildWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
WHERE parent_order = #{workorderCode}
</select>
<insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder">
insert into pro_order_workorder
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workorderId != null">workorder_id,</if>
<if test="workorderCode != null and workorderCode != ''">workorder_code,</if>
<if test="workorderName != null and workorderName != ''">workorder_name,</if>
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="orderCode != null">order_code,</if>
<if test="productId != null">product_id,</if>
<if test="productCode != null and productCode != ''">product_code,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="productSpc != null">product_spc,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="quantityProduced != null">quantity_produced,</if>
<if test="quantitySplit != null">quantity_split,</if>
<if test="routeCode != null">route_code,</if>
<if test="prodLineCode != null">prod_line_code,</if>
<if test="productDate != null">product_date,</if>
<if test="shiftId != null">shift_id,</if>
<if test="parentOrder != null">parent_order,</if>
<if test="ancestors != null">ancestors,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="prodType != null">prod_type,</if>
<if test="factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workorderId != null">#{workorderId},</if>
<if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>
<if test="workorderName != null and workorderName != ''">#{workorderName},</if>
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="orderCode != null">#{orderCode},</if>
<if test="productId != null">#{productId},</if>
<if test="productCode != null and productCode != ''">#{productCode},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="productSpc != null">#{productSpc},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="quantityProduced != null">#{quantityProduced},</if>
<if test="quantitySplit != null">#{quantitySplit},</if>
<if test="routeCode != null">#{routeCode},</if>
<if test="prodLineCode != null">#{prodLineCode},</if>
<if test="productDate != null">#{productDate},</if>
<if test="shiftId != null">#{shiftId},</if>
<if test="parentOrder != null">#{parentOrder},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="prodType != null">#{prodType},</if>
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
<update id="updateProOrderWorkorder" parameterType="ProOrderWorkorder">
update pro_order_workorder
<trim prefix="SET" suffixOverrides=",">
<if test="workorderCode != null and workorderCode != ''">workorder_code = #{workorderCode},</if>
<if test="workorderName != null and workorderName != ''">workorder_name = #{workorderName},</if>
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="productSpc != null">product_spc = #{productSpc},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
<if test="quantityProduced != null">quantity_produced = #{quantityProduced},</if>
<if test="quantitySplit != null">quantity_split = #{quantitySplit},</if>
<if test="routeCode != null">route_code = #{routeCode},</if>
<if test="prodLineCode != null">prod_line_code = #{prodLineCode},</if>
<if test="productDate != null">product_date = #{productDate},</if>
<if test="shiftId != null">shift_id = #{shiftId},</if>
<if test="parentOrder != null">parent_order = #{parentOrder},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where workorder_id = #{workorderId}
</update>
<delete id="deleteProOrderWorkorderByWorkorderId" parameterType="String">
delete from pro_order_workorder where workorder_id = #{workorderId}
</delete>
<delete id="deleteProOrderWorkorderByWorkorderIds" parameterType="String">
delete from pro_order_workorder where workorder_id in
<foreach item="workorderId" collection="array" open="(" separator="," close=")">
#{workorderId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save