|
|
<?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.gaotao.modules.orderIssure.mapper.IssureNotifyMapper"> <select id="getUserNotifyNo" resultType="SOIssueNotifyHeaderData"> select top 1 a.NotifyNo,a.Site,a.NotifyDate,a.UserName,a.EnteredDate,a.Receiver,a.DepartmentID,a.Remark,a.CreditFlag,a.IssueFlag, a.IssueResult,a.PlanIssueDate,a.RealIssueDate,a.Status,a.HaveIssueRecordFlag,a.CalcFlag,a.NeedApproveFlag,a.ApprovedFlag, a.Approver,a.ApproveDate,a.WarehouseID,a.RecordVersion,a.OutWorkOrderFlag,a.ProjectID,a.OrderType,a.AuthRuleID,a.bu from SOIssueNotifyHeader a where a.Site=#{site} and a.UserName=#{userName} and a.Status='已计划' order by a.EnteredDate desc
</select>
<insert id="createNotify"> insert into SOIssueNotifyHeader (NotifyNo,Site,NotifyDate,UserName,EnteredDate,Receiver,DepartmentID,Remark,CreditFlag,IssueFlag,IssueResult,PlanIssueDate, RealIssueDate,Status,HaveIssueRecordFlag,CalcFlag,NeedApproveFlag,ApprovedFlag,Approver,ApproveDate,WarehouseID, RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu, work_center_no) values(#{notifyNo},#{site},#{notifyDate},#{userName},#{enteredDate},#{receiver},#{departmentID},#{remark},#{creditFlag},#{issueFlag},#{issueResult},#{planIssueDate}, #{realIssueDate},#{status},#{haveIssueRecordFlag},#{calcFlag},#{needApproveFlag},#{approvedFlag},#{approver},#{approveDate},#{warehouseID}, #{recordVersion},#{outWorkOrderFlag},#{projectID},#{orderType},#{authRuleID},#{bu}, #{workCenterNo}) </insert> <update id="updateNotifyBu"> update SOIssueNotifyHeader set bu=#{bu} where site=#{site} and NotifyNo=#{notifyNo} </update>
<select id="getNotifyNoDetail" resultType="SOIssueNotifyOrderListData"> select a.NotifyNo, a.Site, a.ItemNo, a.FGPartNo, a.SOOrderNo, a.OpsItemNo, a.SeqNo, a.IssureQty, a.OutWorkOrderFlag, a.locationNo, a.needDate, b.OperationDesc itemDesc, a.aps_resource_total, a.not_yet_started_resource_total from SOIssueNotifyOrderList a left join sorouting b on a.site = b.site and a.SOOrderNo = b.OrderNo and b.ItemNo = a.OpsItemNo where a.site = #{site} and a.NotifyNo = #{notifyNo} </select>
<select id="getSOScheduledRoutingListForIssure" resultType="SOScheduledRoutingEntity"> select a.site,a.OrderNo orderno,a.ItemNo itemNo,b.OperationDesc itemDesc,a.seqno ,a.qtyrequired,a.qtyreported,a.remark, a.s_scheduleddate,a.S_ResourceID sResourceid,dbo.getResourceDesc(a.site,a.S_ResourceID) resourceDesc,a.S_ShiftNo sShiftno, dbo.getScheduleShiftDesc(a.site,a.s_shiftno) shiftDesc,a.s_workcenterno,s.PartNo partNo, c.WorkCenterDesc workCenterDesc,dbo.Get_PartDesc(a.site,s.PartNo) partDesc from SOScheduledRouting a left join ShopOrder s on a.site=s.site and a.OrderNo=s.OrderNo left join SORouting b on a.site=b.site and a.OrderNo=b.OrderNo and b.ItemNo=a.ItemNo left join workcenter c on a.site=c.site and a.S_WorkCenterNo=c.WorkCenterNo left join part d on a.site=d.site and d.PartNo=s.PartNo <where> and a.site=#{site} and d.bu_no=#{bu} and a.ClosedFlag='N' <if test="partNo != null and partNo != ''"> and s.PartNo like '%' + #{partNo} + '%' </if> <if test="seqno != null and seqno != ''"> and a.seqno like '%' + #{seqno} + '%' </if> <if test="orderno != null and orderno != ''"> and a.OrderNo like '%' + #{orderno} + '%' </if> <if test="sShiftno != null and sShiftno != ''"> and a.S_ShiftNo like '%' + #{sShiftno} + '%' </if> <if test="sResourceid != null and sResourceid != ''"> and a.S_ResourceID like '%' + #{sResourceid} + '%' </if> <if test="sWorkcenterno != null and sWorkcenterno != ''"> and a.s_workcenterno like '%' + #{sWorkcenterno} + '%' </if> <if test="startDate != null "> AND a.S_ScheduledDate >= #{startDate} </if> <if test="endDate != null "> AND #{endDate} >= a.S_ScheduledDate </if> </where> order by a.OrderNo </select>
<select id="getSOScheduledRoutingListForIssureByPaging" parameterType="SOScheduledRoutingEntity" resultType="SOScheduledRoutingEntity"> select a.site,a.OrderNo orderno,a.ItemNo itemNo,b.OperationDesc itemDesc,a.seqno ,a.qtyrequired,a.qtyreported,a.remark, a.s_scheduleddate,a.S_ResourceID sResourceid,dbo.getResourceDesc(a.site,a.S_ResourceID) resourceDesc,a.S_ShiftNo sShiftno, dbo.getScheduleShiftDesc(a.site,a.s_shiftno) shiftDesc,a.s_workcenterno,s.PartNo partNo, c.WorkCenterDesc workCenterDesc,dbo.Get_PartDesc(a.site,s.PartNo) partDesc, <!--(SELECT ROUND(SUM(issureQty),3) FROM SOIssueNotifyOrderList where Site = a.site and seqNo = a.seqno)--> 0 alreadyApplyTotal from SOScheduledRouting a left join ShopOrder s on a.site=s.site and a.OrderNo=s.OrderNo left join SORouting b on a.site=b.site and a.OrderNo=b.OrderNo and b.ItemNo=a.ItemNo left join workcenter c on a.site=c.site and a.S_WorkCenterNo=c.WorkCenterNo <where> and a.site=#{query.site} and s.bu_no=#{query.bu} and a.ClosedFlag='N' <if test="query.partNo != null and query.partNo != ''"> and s.PartNo like '%' + #{query.partNo} + '%' </if> <if test="query.seqno != null and query.seqno != ''"> and a.seqno like '%' + #{query.seqno} + '%' </if> <if test="query.orderno != null and query.orderno != ''"> and a.OrderNo like '%' + #{query.orderno} + '%' </if> <if test="query.sShiftno != null and query.sShiftno != ''"> and a.S_ShiftNo like '%' + #{query.sShiftno} + '%' </if> <if test="query.sResourceid != null and query.sResourceid != ''"> and a.S_ResourceID like '%' + #{query.sResourceid} + '%' </if> <if test="query.sWorkcenterno != null and query.sWorkcenterno != ''"> and a.s_workcenterno like '%' + #{query.sWorkcenterno} + '%' </if> <if test="query.startDate != null "> AND a.S_ScheduledDate >= #{query.startDate} </if> <if test="query.endDate != null "> AND #{query.endDate} >= a.S_ScheduledDate </if> </where> order by a.OrderNo </select>
<select id="getSOSBOMForIssure" resultType="SOIssueNotifyOrderMaterialListData"> select a.site,b.ItemNo,a.item_no_mat as BOMItemNo,a.component_partno as ComponentPartNo, round(a.qty_assembly*b.IssureQty,2) qty_required , round(a.qty_issue,2) qty_issue,c.QtyToIssue,#{notifyNo} as notifyNo ,dbo.Get_PartDesc(a.site,a.component_partno) partDesc,Round( dbo.get_MaterialOnUse(a.site,a.order_no,a.item_no,a.component_partno),3) qtyOnHand, round(sum(h.qty_on_hand),2) stockQty,c.remark from so_bom a left join SOIssueNotifyOrderList b on a.site=b.site and b.NotifyNo=#{notifyNo} and b.seqNo=#{seqno} left join SOIssueNotifyOrderMaterialList c on a.site=c.site and a.item_no_mat=c.BOMItemNo and c.NotifyNo=#{notifyNo} and c.itemNo=b.itemNo left join view_custdev_currentstock h on a.site=h.site and a.component_partno=h.part_no where a.site=#{site} and a.order_no=#{orderno} and a.item_no=#{itemno,jdbcType=DOUBLE} and a.control_mes='Y' group by a.site,b.ItemNo,a.item_no_mat,a.component_partno,a.qty_assembly,b.IssureQty,a.qty_issue,c.QtyToIssue,a.order_no,a.item_no,a.control_mes,c.remark
</select>
<select id="getSOSBOMInfo" resultType="SoBomData"> select a.Site as site, a.ItemNo as itemNo, a.OrderNo as orderNo, a.ComponentPartNo as ComponentPartNo, round(a.QtyAssembly,3) as qtyAssembly, round(a.QtyRequired,3) as qtyRequired, round(a.QtyIssue,3) as qtyIssue, dbo.Get_PartDesc(a.Site,a.ComponentPartNo) as partDesc, a.Remark as remark, a.issue_method as issueMethod, a.outbound_warehouse_id as outboundWarehouseId from SOBOM a where a.Site = #{site} and a.OrderNo = #{orderno} and a.ComponentPartNo is not null </select>
<!-- and a.ItemNo=#{itemno,jdbcType=DOUBLE} -->
<select id="searchOtherPart" resultType="SOIssueNotifyOrderMaterialListData"> select NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType ,dbo.Get_PartDesc(site,ComponentPartNo) partDesc,remark from SOIssueNotifyOrderMaterialList where NotifyNo=#{notifyNo} and site=#{site} and issueType=#{issueType} </select> <select id="getNextItemForSOIssueNotifyOrderList" resultType="Double"> select isnull(max(ItemNo),0)+1 from SOIssueNotifyOrderList where site=#{site} and NotifyNo=#{notifyNo} and 998>ItemNo </select>
<insert id="saveSOIssueNotifyOrderList"> insert into SOIssueNotifyOrderList(NotifyNo,Site,ItemNo,FGPartNo,SOOrderNo,OpsItemNo,SeqNo,IssureQty,OutWorkOrderFlag,LocationNo,needDate, resourceId, aps_resource_total, not_yet_started_resource_total) values(#{notifyNo},#{site},#{itemNo},#{fGPartNo},#{sOOrderNo},#{opsItemNo},#{seqNo},#{issureQty,jdbcType=DECIMAL},#{outWorkOrderFlag} ,#{locationNo},#{needDate}, #{resourceId}, #{apsResourceTotal,jdbcType=INTEGER}, #{notYetStartedResourceTotal,jdbcType=INTEGER}) </insert> <delete id="deleteSOIssueNotifyOrderMaterialListData"> delete from SOIssueNotifyOrderMaterialList where site=#{site} and NotifyNo=#{notifyNo} and ItemNo=#{itemNo} </delete> <insert id="batchSaveSOIssueNotifyOrderMaterialListData"> insert into SOIssueNotifyOrderMaterialList (NotifyNo, Site, ItemNo, BOMItemNo, ComponentPartNo, QtyToIssue, QtyToIssue_Original, issueType, remark, warehouse_id, standard_dosage) values <foreach collection="list" separator="," item="item"> (#{item.notifyNo}, #{item.site}, #{item.itemNo}, #{item.bOMItemNo}, #{item.componentPartNo}, #{item.qtyToIssue}, 0, #{item.issueType}, #{item.remark}, #{item.warehouseId}, #{item.standardDosage,jdbcType=FLOAT}) </foreach> </insert>
<insert id="saveSOIssueNotifyOrderMaterialListData"> insert into SOIssueNotifyOrderMaterialList (NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType,remark) values (#{notifyNo},#{site},#{itemNo},#{bOMItemNo},#{componentPartNo},#{qtyToIssue},0,#{issueType},#{remark}) </insert>
<delete id="deleteNotifySOS"> delete from SOIssueNotifyOrderList where site=#{site} and NotifyNo=#{notifyNo} and ItemNo=#{itemNo} </delete>
<update id="xiadaNotifyHeader"> update SOIssueNotifyHeader set PlanIssueDate = #{planIssueDate}, status = '待出库' where site = #{site} and NotifyNo = #{notifyNo} </update>
<update id="editNotifyMaterial"> update SOIssueNotifyHeader set status = '编辑中' where site = #{site} and NotifyNo = #{notifyNo} </update>
<delete id="deleteNotifyHeader"> delete from SOIssueNotifyHeader where site=#{site} and NotifyNo=#{notifyNo} </delete>
<select id="searchNotifyHeader" parameterType="SOIssueNotifyHeaderData" resultType="SOIssueNotifyHeaderData"> select a.NotifyNo, a.Site, a.NotifyDate, a.UserName, a.EnteredDate, a.Receiver, a.DepartmentID, a.Remark, a.CreditFlag, a.IssueFlag, a.IssueResult, a.PlanIssueDate, a.RealIssueDate, a.Status, a.HaveIssueRecordFlag, a.CalcFlag, a.NeedApproveFlag, a.ApprovedFlag, a.Approver, a.ApproveDate, a.WarehouseID, a.RecordVersion, a.OutWorkOrderFlag, a.ProjectID, a.OrderType, a.AuthRuleID, (CASE WHEN a.confirm_status IS NULL THEN '未确认' ELSE a.confirm_status END) as confirm_status, dbo.plm_get_user_display(a.Site,a.UserName) userDisplay, a.confirm_user_id, a.confirm_username, a.confirm_user_display, a.confirm_date, a.bu, a.work_center_no, w.WorkCenterDesc as workCenterDesc from SOIssueNotifyHeader a left join workcenter w on a.site = w.site and a.bu = w.bu_no and a.work_center_no = w.WorkCenterNo <where> a.site in (select site from AccessSite where userID = #{query.loginUserName}) and bu in (select bu_no from AccessBu where username = #{query.loginUserName}) <if test="query.notifyNo != null and query.notifyNo != ''"> AND a.NotifyNo = #{query.notifyNo} </if> <if test="query.status != null and query.status != ''"> AND a.Status = #{query.status} </if> <if test="query.userName != null and query.userName != ''"> AND a.UserName LIKE '%' + #{query.userName} + '%' </if> <if test="query.issueFlag != null and query.issueFlag != ''"> AND a.issueFlag LIKE '%' + #{query.issueFlag} + '%' </if> <if test="query.issueResult != null and query.issueResult != ''"> AND a.issueResult LIKE '%' + #{query.issueResult} + '%' </if> <if test="query.workCenterNoList != null and query.workCenterNoList.size() > 0"> AND a.work_center_no IN <foreach collection="query.workCenterNoList" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="query.startDate != null"> AND a.NotifyDate >= #{query.startDate} </if> <if test="query.endDate != null"> AND DATEADD(DAY, 1, #{query.endDate}) >= a.NotifyDate </if> <if test="query.confirmStatus != null and query.confirmStatus != ''"> <choose> <when test="query.confirmStatus == '未确认'"> AND (a.confirm_status = #{query.confirmStatus} or a.confirm_status is null) </when> <otherwise> AND a.confirm_status = #{query.confirmStatus} </otherwise> </choose> </if> <if test="query.sql != null and query.sql != ''"> ${query.sql} </if> </where> order by a.NotifyNo desc </select>
<select id="searchNotifyOrderList" resultType="SOIssueNotifyOrderListData"> select a.NotifyNo, a.Site, a.ItemNo, a.FGPartNo, a.SOOrderNo, a.OpsItemNo, a.SeqNo, a.IssureQty, a.OutWorkOrderFlag, b.OperationDesc itemDesc, a.locationNo, a.needDate, dbo.Get_PartDesc(a.site,a.FGPartNo) partDesc, a.resourceId, a.aps_resource_total, a.not_yet_started_resource_total from SOIssueNotifyOrderList a left join SORouting b on a.site=b.site and a.SOOrderNo=b.OrderNo and a.OpsItemNo=b.ItemNo where a.site=#{site} and a.NotifyNo=#{notifyNo} order by a.ItemNo </select>
<select id="searchNotifyMaterialList" resultType="SOIssueNotifyOrderMaterialListData"> select a.NotifyNo, a.Site, a.ItemNo, a.ComponentPartNo, a.QtyToIssue, a.QtyToIssue_Original, b.FGPartNo, b.OpsItemNo, b.SOOrderNo orderNo, b.SeqNo, dbo.Get_PartDesc(a.site,a.ComponentPartNo) partDesc, b.locationNo, a.issueType, b.needDate, a.remark, isnull(c.issue_method,d.issue_method) issue_method, a.warehouse_id, W.WareHouseName AS warehouseName, a.BOMItemNo as bOMItemNo, a.component_scrap, a.first_inspection_qty, a.standard_dosage from SOIssueNotifyOrderMaterialList a left join SOIssueNotifyOrderList b on a.site = b.site and a.NotifyNo = b.NotifyNo and a.ItemNo = b.ItemNo left join SOBOM c on c.site = A.site and b.SOOrderNo = c.OrderNo and c.ItemNo = A.BOMItemNo and c.ComponentPartNo = a.ComponentPartNo left join part d on d.site = a.site and d.PartNo = a.ComponentPartNo left join WareHouse w on a.site = w.site and a.warehouse_id = w.WareHouseID where a.NotifyNo = #{notifyNo} and a.site = #{site} order by b.needDate, a.ItemNo </select>
<select id="searchSumNotifyMaterialList" resultType="SOIssueNotifyOrderMaterialListData"> select a.site, b.bu, A.NotifyNo, a.ComponentPartNo, sum(a.QtyToIssue) QtyToIssue, sum(a.actual_out_qty) as QtyToIssue_Original, dbo.Get_PartDesc(a.site,a.ComponentPartNo) partDesc, a.issueType, a.warehouse_id, W.WareHouseName AS warehouseName from SOIssueNotifyHeader B INNER JOIN SOIssueNotifyOrderList C ON B.SITE = C.SITE AND B.NotifyNo = C.NotifyNo INNER JOIN SOIssueNotifyOrderMaterialList a ON A.SITE = C.SITE AND A.NotifyNo = C.NotifyNo AND A.ItemNo = C.ItemNo left join WareHouse w on a.site = w.site and a.warehouse_id = w.WareHouseID where a.NotifyNo = #{notifyNo} and a.site = #{site} and b.bu = #{bu} group by a.site, a.ComponentPartNo, a.issueType , b.BU ,a.warehouse_id ,wareHouseName, A.NotifyNo order by a.issueType </select>
<select id="getPartList" resultType="PartEntity" > select P.PartNo partNo,P.PartDescription partDesc,P.umid,P.spec,P.sku from part P LEFT JOIN SOBOM s on P.site = s.site and P.PartNo = s.ComponentPartNo <where> and P.site = #{site} and P.bu_no = #{sourceBu} AND s.Site IS NULL <if test="partNo != null and partNo != ''"> AND P.PartNo LIKE '%'+ #{partNo} + '%' </if> <if test = "partDesc != null and partDesc != ''"> AND P.PartDescription LIKE '%'+ #{partDesc}+ '%' </if> <if test = "spec != null and spec != ''"> AND P.spec LIKE '%'+ #{spec}+ '%' </if> </where> </select>
<select id="getPartListByPaging" resultType="PartEntity" > select P.PartNo partNo,P.PartDescription partDesc,P.umid,P.spec,P.sku from part P LEFT JOIN SOBOM s on P.site = s.site and P.PartNo = s.ComponentPartNo <where> and P.site = #{query.site} and P.bu_no = #{query.sourceBu} AND s.Site IS NULL <if test="query.partNo != null and query.partNo != ''"> AND P.PartNo LIKE '%'+ #{query.partNo} + '%' </if> <if test = "query.partDesc != null and query.partDesc != ''"> AND P.PartDescription LIKE '%'+ #{query.partDesc}+ '%' </if> <if test = "query.spec != null and query.spec != ''"> AND P.spec LIKE '%'+ #{query.spec}+ '%' </if> </where> </select> <select id="getNoControlPartList" resultType="PartEntity" > select top 1000 part_no, PartDescription as part_desc, umid, spec, sku, cinv_source_code from part <where> and site = #{site} and sourceBu = #{sourceBu} and control_mes='N' <if test="partNo != null and partNo != ''"> AND part_no LIKE '%'+ #{partNo} + '%' </if> <if test = "partDesc != null and partDesc != ''"> AND PartDescription LIKE '%'+ #{partDesc}+ '%' </if> <if test = "spec != null and spec != ''"> AND spec LIKE '%'+ #{spec}+ '%' </if>
</where> </select>
<select id="checkPartStock" resultType="SOIssueNotifyOrderMaterialListData" > select g.ComponentPartNo,g.QtyToIssue ,g.partDesc,sum(h.qty_on_hand) qty_on_hand,sum(h.qty_available) qty_available from ( select a.ComponentPartNo,sum(a.QtyToIssue) QtyToIssue,sum(isnull(a.QtyToIssue_Original,0)) QtyToIssue_Original, dbo.Get_PartDesc(a.site,a.ComponentPartNo) partDesc,a.site from SOIssueNotifyOrderMaterialList a where a.NotifyNo=#{notifyNo} and a.site=#{site} group by a.site,a.ComponentPartNo ) g left join view_custdev_currentstock h on g.site=h.site and g.ComponentPartNo=h.part_no
group by g.ComponentPartNo,g.QtyToIssue ,g.partDesc </select>
<select id="checkDeleteOrderList" resultType="SOIssueNotifyOrderMaterialListData" > select NotifyNo,Site,ItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original from SOIssueNotifyOrderMaterialList where Site=#{site} and NotifyNo=#{notifyNo} and ItemNo=#{itemNo,jdbcType=DOUBLE} </select>
<update id="updateNotifyStatus" > update SOIssueNotifyHeader set status=#{status} where Site=#{site} and NotifyNo=#{notifyNo} </update> <select id="checkDeleteMaterial" resultType="SOIssueNotifyOrderMaterialListData"> select NotifyNo,Site,ItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType from SOIssueNotifyOrderMaterialList where Site=#{site} and NotifyNo=#{notifyNo} and ItemNo=#{itemNo} </select> <select id="deleteNotifyMaterial"> delete from SOIssueNotifyOrderMaterialList where Site = #{site} and NotifyNo = #{notifyNo} and ItemNo = #{itemNo} </select>
<delete id="deleteNotifyMaterial2"> delete from SOIssueNotifyOrderMaterialList where Site=#{site} and NotifyNo=#{notifyNo} and BOMItemNo=#{bOMItemNo} </delete>
<insert id="saveIssueNotifyChangeLog"> insert into IssueNotifyChangeLog (Site,NotifyNo,ItemNo,SOOrderNo,SeqNo,ComponentPartNo,QtyToIssue,updateType,updateBy,updateDate,issueType) values (#{site},#{notifyNo},#{itemNo},#{sOOrderNo},#{seqNo},#{componentPartNo},#{qtyToIssue,jdbcType=DOUBLE},#{updateType},#{updateBy},#{updateDate},#{issueType}) </insert> <insert id="batchSaveIssueNotifyChangeLog"> insert into IssueNotifyChangeLog (Site,NotifyNo,ItemNo,SOOrderNo,SeqNo,ComponentPartNo,QtyToIssue,updateType,updateBy,updateDate,issueType) values <foreach collection="list" separator="," item="item"> (#{item.site},#{item.notifyNo},#{item.itemNo},#{item.sOOrderNo},#{item.seqNo},#{item.componentPartNo},#{item.qtyToIssue,jdbcType=DOUBLE},#{item.updateType},#{item.updateBy},#{item.updateDate},#{item.issueType}) </foreach> </insert>
<select id="getSOIssueNotifyOrderListData" resultType="com.gaotao.modules.orderIssure.vo.SOIssueNotifyOrderList"> select NotifyNo,Site,ItemNo,FGPartNo,SOOrderNo,OpsItemNo,SeqNo,IssureQty,OutWorkOrderFlag,LocationNo,needDate,aps_resource_total,not_yet_started_resource_total from SOIssueNotifyOrderList where Site=#{site} and NotifyNo=#{notifyNo} and ItemNo=#{itemNo} </select>
<select id="checkOtherPart" resultType="SOIssueNotifyOrderMaterialListData"> select NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original
from SOIssueNotifyOrderMaterialList where Site=#{site} and NotifyNo=#{notifyNo} and ComponentPartNo=#{componentPartNo} </select>
<select id="getNextBomItemNo" resultType="String">
SELECT #{str}+ CONVERT(VARCHAR(50),isnull( max(CONVERT(int,SUBSTRING(BOMItemNo, LEN(#{str})+1, LEN(BOMItemNo)))+1),1))
FROM SOIssueNotifyOrderMaterialList where Site=#{site} and NotifyNo=#{notifyNo} and BOMItemNo like #{str}+'%'
</select>
<select id="searchIssueNotifyChangeLog" resultType="com.gaotao.modules.orderIssure.vo.IssueNotifyChangeLog"> select Site,NotifyNo,ItemNo,SOOrderNo,SeqNo,ComponentPartNo,QtyToIssue,updateType,updateBy,updateDate,issueType from IssueNotifyChangeLog where Site=#{site} and NotifyNo=#{notifyNo} </select>
<select id="insertNotifyLogClose" > insert into SOIssueNotifyLog (Site,NotifyNo,[Action],username,ActionTime,ActionRemark) values (#{site},#{notifyNo},'关闭',#{username},GetDate(),#{closeRemark}) </select>
<!-- 获取下一个BOMItemNo --> <select id="getNextBOMItemNoForMateria" resultType="String"> SELECT CASE WHEN MAX(BOMItemNo) IS NULL THEN '10' ELSE CASE WHEN ISNUMERIC(MAX(BOMItemNo)) = 1 THEN CAST(CAST(MAX(BOMItemNo) AS DECIMAL(10,0)) + 10 AS VARCHAR) ELSE '10' END END FROM SOIssueNotifyOrderMaterialList WHERE Site = #{site} AND NotifyNo = #{notifyNo} AND ItemNo = #{itemNo} AND ISNUMERIC(BOMItemNo) = 1 </select>
<!-- 保存申请单材料明细 --> <insert id="saveSOIssueNotifyOrderMateria"> INSERT INTO SOIssueNotifyOrderMaterialList (NotifyNo, Site, ItemNo, BOMItemNo, ComponentPartNo, QtyToIssue, QtyToIssue_Original, issueType, remark, warehouse_id, component_scrap, first_inspection_qty, standard_dosage) VALUES (#{notifyNo}, #{site}, #{itemNo,jdbcType=FLOAT}, #{bOMItemNo}, #{componentPartNo}, #{qtyToIssue,jdbcType=FLOAT}, #{qtyToIssueOriginal,jdbcType=FLOAT}, #{issueType}, #{remark}, #{warehouseId}, #{componentScrap,jdbcType=FLOAT}, #{firstInspectionQty,jdbcType=FLOAT}, #{standardDosage,jdbcType=FLOAT}) </insert>
<select id="searchNotifyLogClose" resultType="SOIssueNotifyLogData"> select id,Site,NotifyNo,[Action],username,ActionTime,ActionRemark ,dbo.plm_get_user_display(Site,username) userDisplay from SOIssueNotifyLog where site=#{site} and NotifyNo=#{notifyNo} order by id </select>
<!-- 获取用户 bu --> <select id="getBuByUserNameSite" resultType="BuData" parameterType="BuData"> SELECT a.site, a.bu_no, b.bu_desc FROM AccessBu as a left join bu as b on a.bu_no = b.bu_no and a.site = b.site WHERE a.username = #{username} and a.site = #{site} </select>
<!-- 修改编码信息 --> <select id="updateTransNo" parameterType="com.gaotao.modules.orderIssure.entity.PartSpareData"> EXEC UpdateTransNo #{site}, #{transTypeDB} </select>
<!-- 获取编码信息 --> <select id="getTransNo" resultType="com.gaotao.modules.pms.data.TransNoData" parameterType="com.gaotao.modules.orderIssure.entity.PartSpareData"> SELECT #{site} as site, dbo.Get_TransNo(#{site},#{transTypeDB}) as transNo </select>
<select id="getEamWorkShop" resultType="com.gaotao.modules.orderIssure.vo.EamWorkShop"> select WorkCenterNo WorkShopId,WorkCenterDesc WorkShopName from WorkCenter </select>
<!-- 获取用户 bu --> <select id="getSiteAndBuByUserName" resultType="BuData" parameterType="BuData"> SELECT b.id, a.site, c.sitename, (a.site + '_' + a.bu_no) as buNo, b.bu_desc FROM AccessBu as a left join bu as b on a.bu_no = b.bu_no and a.site = b.site left join site as c on a.site = c.siteid WHERE a.username = #{username} </select>
<update id="updateNotifyDetail"> UPDATE SOIssueNotifyOrderMaterialList SET QtyToIssue = #{qtyToIssue,jdbcType=DOUBLE}, component_scrap = #{componentScrap,jdbcType=DOUBLE}, first_inspection_qty = #{firstInspectionQty,jdbcType=DOUBLE}, standard_dosage = #{standardDosage,jdbcType=DOUBLE} WHERE Site = #{site} and NotifyNo = #{notifyNo} and ItemNo = #{itemNo} and BOMItemNo = #{bOMItemNo} </update>
<!-- 根据站点和物料编码查询物料信息 --> <select id="getPartBySiteAndPartNo" resultType="com.gaotao.modules.orderIssure.entity.PartEntity"> SELECT PartNo as partNo, PartDescription as partDesc, Site as site, issue_method as issueMethod, outbound_warehouse_id as outboundWarehouseId FROM part WHERE Site = #{site} AND PartNo = #{partNo} </select>
<!-- 查询BOM替代料列表 --> <select id="getBomAlternativeParts" resultType="com.gaotao.modules.orderIssure.entity.BomAlternativePartsData"> SELECT DISTINCT<!-- A.FGPartNo as partNo, -- 母件编码--><!-- DBO.Get_PartDesc(A.SITE, A.FGPartNo) AS partDesc, -- 母件名称--><!-- C.component_part AS componentPartNo, -- 子件编码--><!-- DBO.Get_PartDesc(A.SITE, C.component_part) AS componentPartDesc, -- 子件名称--> C.alternative_part_no AS alternativePartNo, -- 替代料编码 DBO.Get_PartDesc(A.SITE, C.alternative_part_no) AS alternativePartDesc, -- 替代料名称 C.replacement_ratio AS replacementRatio, -- 替代比例 C.priority AS priority -- 优先级 FROM SOIssueNotifyOrderList A INNER JOIN ShopOrder B ON A.SITE = B.SITE AND A.SOOrderNo = B.OrderNo INNER JOIN BomAlternativeParts C ON B.SITE = C.SITE AND B.PartNo = C.part_no AND B.BOMRevNo = C.bom_version WHERE A.site = #{site} AND A.NotifyNo = #{notifyNo} AND A.SOOrderNo = #{orderNo} AND C.component_part = #{componentPart} AND C.active = 'Y' ORDER BY C.priority </select>
<select id="getWorkCenterList" resultType="com.gaotao.modules.base.entity.WorkCenterData"> select site, bu_no, WorkCenterNo, WorkCenterDesc from WorkCenter where site = #{site} and bu_no = #{buNo} </select></mapper>
|