|
|
@@ -0,0 +1,285 @@
|
|
|
+<?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="cn.iocoder.yudao.module.makeplan.dal.mysql.workorder.WorkOrderMaterialMapper">
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.makeplan.dal.dataobject.workorder.WorkOrderMaterialDO">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="WorkOrd" property="workOrd"/>
|
|
|
+ <result column="Line" property="line"/>
|
|
|
+ <result column="ItemNum" property="itemNum"/>
|
|
|
+ <result column="Descr" property="descr"/>
|
|
|
+ <result column="Op" property="op"/>
|
|
|
+ <result column="OpDescr" property="opDescr"/>
|
|
|
+ <result column="Batch" property="batch"/>
|
|
|
+ <result column="Location" property="location"/>
|
|
|
+ <result column="LotSerial" property="lotSerial"/>
|
|
|
+ <result column="QtyRequired" property="qtyRequired"/>
|
|
|
+ <result column="FrozenBOMQty" property="frozenBOMQty"/>
|
|
|
+ <result column="QtyOrded" property="qtyOrded"/>
|
|
|
+ <result column="QtyRec" property="qtyRec"/>
|
|
|
+ <result column="background" property="background"/>
|
|
|
+ <result column="QtyAllocated" property="qtyAllocated"/>
|
|
|
+ <result column="QtytoIssue" property="qtytoIssue"/>
|
|
|
+ <result column="QtyIssued" property="qtyIssued"/>
|
|
|
+ <result column="QtyPicked" property="qtyPicked"/>
|
|
|
+ <result column="QtyPosted" property="qtyPosted"/>
|
|
|
+ <result column="QtyReturned" property="qtyReturned"/>
|
|
|
+ <result column="QtyReject" property="qtyReject"/>
|
|
|
+ <result column="Status" property="status"/>
|
|
|
+ <result column="UnitCost" property="unitCost"/>
|
|
|
+ <result column="StdCost" property="stdCost"/>
|
|
|
+ <result column="Price" property="price"/>
|
|
|
+ <result column="UM" property="um"/>
|
|
|
+ <result column="IsMainMas" property="isMainMas"/>
|
|
|
+ <result column="Domain" property="domain"/>
|
|
|
+ <result column="Site" property="site"/>
|
|
|
+ <result column="FromLocation" property="fromLocation"/>
|
|
|
+ <result column="FromSite" property="fromSite"/>
|
|
|
+ <result column="Project" property="project"/>
|
|
|
+ <result column="ProductLine" property="productLine"/>
|
|
|
+ <result column="Dimension1" property="dimension1"/>
|
|
|
+ <result column="Dimension2" property="dimension2"/>
|
|
|
+ <result column="IsActive" property="isActive"/>
|
|
|
+ <result column="IsConfirm" property="isConfirm"/>
|
|
|
+ <result column="IsChanged" property="isChanged"/>
|
|
|
+ <result column="RecID" property="recID"/>
|
|
|
+ <result column="WorkOrdMasterRecID" property="workOrdMasterRecID"/>
|
|
|
+ <result column="BusinessID" property="businessID"/>
|
|
|
+ <result column="EffTime" property="effTime"/>
|
|
|
+ <result column="CreateTime" property="createTime"/>
|
|
|
+ <result column="UpdateTime" property="updateTime"/>
|
|
|
+ <result column="CreateUser" property="createUser"/>
|
|
|
+ <result column="UpdateUser" property="updateUser"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 分页查询工单物料明细 -->
|
|
|
+ <select id="selectPageWithJoin" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ wd.RecID as id,
|
|
|
+ wd.Domain,
|
|
|
+ wm.Batch,
|
|
|
+ wd.WorkOrd,
|
|
|
+ wd.Line,
|
|
|
+ wd.ItemNum,
|
|
|
+ im.Descr,
|
|
|
+ wd.Op,
|
|
|
+ CONCAT(CAST(wd.Op AS CHAR), ' ', IFNULL(rd.Descr, '')) as OpDescr,
|
|
|
+ wd.QtyRequired,
|
|
|
+ wd.Location,
|
|
|
+ wd.LotSerial,
|
|
|
+ wd.FrozenBOMQty,
|
|
|
+ wm.QtyOrded,
|
|
|
+ wd.WorkOrdMasterRecID,
|
|
|
+ IFNULL(nd.QtyRec, 0) as QtyRec,
|
|
|
+ CASE
|
|
|
+ WHEN wd.IsActive = 0 THEN 'WorkOrd:#FF6C6C;ItemNum:#FF6C6C'
|
|
|
+ ELSE 'WorkOrd:#FFFFFF;ItemNum:#FFFFFF'
|
|
|
+ END as background,
|
|
|
+ CAST(wd.IsActive AS SIGNED) as IsActive,
|
|
|
+ wd.QtyAllocated,
|
|
|
+ wd.QtytoIssue,
|
|
|
+ wd.QtyIssued,
|
|
|
+ wd.QtyPicked,
|
|
|
+ wd.QtyPosted,
|
|
|
+ wd.QtyReturned,
|
|
|
+ wd.QtyReject,
|
|
|
+ wd.Status,
|
|
|
+ wd.UnitCost,
|
|
|
+ wd.StdCost,
|
|
|
+ wd.Price,
|
|
|
+ wd.UM,
|
|
|
+ wd.IsMainMas,
|
|
|
+ wd.Site,
|
|
|
+ wd.FromLocation,
|
|
|
+ wd.FromSite,
|
|
|
+ wd.Project,
|
|
|
+ wd.ProductLine,
|
|
|
+ wd.Dimension1,
|
|
|
+ wd.Dimension2,
|
|
|
+ wd.IsConfirm,
|
|
|
+ wd.IsChanged,
|
|
|
+ wd.BusinessID,
|
|
|
+ wd.EffTime,
|
|
|
+ wd.CreateTime,
|
|
|
+ wd.UpdateTime,
|
|
|
+ wd.CreateUser,
|
|
|
+ wd.UpdateUser
|
|
|
+ FROM WorkOrdDetail wd
|
|
|
+ INNER JOIN WorkOrdMaster wm ON wd.Domain = wm.Domain AND wd.WorkOrd = wm.WorkOrd
|
|
|
+ INNER JOIN ItemMaster im ON wd.Domain = im.Domain AND wd.ItemNum = im.ItemNum
|
|
|
+ LEFT JOIN RoutingOpDetail rd ON wd.Domain = rd.Domain AND wd.ItemNum = rd.RoutingCode AND wd.Op = rd.Op
|
|
|
+ LEFT JOIN NbrDetail nd ON wd.WorkOrd = nd.WorkOrd
|
|
|
+ AND nd.ItemNum = wd.ItemNum
|
|
|
+ AND nd.IsActive = wd.IsActive
|
|
|
+ AND wd.Domain = nd.Domain
|
|
|
+ AND UPPER(nd.Type) = 'SM'
|
|
|
+ WHERE UPPER(wm.Status) IN ('', 'P', 'R', 'W', 'S')
|
|
|
+ AND UPPER(IFNULL(wm.Typed, '')) IN ('', 'RW', 'TEST', 'TCN')
|
|
|
+ <if test="reqVO.workOrd != null and reqVO.workOrd != ''">
|
|
|
+ AND wd.WorkOrd LIKE CONCAT('%', #{reqVO.workOrd}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.itemNum != null and reqVO.itemNum != ''">
|
|
|
+ AND wd.ItemNum LIKE CONCAT('%', #{reqVO.itemNum}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.location != null and reqVO.location != ''">
|
|
|
+ AND wd.Location = #{reqVO.location}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.op != null and reqVO.op != ''">
|
|
|
+ AND wd.Op = #{reqVO.op}
|
|
|
+ </if>
|
|
|
+ ORDER BY wd.RecID DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询工单物料明细列表 -->
|
|
|
+ <select id="selectListWithJoin" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ wd.RecID as id,
|
|
|
+ wd.Domain,
|
|
|
+ wm.Batch,
|
|
|
+ wd.WorkOrd,
|
|
|
+ wd.Line,
|
|
|
+ wd.ItemNum,
|
|
|
+ im.Descr,
|
|
|
+ wd.Op,
|
|
|
+ CONCAT(CAST(wd.Op AS CHAR), ' ', IFNULL(rd.Descr, '')) as OpDescr,
|
|
|
+ wd.QtyRequired,
|
|
|
+ wd.Location,
|
|
|
+ wd.LotSerial,
|
|
|
+ wd.FrozenBOMQty,
|
|
|
+ wm.QtyOrded,
|
|
|
+ wd.WorkOrdMasterRecID,
|
|
|
+ IFNULL(nd.QtyRec, 0) as QtyRec,
|
|
|
+ CASE
|
|
|
+ WHEN wd.IsActive = 0 THEN 'WorkOrd:#FF6C6C;ItemNum:#FF6C6C'
|
|
|
+ ELSE 'WorkOrd:#FFFFFF;ItemNum:#FFFFFF'
|
|
|
+ END as background,
|
|
|
+ CAST(wd.IsActive AS SIGNED) as IsActive
|
|
|
+ FROM WorkOrdDetail wd
|
|
|
+ INNER JOIN WorkOrdMaster wm ON wd.Domain = wm.Domain AND wd.WorkOrd = wm.WorkOrd
|
|
|
+ INNER JOIN ItemMaster im ON wd.Domain = im.Domain AND wd.ItemNum = im.ItemNum
|
|
|
+ LEFT JOIN RoutingOpDetail rd ON wd.Domain = rd.Domain AND wd.ItemNum = rd.RoutingCode AND wd.Op = rd.Op
|
|
|
+ LEFT JOIN NbrDetail nd ON wd.WorkOrd = nd.WorkOrd
|
|
|
+ AND nd.ItemNum = wd.ItemNum
|
|
|
+ AND nd.IsActive = wd.IsActive
|
|
|
+ AND wd.Domain = nd.Domain
|
|
|
+ AND UPPER(nd.Type) = 'SM'
|
|
|
+ WHERE UPPER(wm.Status) IN ('', 'P', 'R', 'W', 'S')
|
|
|
+ AND UPPER(IFNULL(wm.Typed, '')) IN ('', 'RW', 'TEST', 'TCN')
|
|
|
+ <if test="reqVO.workOrd != null and reqVO.workOrd != ''">
|
|
|
+ AND wd.WorkOrd LIKE CONCAT('%', #{reqVO.workOrd}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.itemNum != null and reqVO.itemNum != ''">
|
|
|
+ AND wd.ItemNum LIKE CONCAT('%', #{reqVO.itemNum}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.location != null and reqVO.location != ''">
|
|
|
+ AND wd.Location = #{reqVO.location}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.op != null and reqVO.op != ''">
|
|
|
+ AND wd.Op = #{reqVO.op}
|
|
|
+ </if>
|
|
|
+ ORDER BY wd.RecID DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 获取工单列表(用于下拉选择) -->
|
|
|
+ <select id="selectWorkOrderList" resultType="java.util.HashMap">
|
|
|
+ SELECT
|
|
|
+ WorkOrd as value,
|
|
|
+ WorkOrd as label
|
|
|
+ FROM WorkOrdMaster
|
|
|
+ WHERE UPPER(IFNULL(Status, '')) IN ('', 'P', 'R', 'W', 'S')
|
|
|
+ AND UPPER(IFNULL(Typed, '')) IN ('', 'RW', 'TEST', 'TCN')
|
|
|
+ ORDER BY WorkOrd DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据ID查询(忽略多租户) -->
|
|
|
+ <select id="selectByIdIgnoreTenant" resultType="cn.iocoder.yudao.module.makeplan.dal.dataobject.workorder.WorkOrderMaterialDO">
|
|
|
+ SELECT
|
|
|
+ RecID as id,
|
|
|
+ WorkOrd,
|
|
|
+ Line,
|
|
|
+ ItemNum,
|
|
|
+ Op,
|
|
|
+ Location,
|
|
|
+ LotSerial,
|
|
|
+ QtyRequired,
|
|
|
+ QtyAllocated,
|
|
|
+ QtytoIssue,
|
|
|
+ QtyIssued,
|
|
|
+ QtyPicked,
|
|
|
+ QtyPosted,
|
|
|
+ QtyReturned,
|
|
|
+ QtyReject,
|
|
|
+ Status,
|
|
|
+ UnitCost,
|
|
|
+ StdCost,
|
|
|
+ Price,
|
|
|
+ UM,
|
|
|
+ IsMainMas,
|
|
|
+ Domain,
|
|
|
+ Site,
|
|
|
+ FromLocation,
|
|
|
+ FromSite,
|
|
|
+ Project,
|
|
|
+ ProductLine,
|
|
|
+ Dimension1,
|
|
|
+ Dimension2,
|
|
|
+ IsActive,
|
|
|
+ IsConfirm,
|
|
|
+ IsChanged,
|
|
|
+ RecID,
|
|
|
+ WorkOrdMasterRecID,
|
|
|
+ BusinessID,
|
|
|
+ EffTime,
|
|
|
+ CreateTime,
|
|
|
+ UpdateTime,
|
|
|
+ CreateUser,
|
|
|
+ UpdateUser
|
|
|
+ FROM WorkOrdDetail
|
|
|
+ WHERE RecID = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据ID更新(忽略多租户) -->
|
|
|
+ <update id="updateByIdIgnoreTenant">
|
|
|
+ UPDATE WorkOrdDetail
|
|
|
+ <set>
|
|
|
+ <if test="entity.workOrd != null">WorkOrd = #{entity.workOrd},</if>
|
|
|
+ <if test="entity.line != null">Line = #{entity.line},</if>
|
|
|
+ <if test="entity.itemNum != null">ItemNum = #{entity.itemNum},</if>
|
|
|
+ <if test="entity.op != null">Op = #{entity.op},</if>
|
|
|
+ <if test="entity.location != null">Location = #{entity.location},</if>
|
|
|
+ <if test="entity.lotSerial != null">LotSerial = #{entity.lotSerial},</if>
|
|
|
+ <if test="entity.qtyRequired != null">QtyRequired = #{entity.qtyRequired},</if>
|
|
|
+ <if test="entity.qtyAllocated != null">QtyAllocated = #{entity.qtyAllocated},</if>
|
|
|
+ <if test="entity.qtytoIssue != null">QtytoIssue = #{entity.qtytoIssue},</if>
|
|
|
+ <if test="entity.qtyIssued != null">QtyIssued = #{entity.qtyIssued},</if>
|
|
|
+ <if test="entity.qtyPicked != null">QtyPicked = #{entity.qtyPicked},</if>
|
|
|
+ <if test="entity.qtyPosted != null">QtyPosted = #{entity.qtyPosted},</if>
|
|
|
+ <if test="entity.qtyReturned != null">QtyReturned = #{entity.qtyReturned},</if>
|
|
|
+ <if test="entity.qtyReject != null">QtyReject = #{entity.qtyReject},</if>
|
|
|
+ <if test="entity.status != null">Status = #{entity.status},</if>
|
|
|
+ <if test="entity.unitCost != null">UnitCost = #{entity.unitCost},</if>
|
|
|
+ <if test="entity.stdCost != null">StdCost = #{entity.stdCost},</if>
|
|
|
+ <if test="entity.price != null">Price = #{entity.price},</if>
|
|
|
+ <if test="entity.um != null">UM = #{entity.um},</if>
|
|
|
+ <if test="entity.isMainMas != null">IsMainMas = #{entity.isMainMas},</if>
|
|
|
+ <if test="entity.domain != null">Domain = #{entity.domain},</if>
|
|
|
+ <if test="entity.site != null">Site = #{entity.site},</if>
|
|
|
+ <if test="entity.fromLocation != null">FromLocation = #{entity.fromLocation},</if>
|
|
|
+ <if test="entity.fromSite != null">FromSite = #{entity.fromSite},</if>
|
|
|
+ <if test="entity.project != null">Project = #{entity.project},</if>
|
|
|
+ <if test="entity.productLine != null">ProductLine = #{entity.productLine},</if>
|
|
|
+ <if test="entity.dimension1 != null">Dimension1 = #{entity.dimension1},</if>
|
|
|
+ <if test="entity.dimension2 != null">Dimension2 = #{entity.dimension2},</if>
|
|
|
+ <if test="entity.isActive != null">IsActive = #{entity.isActive},</if>
|
|
|
+ <if test="entity.isConfirm != null">IsConfirm = #{entity.isConfirm},</if>
|
|
|
+ <if test="entity.isChanged != null">IsChanged = #{entity.isChanged},</if>
|
|
|
+ <if test="entity.workOrdMasterRecID != null">WorkOrdMasterRecID = #{entity.workOrdMasterRecID},</if>
|
|
|
+ <if test="entity.businessID != null">BusinessID = #{entity.businessID},</if>
|
|
|
+ <if test="entity.effTime != null">EffTime = #{entity.effTime},</if>
|
|
|
+ UpdateTime = NOW(),
|
|
|
+ <if test="entity.updateUser != null">UpdateUser = #{entity.updateUser},</if>
|
|
|
+ </set>
|
|
|
+ WHERE RecID = #{entity.id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|