湿料计划管理(湿料计划新增init)

highway
wws 2 years ago
parent 84787548e4
commit d6e17541a9

@ -0,0 +1,230 @@
package com.op.mes.domain;
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_detail
*
* @author Open Platform
* @date 2023-07-27
*/
public class ProWetMaterialPlanDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private String id;
/** 计划工厂编码 */
@Excel(name = "计划工厂编码")
private String factoryCode;
/** 配料计划id */
@Excel(name = "配料计划id")
private String wetMaterialPlanId;
/** 工单id */
@Excel(name = "工单id")
private String workorderId;
/** */
@Excel(name = "")
private String atrr1;
/** */
@Excel(name = "")
private String atrr2;
/** */
@Excel(name = "")
private String atrr3;
/** 1接料完成0未接料 */
@Excel(name = "1接料完成0未接料")
private String status;
/** 料罐id */
@Excel(name = "料罐id")
private String bucketId;
/** 料罐编码 */
@Excel(name = "料罐编码")
private String bucketCode;
/** 物料编码 */
@Excel(name = "物料编码")
private String materialCode;
/** 物料id */
@Excel(name = "物料id")
private String materialId;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 产品名称 */
@Excel(name = "产品名称")
private String productName;
/** 班次id */
@Excel(name = "班次id")
private Long shiftId;
/** 班次编码 */
@Excel(name = "班次编码")
private String shiftCode;
/** 班次简称 */
@Excel(name = "班次简称")
private String shiftDesc;
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 setWetMaterialPlanId(String wetMaterialPlanId) {
this.wetMaterialPlanId = wetMaterialPlanId;
}
public String getWetMaterialPlanId() {
return wetMaterialPlanId;
}
public void setWorkorderId(String workorderId) {
this.workorderId = workorderId;
}
public String getWorkorderId() {
return workorderId;
}
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 setBucketId(String bucketId) {
this.bucketId = bucketId;
}
public String getBucketId() {
return bucketId;
}
public void setBucketCode(String bucketCode) {
this.bucketCode = bucketCode;
}
public String getBucketCode() {
return bucketCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialId() {
return materialId;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setShiftId(Long shiftId) {
this.shiftId = shiftId;
}
public Long getShiftId() {
return shiftId;
}
public void setShiftCode(String shiftCode) {
this.shiftCode = shiftCode;
}
public String getShiftCode() {
return shiftCode;
}
public void setShiftDesc(String shiftDesc) {
this.shiftDesc = shiftDesc;
}
public String getShiftDesc() {
return shiftDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("factoryCode", getFactoryCode())
.append("wetMaterialPlanId", getWetMaterialPlanId())
.append("workorderId", getWorkorderId())
.append("atrr1", getAtrr1())
.append("atrr2", getAtrr2())
.append("atrr3", getAtrr3())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("bucketId", getBucketId())
.append("bucketCode", getBucketCode())
.append("materialCode", getMaterialCode())
.append("materialId", getMaterialId())
.append("materialName", getMaterialName())
.append("productName", getProductName())
.append("shiftId", getShiftId())
.append("shiftCode", getShiftCode())
.append("shiftDesc", getShiftDesc())
.toString();
}
}

@ -0,0 +1,62 @@
package com.op.mes.mapper;
import com.op.mes.domain.ProWetMaterialPlanDetail;
import java.util.List;
/**
* Mapper
*
* @author Open Platform
* @date 2023-07-27
*/
public interface ProWetMaterialPlanDetailMapper {
/**
*
*
* @param id
* @return
*/
public ProWetMaterialPlanDetail selectProWetMaterialPlanDetailById(String id);
/**
*
*
* @param proWetMaterialPlanDetail
* @return
*/
public List<ProWetMaterialPlanDetail> selectProWetMaterialPlanDetailList(ProWetMaterialPlanDetail proWetMaterialPlanDetail);
/**
*
*
* @param proWetMaterialPlanDetail
* @return
*/
public int insertProWetMaterialPlanDetail(ProWetMaterialPlanDetail proWetMaterialPlanDetail);
/**
*
*
* @param proWetMaterialPlanDetail
* @return
*/
public int updateProWetMaterialPlanDetail(ProWetMaterialPlanDetail proWetMaterialPlanDetail);
/**
*
*
* @param id
* @return
*/
public int deleteProWetMaterialPlanDetailById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteProWetMaterialPlanDetailByIds(String[] ids);
}

@ -8,7 +8,6 @@ import com.op.mes.domain.Bucket;
import com.op.mes.domain.ProWetMaterialPlan;
import com.op.mes.domain.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 湿Mapper
@ -80,7 +79,6 @@ public interface ProWetMaterialPlanMapper {
* @param shiftId
* @return
*/
@Select("SELECT bst.Shift_Desc_Global shiftName FROM base_shifts_t bst WHERE bst.Shift_Id = #{shiftId}")
String selectShiftById(String shiftId);
/**
@ -88,7 +86,6 @@ public interface ProWetMaterialPlanMapper {
*
* @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();
/**
@ -96,7 +93,6 @@ public interface ProWetMaterialPlanMapper {
*
* @return
*/
@Select("SELECT product_id AS 'productId', product_code AS 'productCode',product_desc_zh AS 'productDesc' FROM base_product WHERE active_flag = '1'")
List<Product> selectProductList();
/**
@ -106,4 +102,13 @@ public interface ProWetMaterialPlanMapper {
* @return
*/
List<BMS> selectBMSList(Date planTime);
/**
* --id
* @param planTime
* @param bucketCode
* @param shiftId
* @return
*/
String selectProWetMaterialPlanByPlanTime(@Param("planTime") Date planTime,@Param("bucketCode") String bucketCode,@Param("shiftId") String shiftId);
}

@ -3,15 +3,20 @@ package com.op.mes.service.impl;
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.utils.uuid.UUID;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.*;
import com.op.mes.mapper.ProOrderMapper;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import com.op.mes.mapper.ProWetMaterialPlanDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.ProWetMaterialPlanMapper;
import com.op.mes.service.IProWetMaterialPlanService;
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;
@ -30,6 +35,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
private ProOrderWorkorderMapper proOrderWorkorderMapper;
@Autowired
private ProOrderMapper proOrderMapper;
@Autowired
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
/**
* 湿
@ -167,7 +174,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
public AjaxResult getBMSList(Date planTime) {
// 参数判空
if (planTime == null) {
return error("参数为空!");
return null;
}
return success(proWetMaterialPlanMapper.selectBMSList(planTime));
}
@ -179,6 +186,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult addWetPlan(List<ProOrderWorkorder> proOrderWorkorderList) {
// 获取料罐信息list
List<Bucket> bucketList = proWetMaterialPlanMapper.selectBucketList();
@ -186,38 +195,127 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
List<ProShift> shiftList = proOrderMapper.selectProShift();
// 湿料计划分类
// 在该班次下
for (int shift = 0; shift < shiftList.size(); shift++){
// 在该料罐下
for (int bucket = 0; bucket < bucketList.size(); bucket++){
int onlyOne = 0;
// 循环传入的工单信息
for (int order = 0; order < proOrderWorkorderList.size(); order++){
// 如果该工单在该班次并且在该料罐下
if (proOrderWorkorderList.get(order).getShiftId().equals(shiftList.get(shift).getShiftId().toString()) && (proOrderWorkorderList.get(order).getBucketId() == bucketList.get(bucket).getBucketId())){
// 同班次同料罐下所有工单进行相同操作
// 如果首次创建主计划
if (onlyOne==0){
// 创建主湿料计划
ProWetMaterialPlan proWetMaterialPlan = new ProWetMaterialPlan();
// 设置主键id
proWetMaterialPlan.setId(IdUtils.fastSimpleUUID());
// TODO 计划工厂编码
// 订单类型
proWetMaterialPlan.setProdType(proOrderWorkorderList.get(order).getProdType());
// 物料号
proWetMaterialPlan.setProdCode(proOrderWorkorderList.get(order).getProductCode());
// 物料名称
proWetMaterialPlan.setProdDesc(proOrderWorkorderList.get(order).getProductName());
// 存放大罐Code
proWetMaterialPlan.setProdSource(proOrderWorkorderList.get(order).getBucketCode());
// 计划状态1正常0停用
proWetMaterialPlan.setStatus("1");
// 创建者
proWetMaterialPlan.setCreateBy(SecurityContextHolder.getUserName());
// 创建时间
proWetMaterialPlan.setCreateTime(new Date());
// 更新者
proWetMaterialPlan.setUpdateBy(SecurityContextHolder.getUserName());
// 更新时间
proWetMaterialPlan.setUpdateTime(new Date());
// 同步状态1已同步0未同步
proWetMaterialPlan.setSyncFlag("0");
// 计划编码
proWetMaterialPlan.setProdCode("SL"+ DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, new Date()));
// 计划日期
proWetMaterialPlan.setPlanTime(proOrderWorkorderList.get(order).getPlanTime());
// 班次id
proWetMaterialPlan.setShiftId(Integer.valueOf(proOrderWorkorderList.get(order).getShiftId()));
// 班次名称
proWetMaterialPlan.setShiftDesc(proOrderWorkorderList.get(order).getShiftDesc());
// 将主湿料计划加入到数据库
proWetMaterialPlanMapper.insertProWetMaterialPlan(proWetMaterialPlan);
}
return null;
}
public static Map<String, Map<String, List<String>>> classifyWorkOrders(List<String> shifts, List<String> tanks, List<String> workOrders) {
Map<String, Map<String, List<String>>> classifiedWorkOrders = new HashMap<>();
// 创建湿料计划详情
ProWetMaterialPlanDetail proWetMaterialPlanDetail = new ProWetMaterialPlanDetail();
// 主键id
proWetMaterialPlanDetail.setId(IdUtils.fastSimpleUUID());
// TODO 计划工厂编码
// 配料计划id
proWetMaterialPlanDetail.setWetMaterialPlanId(proWetMaterialPlan.getId());
// 工单id
proWetMaterialPlanDetail.setWorkorderId(proOrderWorkorderList.get(order).getWorkorderId());
// 接料状态1接料完成0未接料
proWetMaterialPlanDetail.setStatus("0");
// 料罐id
proWetMaterialPlanDetail.setBucketId(String.valueOf(proOrderWorkorderList.get(order).getBucketId()));
// 料罐编码
proWetMaterialPlanDetail.setBucketCode(proOrderWorkorderList.get(order).getBucketCode());
// 物料编码
proWetMaterialPlanDetail.setMaterialCode(proOrderWorkorderList.get(order).getMaterialCode());
// 物料id
proWetMaterialPlanDetail.setMaterialId(String.valueOf(proOrderWorkorderList.get(order).getMaterialId()));
// 物料名称
proWetMaterialPlanDetail.setMaterialName(proOrderWorkorderList.get(order).getMaterialName());
// 产品名称
proWetMaterialPlanDetail.setProductName(proOrderWorkorderList.get(order).getProductName());
// 班次id
proWetMaterialPlanDetail.setShiftId(Long.valueOf(proOrderWorkorderList.get(order).getShiftId()));
// TODO 班次编码
// 班次简称
proWetMaterialPlanDetail.setShiftDesc(proOrderWorkorderList.get(order).getShiftDesc());
for (int i = 0; i < shifts.size(); i++) {
String shift = shifts.get(i);
String tank = tanks.get(i);
String workOrder = workOrders.get(i);
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(proWetMaterialPlanDetail);
// 获取当前班次的工单分类
Map<String, List<String>> shiftMap = classifiedWorkOrders.getOrDefault(shift, new HashMap<>());
}else {
// 查询当天下-该班次-该料罐下的主湿料计划的id
String id = proWetMaterialPlanMapper.selectProWetMaterialPlanByPlanTime(proOrderWorkorderList.get(order).getPlanTime(),proOrderWorkorderList.get(order).getBucketCode(),proOrderWorkorderList.get(order).getShiftId());
// 获取当前料罐的工单列表
List<String> tankOrders = shiftMap.getOrDefault(tank, new ArrayList<>());
// 创建湿料计划详情
ProWetMaterialPlanDetail proWetMaterialPlanDetail = new ProWetMaterialPlanDetail();
// 主键id
proWetMaterialPlanDetail.setId(IdUtils.fastSimpleUUID());
// TODO 计划工厂编码
// 配料计划id
proWetMaterialPlanDetail.setWetMaterialPlanId(id);
// 工单id
proWetMaterialPlanDetail.setWorkorderId(proOrderWorkorderList.get(order).getWorkorderId());
// 接料状态1接料完成0未接料
proWetMaterialPlanDetail.setStatus("0");
// 料罐id
proWetMaterialPlanDetail.setBucketId(String.valueOf(proOrderWorkorderList.get(order).getBucketId()));
// 料罐编码
proWetMaterialPlanDetail.setBucketCode(proOrderWorkorderList.get(order).getBucketCode());
// 物料编码
proWetMaterialPlanDetail.setMaterialCode(proOrderWorkorderList.get(order).getMaterialCode());
// 物料id
proWetMaterialPlanDetail.setMaterialId(String.valueOf(proOrderWorkorderList.get(order).getMaterialId()));
// 物料名称
proWetMaterialPlanDetail.setMaterialName(proOrderWorkorderList.get(order).getMaterialName());
// 产品名称
proWetMaterialPlanDetail.setProductName(proOrderWorkorderList.get(order).getProductName());
// 班次id
proWetMaterialPlanDetail.setShiftId(Long.valueOf(proOrderWorkorderList.get(order).getShiftId()));
// TODO 班次编码
// 班次简称
proWetMaterialPlanDetail.setShiftDesc(proOrderWorkorderList.get(order).getShiftDesc());
// 添加工单到料罐列表
tankOrders.add(workOrder);
// 更新料罐的工单列表
shiftMap.put(tank, tankOrders);
// 更新班次的工单分类
classifiedWorkOrders.put(shift, shiftMap);
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(proWetMaterialPlanDetail);
}
onlyOne+=1;
}
}
}
}
return classifiedWorkOrders;
return null;
}
}

@ -0,0 +1,149 @@
<?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.ProWetMaterialPlanDetailMapper">
<resultMap type="ProWetMaterialPlanDetail" id="ProWetMaterialPlanDetailResult">
<result property="id" column="id" />
<result property="factoryCode" column="factory_code" />
<result property="wetMaterialPlanId" column="wet_material_plan_id" />
<result property="workorderId" column="workorder_id" />
<result property="atrr1" column="atrr1" />
<result property="atrr2" column="atrr2" />
<result property="atrr3" column="atrr3" />
<result property="status" column="status" />
<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="bucketId" column="bucket_id" />
<result property="bucketCode" column="bucket_code" />
<result property="materialCode" column="material_code" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="productName" column="product_name" />
<result property="shiftId" column="shift_id" />
<result property="shiftCode" column="shift_code" />
<result property="shiftDesc" column="shift_desc" />
</resultMap>
<sql id="selectProWetMaterialPlanDetailVo">
select id, factory_code, wet_material_plan_id, workorder_id, atrr1, atrr2, atrr3, status, create_by, create_time, update_by, update_time, bucket_id, bucket_code, material_code, material_id, material_name, product_name, shift_id, shift_code, shift_desc from pro_wet_material_plan_detail
</sql>
<select id="selectProWetMaterialPlanDetailList" parameterType="ProWetMaterialPlanDetail" resultMap="ProWetMaterialPlanDetailResult">
<include refid="selectProWetMaterialPlanDetailVo"/>
<where>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="wetMaterialPlanId != null and wetMaterialPlanId != ''"> and wet_material_plan_id = #{wetMaterialPlanId}</if>
<if test="workorderId != null and workorderId != ''"> and workorder_id = #{workorderId}</if>
<if test="atrr1 != null and atrr1 != ''"> and atrr1 = #{atrr1}</if>
<if test="atrr2 != null and atrr2 != ''"> and atrr2 = #{atrr2}</if>
<if test="atrr3 != null and atrr3 != ''"> and atrr3 = #{atrr3}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="bucketId != null and bucketId != ''"> and bucket_id = #{bucketId}</if>
<if test="bucketCode != null and bucketCode != ''"> and bucket_code = #{bucketCode}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="shiftId != null "> and shift_id = #{shiftId}</if>
<if test="shiftCode != null and shiftCode != ''"> and shift_code = #{shiftCode}</if>
<if test="shiftDesc != null and shiftDesc != ''"> and shift_desc = #{shiftDesc}</if>
</where>
</select>
<select id="selectProWetMaterialPlanDetailById" parameterType="String" resultMap="ProWetMaterialPlanDetailResult">
<include refid="selectProWetMaterialPlanDetailVo"/>
where id = #{id}
</select>
<insert id="insertProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail">
insert into pro_wet_material_plan_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="wetMaterialPlanId != null">wet_material_plan_id,</if>
<if test="workorderId != null">workorder_id,</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="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="bucketId != null">bucket_id,</if>
<if test="bucketCode != null">bucket_code,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="productName != null">product_name,</if>
<if test="shiftId != null">shift_id,</if>
<if test="shiftCode != null">shift_code,</if>
<if test="shiftDesc != null">shift_desc,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="wetMaterialPlanId != null">#{wetMaterialPlanId},</if>
<if test="workorderId != null">#{workorderId},</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="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="bucketId != null">#{bucketId},</if>
<if test="bucketCode != null">#{bucketCode},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="productName != null">#{productName},</if>
<if test="shiftId != null">#{shiftId},</if>
<if test="shiftCode != null">#{shiftCode},</if>
<if test="shiftDesc != null">#{shiftDesc},</if>
</trim>
</insert>
<update id="updateProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail">
update pro_wet_material_plan_detail
<trim prefix="SET" suffixOverrides=",">
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="wetMaterialPlanId != null">wet_material_plan_id = #{wetMaterialPlanId},</if>
<if test="workorderId != null">workorder_id = #{workorderId},</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="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="bucketId != null">bucket_id = #{bucketId},</if>
<if test="bucketCode != null">bucket_code = #{bucketCode},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="shiftId != null">shift_id = #{shiftId},</if>
<if test="shiftCode != null">shift_code = #{shiftCode},</if>
<if test="shiftDesc != null">shift_desc = #{shiftDesc},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProWetMaterialPlanDetailById" parameterType="String">
delete from pro_wet_material_plan_detail where id = #{id}
</delete>
<delete id="deleteProWetMaterialPlanDetailByIds" parameterType="String">
delete from pro_wet_material_plan_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -56,7 +56,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY bucket_id,material_id,shift_id
</select>
<insert id="insertProWetMaterialPlan" parameterType="ProWetMaterialPlan">
<select id="selectShiftById" resultType="java.lang.String">
SELECT bst.Shift_Desc_Global shiftName
FROM base_shifts_t bst
WHERE bst.Shift_Id = #{shiftId}
</select>
<select id="selectBucketList" resultType="com.op.mes.domain.Bucket">
SELECT equipment_id AS 'bucketId',equipment_code AS 'bucketCode',equipment_name AS 'bucketName'
FROM base_equipment
WHERE equipment_type_code = 'equ_type_lg'
</select>
<select id="selectProductList" resultType="com.op.mes.domain.Product">
SELECT product_id AS 'productId', product_code AS 'productCode',product_desc_zh AS 'productDesc'
FROM base_product
WHERE active_flag = '1'
</select>
<select id="selectProWetMaterialPlanByPlanTime" resultType="java.lang.String">
select id
from pro_wet_material_plan
where prod_source = #{bucketCode} and plan_time = #{planTime} and shift_id = #{shiftId}
</select>
<insert id="insertProWetMaterialPlan" parameterType="ProWetMaterialPlan">
insert into pro_wet_material_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>

Loading…
Cancel
Save