diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/ProOrderController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProOrderController.java new file mode 100644 index 00000000..b1e58a5e --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProOrderController.java @@ -0,0 +1,95 @@ +package com.op.mes.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.mes.domain.ProOrder; +import com.op.mes.service.IProOrderService; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.utils.poi.ExcelUtil; + +/** + * 订单Controller + * + * @author Open Platform + * @date 2023-07-13 + */ +@RestController +@RequestMapping("/order") +public class ProOrderController extends BaseController { + @Autowired + private IProOrderService proOrderService; + + /** + * 查询订单列表 + */ + @RequiresPermissions("order:order:list") + @GetMapping("/list") + public AjaxResult list(ProOrder proOrder) { + List list = proOrderService.selectProOrderList(proOrder); + return success(list); + } + + /** + * 导出订单列表 + */ + @RequiresPermissions("order:order:export") + @Log(title = "订单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProOrder proOrder) { + List list = proOrderService.selectProOrderList(proOrder); + ExcelUtil util = new ExcelUtil(ProOrder.class); + util.exportExcel(response, list, "订单数据"); + } + + /** + * 获取订单详细信息 + */ + @RequiresPermissions("order:order:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + return success(proOrderService.selectProOrderById(id)); + } + + /** + * 新增订单 + */ + @RequiresPermissions("order:order:add") + @Log(title = "订单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProOrder proOrder) { + return toAjax(proOrderService.insertProOrder(proOrder)); + } + + /** + * 修改订单 + */ + @RequiresPermissions("order:order:edit") + @Log(title = "订单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProOrder proOrder) { + return toAjax(proOrderService.updateProOrder(proOrder)); + } + + /** + * 删除订单 + */ + @RequiresPermissions("order:order:remove") + @Log(title = "订单", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + return toAjax(proOrderService.deleteProOrderByIds(ids)); + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProOrder.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProOrder.java new file mode 100644 index 00000000..4edd88ab --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProOrder.java @@ -0,0 +1,234 @@ +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; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.TreeEntity; + +/** + * 订单对象 pro_order + * + * @author Open Platform + * @date 2023-07-13 + */ +public class ProOrder extends TreeEntity { + private static final long serialVersionUID = 1L; + + /** ID */ + private String id; + + /** 计划工厂编码 */ + @Excel(name = "计划工厂编码") + private String factoryCode; + + /** 订单类型 */ + @Excel(name = "订单类型") + private String orderType; + + /** 订单号 */ + @Excel(name = "订单号") + private String orderCode; + + /** 物料号 */ + @Excel(name = "物料号") + private String prodCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String prodDesc; + + /** 订单数量 */ + @Excel(name = "订单数量") + private Long quantity; + + /** 单位 */ + @Excel(name = "单位") + private String unit; + + /** 任务清单 */ + @Excel(name = "任务清单") + private String workerOrder; + + /** 计划生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划生产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planProDate; + + /** 计划完成日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划完成日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planComplete; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String atrr1; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String atrr2; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String atrr3; + + /** 0未拆分 */ + @Excel(name = "0未拆分") + private String status; + + /** 上级工单 */ + @Excel(name = "上级工单") + private String parentOrder; + + /** 产品类型 */ + @Excel(name = "产品类型") + private String prodType; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + + public String getOrderType() { + return orderType; + } + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderCode() { + return orderCode; + } + public void setProdCode(String prodCode) { + this.prodCode = prodCode; + } + + public String getProdCode() { + return prodCode; + } + public void setProdDesc(String prodDesc) { + this.prodDesc = prodDesc; + } + + public String getProdDesc() { + return prodDesc; + } + public void setQuantity(Long quantity) { + this.quantity = quantity; + } + + public Long getQuantity() { + return quantity; + } + public void setUnit(String unit) { + this.unit = unit; + } + + public String getUnit() { + return unit; + } + public void setWorkerOrder(String workerOrder) { + this.workerOrder = workerOrder; + } + + public String getWorkerOrder() { + return workerOrder; + } + public void setPlanProDate(Date planProDate) { + this.planProDate = planProDate; + } + + public Date getPlanProDate() { + return planProDate; + } + public void setPlanComplete(Date planComplete) { + this.planComplete = planComplete; + } + + public Date getPlanComplete() { + return planComplete; + } + public void setAtrr1(String atrr1) { + this.atrr1 = atrr1; + } + + public String getAtrr1() { + return atrr1; + } + public void setAtrr2(String atrr2) { + this.atrr2 = atrr2; + } + + public String getAtrr2() { + return atrr2; + } + public void setAtrr3(String atrr3) { + this.atrr3 = atrr3; + } + + public String getAtrr3() { + return atrr3; + } + public void setStatus(String status) { + this.status = status; + } + + public String getStatus() { + return status; + } + public void setParentOrder(String parentOrder) { + this.parentOrder = parentOrder; + } + + public String getParentOrder() { + return parentOrder; + } + public void setProdType(String prodType) { + this.prodType = prodType; + } + + public String getProdType() { + return prodType; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("factoryCode", getFactoryCode()) + .append("orderType", getOrderType()) + .append("orderCode", getOrderCode()) + .append("prodCode", getProdCode()) + .append("prodDesc", getProdDesc()) + .append("quantity", getQuantity()) + .append("unit", getUnit()) + .append("workerOrder", getWorkerOrder()) + .append("planProDate", getPlanProDate()) + .append("planComplete", getPlanComplete()) + .append("atrr1", getAtrr1()) + .append("atrr2", getAtrr2()) + .append("atrr3", getAtrr3()) + .append("status", getStatus()) + .append("parentOrder", getParentOrder()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("prodType", getProdType()) + .toString(); + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderMapper.java new file mode 100644 index 00000000..814275d7 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProOrderMapper.java @@ -0,0 +1,61 @@ +package com.op.mes.mapper; + +import java.util.List; + +import com.op.mes.domain.ProOrder; + +/** + * 订单Mapper接口 + * + * @author Open Platform + * @date 2023-07-13 + */ +public interface ProOrderMapper { + /** + * 查询订单 + * + * @param id 订单主键 + * @return 订单 + */ + public ProOrder selectProOrderById(String id); + + /** + * 查询订单列表 + * + * @param proOrder 订单 + * @return 订单集合 + */ + public List 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); +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IProOrderService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IProOrderService.java new file mode 100644 index 00000000..f766c184 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IProOrderService.java @@ -0,0 +1,60 @@ +package com.op.mes.service; + +import java.util.List; +import com.op.mes.domain.ProOrder; + +/** + * 订单Service接口 + * + * @author Open Platform + * @date 2023-07-13 + */ +public interface IProOrderService { + /** + * 查询订单 + * + * @param id 订单主键 + * @return 订单 + */ + public ProOrder selectProOrderById(String id); + + /** + * 查询订单列表 + * + * @param proOrder 订单 + * @return 订单集合 + */ + public List 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); +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java new file mode 100644 index 00000000..72f6e235 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java @@ -0,0 +1,89 @@ +package com.op.mes.service.impl; + +import java.util.List; +import com.op.common.core.utils.DateUtils; +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; + +/** + * 订单Service业务层处理 + * + * @author Open Platform + * @date 2023-07-13 + */ +@Service +public class ProOrderServiceImpl implements IProOrderService { + @Autowired + private ProOrderMapper proOrderMapper; + + /** + * 查询订单 + * + * @param id 订单主键 + * @return 订单 + */ + @Override + public ProOrder selectProOrderById(String id) { + return proOrderMapper.selectProOrderById(id); + } + + /** + * 查询订单列表 + * + * @param proOrder 订单 + * @return 订单 + */ + @Override + public List selectProOrderList(ProOrder proOrder) { + return proOrderMapper.selectProOrderList(proOrder); + } + + /** + * 新增订单 + * + * @param proOrder 订单 + * @return 结果 + */ + @Override + public int insertProOrder(ProOrder proOrder) { + proOrder.setCreateTime(DateUtils.getNowDate()); + return proOrderMapper.insertProOrder(proOrder); + } + + /** + * 修改订单 + * + * @param proOrder 订单 + * @return 结果 + */ + @Override + public int updateProOrder(ProOrder proOrder) { + proOrder.setUpdateTime(DateUtils.getNowDate()); + return proOrderMapper.updateProOrder(proOrder); + } + + /** + * 批量删除订单 + * + * @param ids 需要删除的订单主键 + * @return 结果 + */ + @Override + public int deleteProOrderByIds(String[] ids) { + return proOrderMapper.deleteProOrderByIds(ids); + } + + /** + * 删除订单信息 + * + * @param id 订单主键 + * @return 结果 + */ + @Override + public int deleteProOrderById(String id) { + return proOrderMapper.deleteProOrderById(id); + } +} diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml new file mode 100644 index 00000000..5c30980f --- /dev/null +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, factory_code, order_type, order_code, prod_code, prod_desc, quantity, unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3, status, parent_order, create_by, create_time, update_by, update_time, prod_type from pro_order + + + + + + + + insert into pro_order + + id, + factory_code, + order_type, + order_code, + prod_code, + prod_desc, + quantity, + unit, + worker_order, + plan_pro_date, + plan_complete, + atrr1, + atrr2, + atrr3, + status, + parent_order, + create_by, + create_time, + update_by, + update_time, + prod_type, + + + #{id}, + #{factoryCode}, + #{orderType}, + #{orderCode}, + #{prodCode}, + #{prodDesc}, + #{quantity}, + #{unit}, + #{workerOrder}, + #{planProDate}, + #{planComplete}, + #{atrr1}, + #{atrr2}, + #{atrr3}, + #{status}, + #{parentOrder}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{prodType}, + + + + + update pro_order + + factory_code = #{factoryCode}, + order_type = #{orderType}, + order_code = #{orderCode}, + prod_code = #{prodCode}, + prod_desc = #{prodDesc}, + quantity = #{quantity}, + unit = #{unit}, + worker_order = #{workerOrder}, + plan_pro_date = #{planProDate}, + plan_complete = #{planComplete}, + atrr1 = #{atrr1}, + atrr2 = #{atrr2}, + atrr3 = #{atrr3}, + status = #{status}, + parent_order = #{parentOrder}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + prod_type = #{prodType}, + + where id = #{id} + + + + delete from pro_order where id = #{id} + + + + delete from pro_order where id in + + #{id} + + + \ No newline at end of file