| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199 |
- <?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.tld.mapper.WarehousingMapper">
- <sql id="field">
- order_code
- ,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num
- </sql>
- <!-- 查询物料库位 -->
- <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
- select a.id,
- a.storage_location_code,
- a.wllb_code
- from tld_material_class a
- join tld_material b on a.wllb_code = b.code
- where b.code = #{wllbCode}
- </select>
- <!-- 根据物料分类查询库位 -->
- <select id="getMaterialClassType" resultType="com.tld.model.MaterialClass">
- select b.id,
- b.storage_location_code
- from tld_material a
- join tld_storage_location b on b.storage_location_type like CONCAT('%', a.wllb_class, '%')
- where a.code = #{wllbCode}
- </select>
- <!-- 新增库位信息虚拟表 -->
- <insert id="addWarehousingVirtual">
- insert into tld_warehousing_virtual(unique_code, num, storage_location_code, wllb_code, supp_id, serial, type,
- produc_date, capacity, seq, user_id, storage_location_name, attribute,
- notice_id, warehouse_transfer_id, storage_location_code_ck,wbs, receive_goods_id, account_sleeve, entry_number)
- values (#{uniqueCode}, #{num}, #{storageLocationCode}, #{wllbCode}, #{suppId}, #{serial}, #{type},
- #{producDate}, #{capacity}, #{seq}, #{userId}, #{storageLocationName}, #{attribute}, #{noticeId},
- #{warehouseTransferId}, #{storageLocationCodeCk},#{wbs},#{receiveGoodsId},#{accountSleeve}, #{entryNumber})
- </insert>
- <!-- 查询总数量 -->
- <select id="getScanNum" resultType="java.util.Map">
- SELECT (ifnull(sum(a.num), 0) + ${num} + ifnull(sum(c.amount), 0)) as scanNum,
- ifnull(b.storage_location_capacity, 0) as storageLocationCapacity
- FROM tld_warehousing_virtual a
- right join tld_storage_location b on a.storage_location_code = b.storage_location_code
- left join tld_inventory c on b.storage_location_code = c.storage_location_code
- where b.storage_location_code = #{storageLocationCode}
- </select>
- <!-- 查询 -->
- <select id="recommend" resultType="com.tld.model.StorageLocation">
- SELECT id,
- storage_location_code,
- storage_location_name,
- warehouse_where,
- storage_location_type,
- storage_location_capacity,
- is_not_disable,
- create_time
- FROM tld_storage_location
- WHERE #{storageLocationCode} like CONCAT('%', CONCAT(storage_location_code, ','), '%')
- and warehouse_where != '5000'
- </select>
- <!-- 查询 -->
- <select id="getRecommendTwo" resultType="com.tld.model.StorageLocation">
- SELECT a.id,
- a.storage_location_code,
- a.storage_location_name,
- a.warehouse_where,
- a.storage_location_type,
- a.storage_location_capacity,
- a.is_not_disable,
- a.create_time
- FROM tld_storage_location a
- JOIN tld_warehouse b ON a.warehouse_where = b.tld_id
- where b.warehouse_type = #{type}
- </select>
- <!-- 查询是否是混合物料 -->
- <select id="getIsNotSisable" resultType="String">
- select
- ifnull(is_not_disable,'') as isNotDisable
- from tld_material
- where code = #{wllbCode}
- </select>
- <!-- 查询混合库位 -->
- <select id="getIsNotSisableLocation" resultType="com.tld.model.StorageLocation">
- select id,
- storage_location_code,
- storage_location_name,
- warehouse_where,
- storage_location_type,
- storage_location_capacity,
- is_not_disable,
- create_time
- from tld_storage_location
- where is_not_disable = #{isNotDisable}
- </select>
- <!-- 删除虚拟表 -->
- <delete id="delWarehousingVirtual">
- delete
- from tld_warehousing_virtual
- where id = #{id}
- </delete>
- <!-- 查询虚拟表数据进行入库 -->
- <select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
- select
- a.id,
- a.unique_code,
- a.num,
- a.storage_location_code,
- a.wllb_code,
- a.supp_id,
- a.serial,
- a.type,
- a.produc_date,
- a.capacity,
- a.seq,
- a.user_id,
- a.attribute,
- a.warehouse_transfer_id,
- a.storage_location_code_ck,
- a.storage_location_name,
- b.user_name,
- a.receive_goods_id,
- a.wbs,
- a.account_sleeve,
- a.warehouse_transfer_id,
- a.entry_number
- from tld_warehousing_virtual a
- left join tld_user b on a.user_id = b.id
- where a.unique_code = #{uniqueCode} and a.type = #{type}
- <if test="warehouseTransferId != null and warehouseTransferId != ''">
- and a.warehouse_transfer_id = #{warehouseTransferId}
- </if>
- </select>
- <!-- 查询采购单信息 -->
- <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
- SELECT a.id,
- a.order_code,
- a.material_id,+
- a.purchase_num,
- a.arrival_num,
- a.type,
- a.qualified_num,
- a.disqualification_num,
- a.wbs,
- a.arrival_time,
- a.measurement_id,
- a.supplier_id,
- a.entry_number,
- a.warehousing_num,
- b.company_number,
- b.order_number,
- b.source_type,
- b.move_type,
- f.name as supplierName
- FROM tld_receive_goods a
- LEFT JOIN tld_receive_goods_f b on a.order_code = b.order_code
- JOIN tld_material c on a.material_id = c.tld_id
- LEFT JOIN tld_customer f on a.supplier_id = f.code
- WHERE a.supplier_id = #{suppId}
- and IFNULL(a.warehousing_num, 0) <![CDATA[<]]> a.qualified_num
- and c.code = #{wllbCode}
- ORDER BY a.arrival_time DESC
- </select>
- <!-- 修改采购单入库数量 -->
- <update id="updateReceiveGood">
- update tld_receive_goods
- set warehousing_num = warehousing_num + #{warehousingNum}
- where id = #{id}
- </update>
- <!-- 查询物料类型 -->
- <select id="getWlClass" resultType="com.tld.model.WarehousingVirtual">
- select wllb_class, tld_id as materialId
- from tld_material
- where code = #{wllbCode}
- </select>
- <!-- 插入入库流水 -->
- <insert id="addStorage">
- insert into
- tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq,storage_code,wbs,order_code,account_sleeve,purchase_num,transmission_type)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (#{item.wllbCode},#{item.suppId},#{item.serial},#{item.producDate},#{item.producDate},#{item.num},#{item.seq},#{item.type},#{item.userId},#{item.departmentId},#{item.storageLocationCode},now(),#{item.storageCode},#{item.wbs},#{item.warehouseTransferId},#{item.accountSleeve},#{item.purchaseNum},0)
- </foreach>
- </insert>
- <!-- 插入库存 -->
- <insert id="addInventory">
- insert into
- tld_inventory(storage_location_code,wllb_class,material_id,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch,attribute)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate},
- now(),(curdate() + 0),#{item.attribute})
- </foreach>
- </insert>
- <!-- 删除临时表数据 -->
- <delete id="delVirtual">
- delete
- from tld_warehousing_virtual
- where unique_code = #{uniqueCode}
- </delete>
- <!-- 查询当天质检数量 -->
- <select id="getWarehousingCount" resultType="int">
- select count(*)
- from tld_return_gs_warehousing
- where scrq BETWEEN CONCAT(CURDATE(), ' 00:00:00') AND CONCAT(CURDATE(), ' 23:59:59');
- </select>
- <!-- 存入为gs穿的信息 -->
- <insert id="addReturnWarehousing">
- insert into tld_return_gs_warehousing(storage_code, gs_ck, source_type, move_type, entry_number, wbs,
- material_id, warehousing_num, receive_goods_id, scrq, order_number,
- user_name, storage_location_code)
- values (#{storageCode}, #{gsCk}, #{sourceType}, #{moveType}, #{entryNumber}, #{wbs}, #{materialId},
- #{warehousingNum}, #{id}, now(), #{orderNumber}, #{userName}, #{storageLocationCode});
- </insert>
- <!-- 入库回传 -->
- <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
- select a.*,
- ifnull(a.wbs, '') as wbsId,
- ifnull(b.code, '') as wbsCode,
- ifnull(b.name, '') as wbsName
- from tld_return_gs_warehousing a
- left join tld_wbs b on a.wbs = b.tld_id
- where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
- </select>
- <!-- 查询入库流水 -->
- <select id="warehousingFlowing" resultType="com.tld.model.Storage">
- select
- a.id,
- b.name as materialName,
- a.wllb_code,
- h.name as supplierName,
- a.serial,
- a.produc_date,
- a.produc_batch,
- a.capacity,
- a.seq,
- a.type,
- c.user_name as userName,
- e.name as departmentName,
- g.storage_location_name as storageLocationName,
- a.scrq,
- a.storage_code,
- a.wbs,
- c.real_name as realName,
- a.order_code as orderCode,
- a.account_sleeve,
- f.name as accountName,
- a.purchase_num,
- a.transmission_type,
- v.name as wbsName
- from tld_storage a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left join tld_department e on a.department_id = e.code
- left join tld_storage_location g on a.storage_location_code = g.storage_location_code
- left join tld_customer h on a.supplier_id = h.code
- left join tld_company f on a.account_sleeve = f.code
- left join tld_wbs v on a.wbs = v.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and v.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="orderCode != null and orderCode != ''">
- and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
- </if>
- <if test="supplierId != null and supplierId != ''">
- and a.supplier_id = #{supplierId}
- </if>
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="accountSleeve != null and accountSleeve != ''">
- and a.account_sleeve = #{accountSleeve}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 查询虚拟入库 -->
- <select id="getWarehousingVirtual" resultType="com.tld.model.WarehousingVirtual">
- select id,
- unique_code,
- num,
- storage_location_code,
- wllb_code,
- supp_id,
- serial,
- type,
- produc_date,
- capacity,
- seq,
- user_id,
- storage_location_name,
- warehouse_transfer_id,
- wbs,
- receive_goods_id,
- notice_id,
- account_sleeve
- from tld_warehousing_virtual
- where unique_code = #{uniqueCode}
- and type = #{type} and warehouse_transfer_id = #{warehouseTransferId}
- order by id desc
- </select>
- <!-- 查询导出内容 -->
- <select id="export" resultType="java.util.LinkedHashMap">
- select
- b.name as materialName,
- a.wllb_code as wllbCode,
- h.name as supplierName,
- if(a.serial = '', null ,a.serial) as serial,
- a.capacity,
- a.type,
- c.user_name as userName,
- e.name as departmentName,
- g.storage_location_name as storageLocationName,
- a.scrq,
- a.storage_code,
- if(a.wbs = '', null, a.wbs) as wbs,
- if(e.name = '', null, e.name) as wbsName,
- c.real_name as realName,
- a.order_code as orderCode,
- f.name as accountName,
- a.account_sleeve as accountSleeve,
- if(a.purchase_num = '', null, a.purchase_num) as purchaseNum
- from tld_storage a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left JOIN tld_wbs e ON a.wbs = e.tld_id
- left join tld_storage_location g on a.storage_location_code = g.storage_location_code
- left join tld_customer h on a.supplier_id = h.code
- left join tld_company f on a.account_sleeve = f.code
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and e.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="orderCode != null and orderCode != ''">
- and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
- </if>
- <if test="supplierId != null and supplierId != ''">
- and a.supplier_id = #{supplierId}
- </if>
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="accountSleeve != null and accountSleeve != ''">
- and a.account_sleeve = #{accountSleeve}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 查询是否扫描 -->
- <select id="getScanIsNot" resultType="java.util.Map">
- select
- (select count(*)
- from tld_inventory a
- join tld_storage_location b on a.storage_location_code = b.storage_location_code
- where a.supplier_id = #{suppId} and a.serial = #{unique} and a.wllb_code = #{wllbCode} and a.produc_date =
- #{producDate}
- <if test="warehouseWhere != null and warehouseWhere != ''">
- and b.warehouse_where = #{warehouseWhere}
- </if>) as inventoryCount,
- (select count(*) from tld_warehousing_virtual where supp_id = #{suppId} and serial = #{unique} and wllb_code =
- #{wllbCode} and produc_date = #{producDate}) as virtualCount
- from dual
- </select>
- <!-- 查询物料是否存在 -->
- <select id="getMateriaIsExist" resultType="com.tld.model.MaterialClass">
- select id,
- code,
- name,
- tld_id,
- specification_and_model,
- unit_of_measurement,
- ifnull(size, 0) as size,
- wllb_class,
- is_not_disable,
- is_recommend,
- part_type
- from tld_material
- where code = #{wllbCode}
- </select>
- <!-- 查询库存是否同物料同批次存在 -->
- <select id="getInventoryProduc" resultType="java.util.Map">
- SELECT produc_batch as producDate,wbs as wbs,account_sleeve as accountSleeve,wllb_code as wllbCode
- FROM tld_inventory a
- JOIN tld_material b ON a.material_id = b.tld_id
- WHERE a.storage_location_code = #{storageLocationCode}
- and hold = '0'
- </select>
- <!-- 查询报工单 -->
- <select id="getNotice" resultType="com.tld.model.Notice">
- select
- a.id,
- a.notice_id,
- a.entry_number,
- a.production_code,
- a.material_id,
- a.wbs,
- f.name as wbsCode,
- a.measurement_id,
- a.num,
- a.type,
- a.warehousing_num,
- b.company_number,
- c.name as materialName,
- c.wllb_class as wllbClass,
- c.code as wllbCode,
- e.name as companyName,
- b.notice_time as noticeTime,
- b.source_type as sourceType,
- b.move_type as moveType,
- b.notice_code as noticeCode,
- f.name as wbsName
- from tld_notice a
- join tld_notice_f b on a.notice_id = b.notice_id
- join tld_material c on a.material_id = c.tld_id
- join tld_company e on b.company_number = e.code
- left join tld_wbs f on a.wbs = f.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="userId != null and userId != ''">
- and c.code in (select material_id from tld_user_material where user_id = #{userId})
- </if>
- <if test="type != null and type != ''">
- and a.type = #{type}
- </if>
- <if test="noticeId != null and noticeId != ''">
- and a.notice_id like CONCAT(CONCAT('%', #{noticeId}), '%')
- </if>
- <if test="entryNumber != null and entryNumber != ''">
- and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="startTime != null and startTime != ''">
- and b.notice_time <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and b.notice_time <![CDATA[<=]]> #{endTime}
- </if>
- <if test="partType != null and partType == '产成品'.toString()">
- and c.part_type = #{partType}
- </if>
- <if test="partType != null and partType == '半成品'.toString()">
- and (c.part_type ='半成品' or c.part_type ='原材料')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and b.company_number = #{companyNumber}
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and f.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="moveType != null and moveType != ''">
- and b.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
- </if>
- <if test="sourceType != null and sourceType != ''">
- and b.source_type like CONCAT(CONCAT('%', #{sourceType}), '%')
- </if>
- <if test="noticeCode != null and noticeCode != ''">
- and b.notice_code like CONCAT(CONCAT('%', #{noticeCode}), '%')
- </if>
- </trim>
- order by a.id desc
- </select>
- <!-- 导出报工单 -->
- <select id="exportNotice" resultType="java.util.LinkedHashMap">
- select
- a.production_code,
- b.notice_code as noticeCode,
- c.code as wllbCode,
- c.name as materialName,
- a.num,
- a.warehousing_num,
- b.notice_time as noticeTime,
- a.entry_number,
- e.name as companyName,
- b.company_number,
- if(a.wbs = "", null, a.wbs) as wbs,
- if(h.name = "", null, h.name) as wbsName,
- b.source_type as sourceType,
- b.move_type as moveType,
- (case a.type when "0" then "未入库" when "1" then "已入库" end) as type
- from tld_notice a
- join tld_notice_f b on a.notice_id = b.notice_id
- join tld_material c on a.material_id = c.tld_id
- join tld_company e on b.company_number = e.code
- left join tld_wbs h on a.wbs = h.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="type != null and type != ''">
- and a.type = #{type}
- </if>
- <if test="noticeId != null and noticeId != ''">
- and a.notice_id like CONCAT(CONCAT('%', #{noticeId}), '%')
- </if>
- <if test="entryNumber != null and entryNumber != ''">
- and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="startTime != null and startTime != ''">
- and b.notice_time <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and b.notice_time <![CDATA[<=]]> #{endTime}
- </if>
- <if test="partType != null and partType == '产成品'.toString()">
- and c.part_type = #{partType}
- </if>
- <if test="partType != null and partType == '半成品'.toString()">
- and (c.part_type ='半成品' or c.part_type ='原材料')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and b.company_number = #{companyNumber}
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and g.wbsName like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="moveType != null and moveType != ''">
- and b.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
- </if>
- <if test="sourceType != null and sourceType != ''">
- and b.source_type like CONCAT(CONCAT('%', #{sourceType}), '%')
- </if>
- <if test="noticeCode != null and noticeCode != ''">
- and b.notice_code like CONCAT(CONCAT('%', #{noticeCode}), '%')
- </if>
- </trim>
- order by a.id desc
- </select>
- <!-- 查询通知单是否入库 -->
- <select id="getNoticeId" resultType="com.tld.model.Notice">
- select a.id,
- a.notice_id,
- a.entry_number,
- a.production_code,
- a.material_id,
- a.wbs,
- a.measurement_id,
- a.num,
- a.type,
- a.warehousing_num,
- b.wllb_class,
- c.source_type,
- c.move_type,
- b.code as materialCode,
- c.notice_time as noticeTime,
- c.company_number
- from tld_notice a
- join tld_notice_f c on a.notice_id = c.notice_id
- left join tld_material b on a.material_id = b.tld_id
- where a.notice_id = #{noticeId} and a.material_id = #{materialId} and a.entry_number = #{entryNumber}
- </select>
- <!-- 半成品跟部分产成品入库存 -->
- <insert id="addInventoryNotice">
- insert into tld_inventory(storage_location_code, material_id, amount, hold, amount_lock, account_sleeve, wbs,
- produc_date, scrq, wllb_class, produc_batch, attribute, serial, supplier_id,
- wllb_code, totime)
- value (#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},#{producBatch},now(),#{wllbClass},#{producBatch},#{attribute},#{serial},#{supplierId},#{wllbCode},now());
- </insert>
- <!-- 查询库存里是否存在半成品虚拟库位 -->
- <select id="getInventoryNotice" resultType="int">
- select count(*)
- from tld_inventory
- where storage_location_code = #{storageLocationCode}
- and material_id = #{materialId}
- and account_sleeve = #{companyNumber}
- and wbs = #{wbs}
- </select>
- <!-- 增加半成品/产成品虚拟库位数量 -->
- <update id="updateInventoryNotice">
- update tld_inventory
- set amount = amount + #{warehousingNum},
- totime = now()
- where storage_location_code = #{storageLocationCode}
- and material_id = #{materialId}
- and account_sleeve = #{companyNumber}
- and wbs = #{wbs};
- </update>
- <!-- 半成品出库库存查询 -->
- <select id="getHalfInventory" resultType="com.tld.model.Inventory">
- select storage_location_code, wllb_class, material_id, amount
- from tld_inventory
- where storage_location_code = #{storageLocationCode}
- and material_id = #{materialId}
- and account_sleeve = #{companyNumber}
- and wbs = #{wbs}
- and hold = '0'
- order by produc_batch
- </select>
- <!-- 删除库存信息 -->
- <delete id="delInventoryNotice">
- delete
- from tld_inventory
- where storage_location_code = #{storageLocationCode}
- and material_id = #{materialId} and wbs = #{wbs} and account_sleeve = #{companyNumber}
- </delete>
- <!--删除其它入库信息-->
- <delete id="delOtherReceivingGoods">
- delete from tld_notices where id = #{id}
- </delete>
- <!--删除其它出库信息-->
- <delete id="delOtherShipments">
- delete from tld_enquiry where id = #{id}
- </delete>
- <!-- 删减库存 -->
- <update id="updateInventoryNoticeNum">
- update tld_inventory
- set amount = amount - #{warehousingNum}
- where storage_location_code = #{storageLocationCode}
- and material_id = #{materialId} and wbs = #{wbs} and account_sleeve = #{companyNumber}
- </update>
- <!-- 新增半成品入库流水 -->
- <insert id="addProduct">
- insert into tld_half_product(wllb_code, produc_date, produc_batch, capacity, user_id, storage_location_code,
- scrq, storage_code, wbs, production_code,account_sleeve,transmission_type)
- value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{storageCode},#{wbs}, #{productionCode},#{accountSleeve},0)
- </insert>
- <!-- 查询半成品入库流水-->
- <select id="getProduct" resultType="com.tld.model.Notice">
- select
- a.id,
- a.wllb_code,
- a.produc_date,
- a.produc_batch,
- a.capacity as warehousingNum,
- a.user_id,
- c.user_name,
- a.storage_location_code,
- a.scrq,
- b.name as materialName,
- b.code as materialCode,
- a.storage_code,
- a.wbs,
- h.name as wbsName,
- a.production_code,
- c.real_name as realName,
- a.production_code as productionCode,
- a.account_sleeve as companyNumber,
- e.name as accountName
- from tld_half_product a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left join tld_company e on a.account_sleeve = e.code
- left join tld_wbs h on a.wbs = h.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="storageLocationCode != null and storageLocationCode != ''">
- and a.storage_location_code = #{storageLocationCode}
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and a.account_sleeve = #{companyNumber}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 查询半成品入库流水导出-->
- <select id="productExcel" resultType="java.util.LinkedHashMap">
- select
- b.name,
- a.wllb_code,
- a.produc_date,
- a.capacity,
- c.user_name,
- a.scrq,
- a.storage_code,
- if(a.wbs = '' , null ,a.wbs) wbs,
- if(h.name = '' , null ,h.name) as wbsName,
- c.real_name as realName,
- if(a.production_code = '' , null ,a.production_code) as productionCode,
- e.name as accountName,
- a.account_sleeve as accountSleeve
- from tld_half_product a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left join tld_company e on a.account_sleeve = e.code
- left join tld_wbs h on a.wbs = h.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="storageLocationCode != null and storageLocationCode != ''">
- and a.storage_location_code = #{storageLocationCode}
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and a.account_sleeve = #{companyNumber}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 查询要料单信息 -->
- <select id="getAskGoodsHalf" resultType="com.tld.model.AskGoods">
- select a.id,
- a.ask_goods_id,
- a.material_id,
- a.wbs,
- a.measurement_id,
- a.num,
- a.out_num,
- a.entry_number,
- b.source_type,
- b.move_type,
- c.code as wllbCode,
- a.type,
- b.department,
- b.request_type_name,
- b.company_number
- from tld_ask_goods a
- join tld_ask_goods_f b on a.ask_goods_id = b.ask_goods_id
- left join tld_material c on a.material_id = c.tld_id
- where a.ask_goods_id = #{askGoodsId}
- and a.material_id = #{materialId} and a.entry_number = #{entryNumber}
- </select>
- <!-- 修改要货单出库数量 -->
- <update id="updateAskGoodsHalf">
- update tld_ask_goods
- set out_num = ifnull(out_num, 0) + #{warehousingNum}
- <if test="type != null and type != ''">
- ,type = '1'
- </if>
- where id = #{id}
- </update>
- <!-- 新增半成品流水 -->
- <insert id="addRemovalHalfProduct">
- insert into tld_removal_half_product(wllb_code, num, user_id, scrq, ask_goods_id, department, storage_code, wbs, account_sleeve)
- value (#{wllbCode},#{num},#{userId},now(),#{askGoodsId},#{department},#{storageCode},#{wbs},#{companyNumber})
- </insert>
- <!-- 查询指定物料内容 -->
- <select id="getMaterial" resultType="com.tld.model.MaterialClass">
- select
- code as wllbCode,
- name as wllbName,
- tld_id,
- specification_and_model,
- unit_of_measurement,
- size,
- wllb_class,
- is_not_disable,
- ifnull(is_recommend,'') as isRecommend,
- part_type
- from tld_material
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="materialId != null and materialId != ''">
- and tld_id = #{materialId}
- </if>
- <if test="materialCode != null and materialCode != ''">
- and code = #{materialCode}
- </if>
- </trim>
- </select>
- <!-- 查询库存信息 -->
- <select id="getInventoryInfo" resultType="com.tld.model.Inventory">
- select storage_location_code,
- wllb_class,
- library_type,
- material_id,
- amount,
- total,
- totime,
- hold,
- amount_lock,
- account_sleeve,
- wbs,
- supplier_id,
- serial,
- wllb_code,
- produc_date,
- scrq,
- produc_batch,
- attribute
- from tld_inventory
- where storage_location_code = #{storageLocationCode}
- </select>
- <!-- 产成品入库 -->
- <insert id="addHalf">
- insert into tld_half(wllb_code, produc_date, produc_batch, capacity, user_id, storage_location_code, scrq,
- serial, seq, attribute, storage_code, wbs, production_code,account_sleeve,transmission_type)
- value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{serial},#{seq},#{attribute},#{storageCode},#{wbs},#{productionCode},#{accountSleeve},0)
- </insert>
- <!-- 查询虚拟表数据进行入库 -->
- <select id="getVirtualNotice" resultType="com.tld.model.WarehousingVirtual">
- select a.id,
- a.unique_code,
- a.num,
- a.storage_location_code,
- a.wllb_code,
- a.supp_id,
- a.serial,
- a.type,
- a.produc_date,
- a.capacity,
- a.seq,
- a.user_id,
- a.attribute,
- a.storage_location_name,
- b.user_name,
- a.account_sleeve,
- a.entry_number
- from tld_warehousing_virtual a
- left join tld_user b on a.user_id = b.id
- where a.unique_code = #{uniqueCode}
- and a.type = #{type}
- and a.notice_id = #{noticeId}
- </select>
- <!-- 产成品入库流水 -->
- <select id="getHalf" resultType="com.tld.model.Notice">
- select
- a.id,
- a.wllb_code,
- a.produc_date,
- a.produc_batch,
- a.capacity,
- a.user_id,
- a.storage_location_code,
- e.storage_location_name as storageLocationName,
- a.scrq,
- a.serial,
- a.seq,
- a.attribute,
- b.name as materialName,
- c.user_name as userName,
- b.code as materialCode,
- a.storage_code,
- a.wbs,
- h.name as wbsName,
- c.real_name as realName,
- a.production_code as productionCode,
- a.account_sleeve as companyNumber,
- f.name as accountName
- from tld_half a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left join tld_storage_location e on a.storage_location_code = e.storage_location_code
- left join tld_company f on a.account_sleeve = f.code
- left join tld_wbs h on a.wbs = h.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="attribute != null and attribute != ''">
- and a.attribute like CONCAT(CONCAT('%', #{attribute}), '%')
- </if>
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and e.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and a.account_sleeve = #{companyNumber}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 产成品导出 -->
- <select id="getHalfExcel" resultType="java.util.LinkedHashMap">
- select
- b.name as materialName,
- a.wllb_code,
- if(a.produc_batch = '' , null , a.produc_batch) as producBatch,
- a.capacity,
- c.user_name as userName,
- a.storage_location_code,
- a.scrq,
- a.serial,
- if(a.attribute = '' , null , a.attribute) as attribute,
- a.storage_code,
- if(a.wbs = '' , null , a.wbs) as wbs,
- if(h.name = '' , null , h.name) as wbsName,
- c.real_name as realName,
- a.production_code as productionCode,
- f.name as accountName,
- a.account_sleeve as accountSleeve
- from tld_half a
- left join tld_material b on a.wllb_code = b.code
- left join tld_user c on a.user_id = c.id
- left join tld_company f on a.account_sleeve = f.code
- left join tld_wbs h on a.wbs = h.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="startTime != null and startTime != ''">
- and a.scrq <![CDATA[>=]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and a.scrq <![CDATA[<=]]> #{endTime}
- </if>
- <if test="materialName != null and materialName != ''">
- and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
- </if>
- <if test="wllbCode != null and wllbCode != ''">
- and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
- </if>
- <if test="userName != null and userName != ''">
- and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
- </if>
- <if test="realName != null and realName != ''">
- and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
- </if>
- <if test="attribute != null and attribute != ''">
- and a.attribute like CONCAT(CONCAT('%', #{attribute}), '%')
- </if>
- <if test="storageCode != null and storageCode != ''">
- and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
- </if>
- <if test="wbs != null and wbs != ''">
- and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
- </if>
- <if test="productionCode != null and productionCode != ''">
- and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and e.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- and a.account_sleeve = #{companyNumber}
- </if>
- </trim>
- order by a.scrq desc
- </select>
- <!-- 查询通知单虚拟库扫描数 -->
- <select id="getSumScanNumVal" resultType="int">
- SELECT ifnull(sum(a.num), 0)
- FROM tld_warehousing_virtual a
- left join tld_material b on a.wllb_code = b.code
- WHERE a.notice_id = #{noticeId} and b.tld_id = #{materialId}
- </select>
- <!-- 修改报工单入库数量 -->
- <update id="updateNotice">
- update tld_notice
- set warehousing_num = (warehousing_num + 0) + #{warehousingNum}
- <if test="type != null and type != ''">
- ,type = '1'
- </if>
- where notice_id = #{noticeId}
- and material_id = #{materialId} and entry_number = #{entryNumber}
- </update>
- <!-- 查询产成品是否扫描 -->
- <select id="getScanIsNotProduct" resultType="java.util.Map">
- select (select count(*)
- from tld_inventory
- where attribute = #{attribute}
- and serial = #{serial}
- and wllb_code = #{materialCode}
- and produc_date = #{producBatch}) as inventoryCount,
- (select count(*)
- from tld_warehousing_virtual
- where attribute = #{attribute}
- and serial = #{serial}
- and wllb_code = #{materialCode}
- and produc_date = #{producBatch}) as virtualCount
- from dual
- </select>
- <!-- 查询昨天没满的库位 -->
- <select id="getStorageLocationCode" resultType="String">
- SELECT ifnull(max(storage_location_code), "0")
- FROM tld_inventory
- WHERE attribute = #{attribute} and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE() and material_id = #{materialId} and account_sleeve = #{companyNumber}
- <if test="producBatch != null">
- and produc_batch = #{producBatch}
- </if>
- ORDER BY scrq desc LIMIT 1
- </select>
- <select id="getCountStorage" resultType="int">
- SELECT count(*)
- FROM tld_inventory
- where attribute = #{attribute}
- and storage_location_code = #{storageLocationCode}
- and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE()
- and material_id = #{materialId}
- <if test="producBatch != null">
- and produc_batch = #{producBatch}
- </if>
- ORDER BY scrq desc LIMIT 1
- </select>
- <!-- 增加流水入库编号 -->
- <update id="updateStorage">
- update tld_storage
- set storage_code = #{storageCode}
- where wllb_code = #{wllbCode}
- and supplier_id = #{suppId}
- and serial = #{serial}
- and produc_batch = #{producDate}
- </update>
- <!-- 查询公共设置 -->
- <select id="getNumUtil" resultType="int">
- select num
- from tld_util
- where type = #{type}
- </select>
- <!-- 其他入库 -->
- <update id="updateInventoryOther">
- update tld_inventory
- set amount = (amount + 0) + #{amount}
- where id = #{id}
- </update>
- <!-- 移库虚拟库入库 -->
- <update id="updateVitrualNum">
- update tld_inventory
- set amount = amount + #{num}
- where material_id = #{materialId}
- and storage_location_code = #{storageLocationCode}
- </update>
- <!-- 其他入库返回gs -->
- <insert id="addReturnWarehousingOther">
- insert into tld_return_gs_other_warehousing
- (storage_code, account_sleeve, storage_location_code, notice_id, notice_code,
- amount,wbs,wbs_code,wbs_name,notice_time,warehouse_where,source_type,move_type,entry_number,wms_item_id,material_id,wms_id)
- value
- (#{storageCode},#{companyNumber},#{storageLocationCode},#{noticeId},#{noticeCode},#{num},#{wbs},#{code},#{name},
- now(),#{warehouseWhere},#{sourceType},#{moveType},#{entryNumber},#{wmsItemId},#{materialId},#{wmsId})
- </insert>
- <!-- 其他入库 -->
- <insert id="addInventoryOther">
- insert into tld_inventory(storage_location_code, wllb_class, library_type, material_id, amount, totime,
- amount_lock, account_sleeve, wbs, supplier_id, serial, wllb_code, produc_date, scrq,
- produc_batch, attribute)
- value (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},now(),'0',#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},now(),#{producDate},#{attribute})
- </insert>
- <!-- 查询扫描数量 -->
- <select id="getSumWarehousingVirtual" resultType="java.util.Map">
- select
- (select ifnull(sum(num), 0) from tld_warehousing_virtual where receive_goods_id = #{receiveGoodsId}) as scanNum,
- (select (qualified_num + 0) - ifnull((warehousing_num + 0), 0) from tld_receive_goods where id = #{receiveGoodsId}) as num
- from dual
- </select>
- <!-- 查询扫描数量 -->
- <select id="getWarehouseTransferVirtual" resultType="java.util.Map">
- select
- (select ifnull(sum(num), 0) from tld_warehousing_virtual where warehouse_transfer_id = #{warehouseTransferId} and wllb_code = #{wllbCode}) as scanNum,
- (select (num + 0) - ifnull((out_num + 0), 0) from tld_warehouse_transfer where warehouse_transfer_id = #{warehouseTransferId} and material_id = #{materialId}) as num
- from dual
- </select>
- <!-- 流水增加传输状态 -->
- <update id="updateWarehousingType">
- update tld_storage set transmission_type = #{type} where storage_code = #{storageCode}
- </update>
- <!-- 查询其他入库 -->
- <select id="getNotices" resultType="com.tld.model.Notice">
- select
- b.notice_code,
- b.notice_id,
- b.company_number,
- b.source_type,
- b.move_type,
- a.entry_number,
- a.id as wmsItemId,
- b.id as wmsId,
- a.wbs,
- c.code,
- c.name,
- a.entry_number
- from tld_notices a
- join tld_notices_f b on a.notice_id = b.notice_id
- left join tld_wbs c on a.wbs = c.tld_id
- where a.notice_id = #{noticeId} and a.entry_number = #{entryNumber} and a.material_id = #{materialId}
- </select>
- <!--查询删除信息-->
- <select id="getOtherReceivingGoods" resultType="java.util.Map">
- select * from tld_notices where id = #{id}
- </select>
- <!--查询删除信息-->
- <select id="getOtherShipments" resultType="java.util.Map">
- select * from tld_enquiry where id = #{id}
- </select>
- <!-- 往单据上增加数量 -->
- <update id="updateNoticesWarehousingNum">
- update tld_notices set warehousing_num = warehousing_num + #{amount} where notice_id = #{noticeId} and entry_number = #{entryNumber}
- </update>
- <!-- 查询库存是否存在此产成品 -->
- <select id="getFinishedInfo" resultType="String">
- select max(id) from tld_inventory where wllb_code = #{wllbCode} and wbs = #{wbs} and account_sleeve = #{accountSleeve} limit 1
- </select>
- <!-- 查询产成品入库虚拟表数量 -->
- <select id="getnumSaoMiao" resultType="java.lang.String">
- select ifnull(max(num), 0) from tld_warehousing_virtual where notice_id = #{noticeId} and entry_number = #{entryNumber}
- </select>
- </mapper>
|