生产订单管理模块(优化)、湿料计划管理init

highway
wws 2 years ago
parent cf38b80dc7
commit 2238046740

@ -45,7 +45,6 @@ public class ProOrderController extends BaseController {
return proOrderService.getWorkOrderList(id);
}
;
/**
*

@ -0,0 +1,119 @@
package com.op.mes.controller;
import java.util.Date;
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.ProWetMaterialPlan;
import com.op.mes.service.IProWetMaterialPlanService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* 湿Controller
*
* @author Open Platform
* @date 2023-07-24
*/
@RestController
@RequestMapping("/plan")
public class ProWetMaterialPlanController extends BaseController {
@Autowired
private IProWetMaterialPlanService proWetMaterialPlanService;
/**
* list
*
* @return
*/
@GetMapping("/getBucketList")
public AjaxResult getBucketList() {
return proWetMaterialPlanService.getBucketList();
}
/**
*
*
* @return
*/
@GetMapping("/getWorkOrderByTime")
public AjaxResult getWorkOrderByTime(Date productDate) {
return proWetMaterialPlanService.getWorkOrderByTime(productDate);
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:list")
@GetMapping("/list")
public TableDataInfo list(ProWetMaterialPlan proWetMaterialPlan) {
startPage();
List<ProWetMaterialPlan> list = proWetMaterialPlanService.selectProWetMaterialPlanList(proWetMaterialPlan);
return getDataTable(list);
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:export")
@Log(title = "湿料计划管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProWetMaterialPlan proWetMaterialPlan) {
List<ProWetMaterialPlan> list = proWetMaterialPlanService.selectProWetMaterialPlanList(proWetMaterialPlan);
ExcelUtil<ProWetMaterialPlan> util = new ExcelUtil<ProWetMaterialPlan>(ProWetMaterialPlan.class);
util.exportExcel(response, list, "湿料计划管理数据");
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(proWetMaterialPlanService.selectProWetMaterialPlanById(id));
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:add")
@Log(title = "湿料计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProWetMaterialPlan proWetMaterialPlan) {
return toAjax(proWetMaterialPlanService.insertProWetMaterialPlan(proWetMaterialPlan));
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:edit")
@Log(title = "湿料计划管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProWetMaterialPlan proWetMaterialPlan) {
return toAjax(proWetMaterialPlanService.updateProWetMaterialPlan(proWetMaterialPlan));
}
/**
* 湿
*/
@RequiresPermissions("mes:plan:remove")
@Log(title = "湿料计划管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(proWetMaterialPlanService.deleteProWetMaterialPlanByIds(ids));
}
}

@ -0,0 +1,47 @@
package com.op.mes.domain;
// 料罐实体类
public class Bucket {
// 料罐id
private Integer bucketId;
// 料罐编码
private String bucketCode;
// 料罐名称
private String bucketName;
@Override
public String toString() {
return "Bucket{" +
"bucketId=" + bucketId +
", bucketCode='" + bucketCode + '\'' +
", bucketName='" + bucketName + '\'' +
'}';
}
public Integer getBucketId() {
return bucketId;
}
public void setBucketId(Integer bucketId) {
this.bucketId = bucketId;
}
public String getBucketCode() {
return bucketCode;
}
public void setBucketCode(String bucketCode) {
this.bucketCode = bucketCode;
}
public String getBucketName() {
return bucketName;
}
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
public Bucket() {
}
}

@ -115,14 +115,37 @@ public class ProOrderWorkorder extends TreeEntity {
@Excel(name = "产品类型")
private String prodType;
/** 是否为底层节点 1是 0不是 */
@Excel(name = "是否为底层节点")
private Integer isEnd;
/** 班次名称 */
private String shiftDesc;
public String getShiftDesc() {
return shiftDesc;
}
public void setShiftDesc(String shiftDesc) {
this.shiftDesc = shiftDesc;
}
public Integer getIsEnd() {
return isEnd;
}
public void setIsEnd(Integer isEnd) {
this.isEnd = isEnd;
}
/** 批次号 */
private StringBuilder batchCodeList;
private List<StringBuilder> batchCodeList;
public StringBuilder getBatchCodeList() {
public List<StringBuilder> getBatchCodeList() {
return batchCodeList;
}
public void setBatchCodeList(StringBuilder batchCodeList) {
public void setBatchCodeList(List<StringBuilder> batchCodeList) {
this.batchCodeList = batchCodeList;
}
@ -340,6 +363,8 @@ public class ProOrderWorkorder extends TreeEntity {
.append("prodType", getProdType())
.append("factoryCode", getFactoryCode())
.append("batchCodeList",getBatchCodeList())
.append("isEnd",getIsEnd())
.append("shiftDesc",getShiftDesc())
.toString();
}
}

@ -0,0 +1,235 @@
package com.op.mes.domain;
import java.util.Date;
import java.util.List;
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.BaseEntity;
/**
* 湿 pro_wet_material_plan
*
* @author Open Platform
* @date 2023-07-24
*/
public class ProWetMaterialPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private String id;
/** 计划工厂编码 */
@Excel(name = "计划工厂编码")
private String factoryCode;
/** 计划日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planTime;
/** 已同步 */
@Excel(name = "已同步")
private String syncFlag;
/** 订单类型 */
private String orderType;
/** 物料号 */
private String prodCode;
/** 物料名称 */
private String prodDesc;
/** 存放大罐 */
private String prodSource;
/** 订单数量 */
private Long quantity;
/** 单位 */
private String unit;
/** $column.columnComment */
private String atrr1;
/** $column.columnComment */
private String atrr2;
/** $column.columnComment */
private String atrr3;
/** 计划状态1正常0停用 */
private String status;
/** 产品类型 */
private String prodType;
/** 计划编码 */
private String planCode;
/** 开始时间 */
private Date startTime;
/** 结束时间 */
private Date endTime;
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
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 setPlanTime(Date planTime) {
this.planTime = planTime;
}
public Date getPlanTime() {
return planTime;
}
public void setSyncFlag(String syncFlag) {
this.syncFlag = syncFlag;
}
public String getSyncFlag() {
return syncFlag;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getOrderType() {
return orderType;
}
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 setProdSource(String prodSource) {
this.prodSource = prodSource;
}
public String getProdSource() {
return prodSource;
}
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 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 setProdType(String prodType) {
this.prodType = prodType;
}
public String getProdType() {
return prodType;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanCode() {
return planCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("factoryCode", getFactoryCode())
.append("planTime", getPlanTime())
.append("syncFlag", getSyncFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("orderType", getOrderType())
.append("prodCode", getProdCode())
.append("prodDesc", getProdDesc())
.append("prodSource", getProdSource())
.append("quantity", getQuantity())
.append("unit", getUnit())
.append("atrr1", getAtrr1())
.append("atrr2", getAtrr2())
.append("atrr3", getAtrr3())
.append("status", getStatus())
.append("prodType", getProdType())
.append("planCode", getPlanCode())
.append("startTime",getStartTime())
.append("endTime",getEndTime())
.toString();
}
}

@ -78,8 +78,7 @@ public interface ProOrderMapper {
*
* @return
*/
@DS("master")
@Select(" SELECT sda.dict_code AS 'key', sda.dict_label AS 'label' FROM sys_dict_data sda WHERE sda.status = '0' AND sda.dict_value = 'equ_type_cxj' ")
@Select(" SELECT equipment_id AS 'key', equipment_name AS 'label' FROM base_equipment WHERE equipment_type_code = 'equ_type_cxj' ")
public List<ProLine> selectProdLine();
/**
@ -102,8 +101,7 @@ public interface ProOrderMapper {
*
* @return
*/
@DS("master")
@Select("SELECT sda.dict_label AS 'prodLineName' FROM sys_dict_data sda WHERE sda.status = '0' AND sda.dict_value = 'equ_type_cxj' AND sda.dict_code = #{prodLineName}")
@Select("SELECT equipment_name AS 'prodLineName' FROM base_equipment WHERE equipment_type_code = 'equ_type_cxj' AND equipment_id = #{prodLineName}")
String selectProdLineName(String prodLineCode);
/**

@ -3,6 +3,7 @@ package com.op.mes.mapper;
import com.op.mes.domain.ProOrderWorkorder;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
/**
@ -70,8 +71,17 @@ public interface ProOrderWorkorderMapper {
/**
* code
*
* @param workorderCode
* @return
*/
List<ProOrderWorkorder> selectChildWorkOrder(String workorderCode);
/**
*
*
* @param productDate
* @return
*/
List<ProOrderWorkorder> selectWorkOrderByTime(Date productDate);
}

@ -0,0 +1,90 @@
package com.op.mes.mapper;
import java.util.Date;
import java.util.List;
import com.op.mes.domain.Bucket;
import com.op.mes.domain.ProWetMaterialPlan;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 湿Mapper
*
* @author Open Platform
* @date 2023-07-24
*/
public interface ProWetMaterialPlanMapper {
/**
* 湿
*
* @param id 湿
* @return 湿
*/
public ProWetMaterialPlan selectProWetMaterialPlanById(String id);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return 湿
*/
public List<ProWetMaterialPlan> selectProWetMaterialPlanList(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
public int insertProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
public int updateProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param id 湿
* @return
*/
public int deleteProWetMaterialPlanById(String id);
/**
* 湿
*
* @param ids
* @return
*/
public int deleteProWetMaterialPlanByIds(String[] ids);
/**
*
*
* @param startTime
* @param endTime
* @return
*/
List<ProWetMaterialPlan> selectProWetMaterialPlanListByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* id
*
* @param shiftId
* @return
*/
@Select("SELECT bst.Shift_Desc_Global shiftName FROM base_shifts_t bst WHERE bst.Shift_Id = #{shiftId}")
String selectShiftById(String shiftId);
/**
* list
* @return
*/
@Select("SELECT equipment_id AS 'bucketId',equipment_code AS 'bucketCode',equipment_name AS 'bucketName' FROM base_equipment WHERE equipment_type_code = 'equ_type_lg'")
List<Bucket> selectBucketList();
}

@ -0,0 +1,77 @@
package com.op.mes.service;
import java.util.Date;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.ProWetMaterialPlan;
/**
* 湿Service
*
* @author Open Platform
* @date 2023-07-24
*/
public interface IProWetMaterialPlanService {
/**
* 湿
*
* @param id 湿
* @return 湿
*/
public ProWetMaterialPlan selectProWetMaterialPlanById(String id);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return 湿
*/
public List<ProWetMaterialPlan> selectProWetMaterialPlanList(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
public int insertProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
public int updateProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan);
/**
* 湿
*
* @param ids 湿
* @return
*/
public int deleteProWetMaterialPlanByIds(String[] ids);
/**
* 湿
*
* @param id 湿
* @return
*/
public int deleteProWetMaterialPlanById(String id);
/**
*
*
* @param productDate
* @return
*/
AjaxResult getWorkOrderByTime(Date productDate);
/**
* list
* @return
*/
AjaxResult getBucketList();
}

@ -72,6 +72,10 @@ public class ProOrderServiceImpl implements IProOrderService {
// 如果不重复
if (checkout) {
// 判断是否为底层节点
int checkEnd = 0;
// 创建ProOrderWorkorder对象用于数据更新减少io
ProOrderWorkorder updateWorker = new ProOrderWorkorder();
ProOrder product = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
// 设置通用属性
@ -88,6 +92,9 @@ public class ProOrderServiceImpl implements IProOrderService {
// 二级
if (splitOrderDTO.getProduct().getChildren() != null) {
// 判断加1
checkEnd += 1;
List<ProOrderDTO> secProOrderList = splitOrderDTO.getProduct().getChildren();
BeanUtils.copyProperties(secProOrderList.get(0), product);
// 设置父工单
@ -100,16 +107,36 @@ public class ProOrderServiceImpl implements IProOrderService {
// 三级
if (secProOrderList.get(0).getChildren() != null) {
// 判断加1
checkEnd += 1;
List<ProOrderDTO> thiProOrderList = secProOrderList.get(0).getChildren();
BeanUtils.copyProperties(thiProOrderList.get(0), product);
// 设置父工单
proOrderWorkorder.setParentOrder(secWorkOrder.getWorkorderCode());
ProOrderWorkorder thiWorkOrder = setWorkOrder(proOrderWorkorder, product);
// 设置为底层节点
thiWorkOrder.setIsEnd(1);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(thiWorkOrder);
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), thiWorkOrder.getWorkorderId());
}
// 设置为底层节点
if (checkEnd == 1){
updateWorker.setWorkorderId(secWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
}
}
// 设置为底层节点
if (checkEnd == 1){
updateWorker.setWorkorderId(firWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
}
return success();
@ -136,11 +163,10 @@ public class ProOrderServiceImpl implements IProOrderService {
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderList.get(i).getProdLineCode());
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorderList.get(i).getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
// 格式化数据
StringBuilder batchCodes = new StringBuilder();
for (int j = 0;j < batchCodeList.size();j++){
batchCodes.append(batchCodeList.get(j));
batchCodes.append(";");
batchCodes.add(new StringBuilder(batchCodeList.get(j)).append(";").append("\n"));
}
// 通过母工单workorder_id查询子工单
// 二级

@ -0,0 +1,136 @@
package com.op.mes.service.impl;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.ProWetMaterialPlanMapper;
import com.op.mes.domain.ProWetMaterialPlan;
import com.op.mes.service.IProWetMaterialPlanService;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* 湿Service
*
* @author Open Platform
* @date 2023-07-24
*/
@Service
public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService {
@Autowired
private ProWetMaterialPlanMapper proWetMaterialPlanMapper;
@Autowired
private ProOrderWorkorderMapper proOrderWorkorderMapper;
/**
* 湿
*
* @param id 湿
* @return 湿
*/
@Override
@DS("#header.poolName")
public ProWetMaterialPlan selectProWetMaterialPlanById(String id) {
return proWetMaterialPlanMapper.selectProWetMaterialPlanById(id);
}
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return 湿
*/
@Override
@DS("#header.poolName")
public List<ProWetMaterialPlan> selectProWetMaterialPlanList(ProWetMaterialPlan proWetMaterialPlan) {
if (proWetMaterialPlan.getStartTime() != null && proWetMaterialPlan.getEndTime() != null) {
return proWetMaterialPlanMapper.selectProWetMaterialPlanListByTime(proWetMaterialPlan.getStartTime(), proWetMaterialPlan.getEndTime());
}
return proWetMaterialPlanMapper.selectProWetMaterialPlanList(proWetMaterialPlan);
}
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
@Override
@DS("#header.poolName")
public int insertProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan) {
proWetMaterialPlan.setCreateTime(DateUtils.getNowDate());
return proWetMaterialPlanMapper.insertProWetMaterialPlan(proWetMaterialPlan);
}
/**
* 湿
*
* @param proWetMaterialPlan 湿
* @return
*/
@Override
@DS("#header.poolName")
public int updateProWetMaterialPlan(ProWetMaterialPlan proWetMaterialPlan) {
proWetMaterialPlan.setUpdateTime(DateUtils.getNowDate());
return proWetMaterialPlanMapper.updateProWetMaterialPlan(proWetMaterialPlan);
}
/**
* 湿
*
* @param ids 湿
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProWetMaterialPlanByIds(String[] ids) {
return proWetMaterialPlanMapper.deleteProWetMaterialPlanByIds(ids);
}
/**
* 湿
*
* @param id 湿
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProWetMaterialPlanById(String id) {
return proWetMaterialPlanMapper.deleteProWetMaterialPlanById(id);
}
/**
*
*
* @param productDate
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getWorkOrderByTime(Date productDate) {
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.selectWorkOrderByTime(productDate);
// 循环遍历
for (int i = 0; i < workorderList.size(); i++){
// 通过班次id获取班次名称
workorderList.get(i).setShiftDesc(proWetMaterialPlanMapper.selectShiftById(workorderList.get(i).getShiftId()));
}
return success(workorderList);
}
/**
* list
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getBucketList() {
return success(proWetMaterialPlanMapper.selectBucketList());
}
}

@ -35,10 +35,11 @@
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="factoryCode" column="factory_code" />
<result property="isEnd" column="is_end" />
</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
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 , is_end from pro_order_workorder
</sql>
<select id="selectProOrderWorkorderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
@ -68,6 +69,7 @@
<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>
<if test="isEnd != null and isEnd != ''"> and is_end = #{isEnd}</if>
</where>
</select>
@ -85,6 +87,14 @@
<include refid="selectProOrderWorkorderVo"/>
WHERE parent_order = #{workorderCode}
</select>
<select id="selectWorkOrderByTime" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
WHERE CONVERT(date, product_date) = #{productDate} AND is_end = '1' AND workorder_id NOT IN (
SELECT workorder_id
FROM pro_wet_material_plan_detail
WHERE CONVERT(date, create_time) = #{productDate}
)
</select>
<insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder">
insert into pro_order_workorder
@ -119,6 +129,7 @@
<if test="updateTime != null">update_time,</if>
<if test="prodType != null">prod_type,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="isEnd != null">is_end,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workorderId != null">#{workorderId},</if>
@ -151,6 +162,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="prodType != null">#{prodType},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="isEnd != null">#{isEnd},</if>
</trim>
</insert>
@ -186,6 +198,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="isEnd != null">is_end = #{isEnd},</if>
</trim>
where workorder_id = #{workorderId}
</update>

@ -0,0 +1,135 @@
<?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.ProWetMaterialPlanMapper">
<resultMap type="ProWetMaterialPlan" id="ProWetMaterialPlanResult">
<result property="id" column="id" />
<result property="factoryCode" column="factory_code" />
<result property="planTime" column="plan_time" />
<result property="syncFlag" column="sync_flag" />
<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="orderType" column="order_type" />
<result property="prodCode" column="prod_code" />
<result property="prodDesc" column="prod_desc" />
<result property="prodSource" column="prod_source" />
<result property="quantity" column="quantity" />
<result property="unit" column="unit" />
<result property="atrr1" column="atrr1" />
<result property="atrr2" column="atrr2" />
<result property="atrr3" column="atrr3" />
<result property="status" column="status" />
<result property="prodType" column="prod_type" />
<result property="planCode" column="plan_code" />
</resultMap>
<sql id="selectProWetMaterialPlanVo">
select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time, order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status, prod_type, plan_code from pro_wet_material_plan
</sql>
<select id="selectProWetMaterialPlanList" parameterType="ProWetMaterialPlan" resultMap="ProWetMaterialPlanResult">
<include refid="selectProWetMaterialPlanVo"/>
<where>
<if test="syncFlag != null and syncFlag != ''"> and sync_flag = #{syncFlag}</if>
</where>
</select>
<select id="selectProWetMaterialPlanById" parameterType="String" resultMap="ProWetMaterialPlanResult">
<include refid="selectProWetMaterialPlanVo"/>
where id = #{id}
</select>
<select id="selectProWetMaterialPlanListByTime" parameterType="ProWetMaterialPlan" resultMap="ProWetMaterialPlanResult">
<include refid="selectProWetMaterialPlanVo"/>
WHERE CONVERT(date, plan_time) BETWEEN #{startTime} AND #{endTime}
ORDER BY CONVERT(date, plan_time) DESC , sync_flag
</select>
<insert id="insertProWetMaterialPlan" parameterType="ProWetMaterialPlan">
insert into pro_wet_material_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="planTime != null">plan_time,</if>
<if test="syncFlag != null">sync_flag,</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="orderType != null">order_type,</if>
<if test="prodCode != null">prod_code,</if>
<if test="prodDesc != null">prod_desc,</if>
<if test="prodSource != null">prod_source,</if>
<if test="quantity != null">quantity,</if>
<if test="unit != null">unit,</if>
<if test="atrr1 != null">atrr1,</if>
<if test="atrr2 != null">atrr2,</if>
<if test="atrr3 != null">atrr3,</if>
<if test="status != null">status,</if>
<if test="prodType != null">prod_type,</if>
<if test="planCode != null">plan_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="planTime != null">#{planTime},</if>
<if test="syncFlag != null">#{syncFlag},</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="orderType != null">#{orderType},</if>
<if test="prodCode != null">#{prodCode},</if>
<if test="prodDesc != null">#{prodDesc},</if>
<if test="prodSource != null">#{prodSource},</if>
<if test="quantity != null">#{quantity},</if>
<if test="unit != null">#{unit},</if>
<if test="atrr1 != null">#{atrr1},</if>
<if test="atrr2 != null">#{atrr2},</if>
<if test="atrr3 != null">#{atrr3},</if>
<if test="status != null">#{status},</if>
<if test="prodType != null">#{prodType},</if>
<if test="planCode != null">#{planCode},</if>
</trim>
</insert>
<update id="updateProWetMaterialPlan" parameterType="ProWetMaterialPlan">
update pro_wet_material_plan
<trim prefix="SET" suffixOverrides=",">
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="planTime != null">plan_time = #{planTime},</if>
<if test="syncFlag != null">sync_flag = #{syncFlag},</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="orderType != null">order_type = #{orderType},</if>
<if test="prodCode != null">prod_code = #{prodCode},</if>
<if test="prodDesc != null">prod_desc = #{prodDesc},</if>
<if test="prodSource != null">prod_source = #{prodSource},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="atrr1 != null">atrr1 = #{atrr1},</if>
<if test="atrr2 != null">atrr2 = #{atrr2},</if>
<if test="atrr3 != null">atrr3 = #{atrr3},</if>
<if test="status != null">status = #{status},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProWetMaterialPlanById" parameterType="String">
delete from pro_wet_material_plan where id = #{id}
</delete>
<delete id="deleteProWetMaterialPlanByIds" parameterType="String">
delete from pro_wet_material_plan where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save