WarehousingMapper.xml 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.tld.mapper.WarehousingMapper">
  5. <sql id="field">
  6. order_code
  7. ,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num
  8. </sql>
  9. <!-- 查询物料库位 -->
  10. <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
  11. select a.id,
  12. a.storage_location_code,
  13. a.wllb_code
  14. from tld_material_class a
  15. join tld_material b on a.wllb_code = b.code
  16. where b.code = #{wllbCode}
  17. </select>
  18. <!-- 根据物料分类查询库位 -->
  19. <select id="getMaterialClassType" resultType="com.tld.model.MaterialClass">
  20. select b.id,
  21. b.storage_location_code
  22. from tld_material a
  23. join tld_storage_location b on b.storage_location_type like CONCAT('%', a.wllb_class, '%')
  24. where a.code = #{wllbCode}
  25. </select>
  26. <!-- 新增库位信息虚拟表 -->
  27. <insert id="addWarehousingVirtual">
  28. insert into tld_warehousing_virtual(unique_code, num, storage_location_code, wllb_code, supp_id, serial, type,
  29. produc_date, capacity, seq, user_id, storage_location_name, attribute,
  30. notice_id, warehouse_transfer_id, storage_location_code_ck,wbs, receive_goods_id, account_sleeve)
  31. values (#{uniqueCode}, #{num}, #{storageLocationCode}, #{wllbCode}, #{suppId}, #{serial}, #{type},
  32. #{producDate}, #{capacity}, #{seq}, #{userId}, #{storageLocationName}, #{attribute}, #{noticeId},
  33. #{warehouseTransferId}, #{storageLocationCodeCk},#{wbs},#{receiveGoodsId},#{accountSleeve})
  34. </insert>
  35. <!-- 查询总数量 -->
  36. <select id="getScanNum" resultType="java.util.Map">
  37. SELECT (ifnull(sum(a.num), 0) + ${num} + ifnull(sum(c.amount), 0)) as scanNum,
  38. ifnull(b.storage_location_capacity, 0) as storageLocationCapacity
  39. FROM tld_warehousing_virtual a
  40. right join tld_storage_location b on a.storage_location_code = b.storage_location_code
  41. left join tld_inventory c on b.storage_location_code = c.storage_location_code
  42. where b.storage_location_code = #{storageLocationCode}
  43. </select>
  44. <!-- 查询 -->
  45. <select id="recommend" resultType="com.tld.model.StorageLocation">
  46. SELECT id,
  47. storage_location_code,
  48. storage_location_name,
  49. warehouse_where,
  50. storage_location_type,
  51. storage_location_capacity,
  52. is_not_disable,
  53. create_time
  54. FROM tld_storage_location
  55. WHERE #{storageLocationCode} like CONCAT('%', CONCAT(storage_location_code, ','), '%')
  56. and warehouse_where != '5000'
  57. </select>
  58. <!-- 查询是否是混合物料 -->
  59. <select id="getIsNotSisable" resultType="String">
  60. select
  61. ifnull(is_not_disable,'') as isNotDisable
  62. from tld_material
  63. where code = #{wllbCode}
  64. </select>
  65. <!-- 查询混合库位 -->
  66. <select id="getIsNotSisableLocation" resultType="com.tld.model.StorageLocation">
  67. select id,
  68. storage_location_code,
  69. storage_location_name,
  70. warehouse_where,
  71. storage_location_type,
  72. storage_location_capacity,
  73. is_not_disable,
  74. create_time
  75. from tld_storage_location
  76. where is_not_disable = #{isNotDisable}
  77. </select>
  78. <!-- 删除虚拟表 -->
  79. <delete id="delWarehousingVirtual">
  80. delete
  81. from tld_warehousing_virtual
  82. where id = #{id}
  83. </delete>
  84. <!-- 查询虚拟表数据进行入库 -->
  85. <select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
  86. select
  87. a.id,
  88. a.unique_code,
  89. a.num,
  90. a.storage_location_code,
  91. a.wllb_code,
  92. a.supp_id,
  93. a.serial,
  94. a.type,
  95. a.produc_date,
  96. a.capacity,
  97. a.seq,
  98. a.user_id,
  99. a.attribute,
  100. a.warehouse_transfer_id,
  101. a.storage_location_code_ck,
  102. a.storage_location_name,
  103. b.user_name,
  104. a.receive_goods_id,
  105. a.wbs,
  106. a.account_sleeve,
  107. a.warehouse_transfer_id
  108. from tld_warehousing_virtual a
  109. left join tld_user b on a.user_id = b.id
  110. where a.unique_code = #{uniqueCode} and a.type = #{type}
  111. <if test="warehouseTransferId != null and warehouseTransferId != ''">
  112. and a.warehouse_transfer_id = #{warehouseTransferId}
  113. </if>
  114. </select>
  115. <!-- 查询采购单信息 -->
  116. <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
  117. SELECT a.id,
  118. a.order_code,
  119. a.material_id,+
  120. a.purchase_num,
  121. a.arrival_num,
  122. a.type,
  123. a.qualified_num,
  124. a.disqualification_num,
  125. a.wbs,
  126. a.arrival_time,
  127. a.measurement_id,
  128. a.supplier_id,
  129. a.entry_number,
  130. a.warehousing_num,
  131. b.company_number,
  132. b.order_number,
  133. b.source_type,
  134. b.move_type,
  135. f.name as supplierName
  136. FROM tld_receive_goods a
  137. LEFT JOIN tld_receive_goods_f b on a.order_code = b.order_code
  138. JOIN tld_material c on a.material_id = c.tld_id
  139. LEFT JOIN tld_customer f on a.supplier_id = f.code
  140. WHERE a.supplier_id = #{suppId}
  141. and IFNULL(a.warehousing_num, 0) <![CDATA[<]]> a.qualified_num
  142. and c.code = #{wllbCode}
  143. ORDER BY a.arrival_time DESC
  144. </select>
  145. <!-- 修改采购单入库数量 -->
  146. <update id="updateReceiveGood">
  147. update tld_receive_goods
  148. set warehousing_num = warehousing_num + #{warehousingNum}
  149. where id = #{id}
  150. </update>
  151. <!-- 查询物料类型 -->
  152. <select id="getWlClass" resultType="com.tld.model.WarehousingVirtual">
  153. select wllb_class, tld_id as materialId
  154. from tld_material
  155. where code = #{wllbCode}
  156. </select>
  157. <!-- 插入入库流水 -->
  158. <insert id="addStorage">
  159. insert into
  160. 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)
  161. values
  162. <foreach collection="list" index="index" item="item" separator=",">
  163. (#{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)
  164. </foreach>
  165. </insert>
  166. <!-- 插入库存 -->
  167. <insert id="addInventory">
  168. insert into
  169. 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)
  170. values
  171. <foreach collection="list" index="index" item="item" separator=",">
  172. (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate},
  173. now(),(curdate() + 0),#{item.attribute})
  174. </foreach>
  175. </insert>
  176. <!-- 删除临时表数据 -->
  177. <delete id="delVirtual">
  178. delete
  179. from tld_warehousing_virtual
  180. where unique_code = #{uniqueCode}
  181. </delete>
  182. <!-- 查询当天质检数量 -->
  183. <select id="getWarehousingCount" resultType="int">
  184. select count(*)
  185. from tld_return_gs_warehousing
  186. where scrq BETWEEN CONCAT(CURDATE(), ' 00:00:00') AND CONCAT(CURDATE(), ' 23:59:59');
  187. </select>
  188. <!-- 存入为gs穿的信息 -->
  189. <insert id="addReturnWarehousing">
  190. insert into tld_return_gs_warehousing(storage_code, gs_ck, source_type, move_type, entry_number, wbs,
  191. material_id, warehousing_num, receive_goods_id, scrq, order_number,
  192. user_name, storage_location_code)
  193. values (#{storageCode}, #{gsCk}, #{sourceType}, #{moveType}, #{entryNumber}, #{wbs}, #{materialId},
  194. #{warehousingNum}, #{id}, now(), #{orderNumber}, #{userName}, #{storageLocationCode});
  195. </insert>
  196. <!-- 入库回传 -->
  197. <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
  198. select a.*,
  199. ifnull(a.wbs, '') as wbsId,
  200. ifnull(b.code, '') as wbsCode,
  201. ifnull(b.name, '') as wbsName
  202. from tld_return_gs_warehousing a
  203. left join tld_wbs b on a.wbs = b.tld_id
  204. where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
  205. </select>
  206. <!-- 查询入库流水 -->
  207. <select id="warehousingFlowing" resultType="com.tld.model.Storage">
  208. select
  209. a.id,
  210. b.name as materialName,
  211. a.wllb_code,
  212. h.name as supplierName,
  213. a.serial,
  214. a.produc_date,
  215. a.produc_batch,
  216. a.capacity,
  217. a.seq,
  218. a.type,
  219. c.user_name as userName,
  220. e.name as departmentName,
  221. g.storage_location_name as storageLocationName,
  222. a.scrq,
  223. a.storage_code,
  224. a.wbs,
  225. c.real_name as realName,
  226. a.order_code as orderCode,
  227. a.account_sleeve,
  228. f.name as accountName,
  229. a.purchase_num,
  230. a.transmission_type
  231. from tld_storage a
  232. left join tld_material b on a.wllb_code = b.code
  233. left join tld_user c on a.user_id = c.id
  234. left join tld_department e on a.department_id = e.code
  235. left join tld_storage_location g on a.storage_location_code = g.storage_location_code
  236. left join tld_customer h on a.supplier_id = h.code
  237. left join tld_company f on a.account_sleeve = f.code
  238. <trim prefix="WHERE" prefixOverrides="and |or">
  239. <if test="storageCode != null and storageCode != ''">
  240. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  241. </if>
  242. <if test="wllbCode != null and wllbCode != ''">
  243. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  244. </if>
  245. <if test="materialName != null and materialName != ''">
  246. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  247. </if>
  248. <if test="userName != null and userName != ''">
  249. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  250. </if>
  251. <if test="realName != null and realName != ''">
  252. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  253. </if>
  254. <if test="storageLocationName != null and storageLocationName != ''">
  255. and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  256. </if>
  257. <if test="wbs != null and wbs != ''">
  258. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  259. </if>
  260. <if test="orderCode != null and orderCode != ''">
  261. and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
  262. </if>
  263. <if test="supplierId != null and supplierId != ''">
  264. and a.supplier_id = #{supplierId}
  265. </if>
  266. <if test="startTime != null and startTime != ''">
  267. and a.scrq <![CDATA[>=]]> #{startTime}
  268. </if>
  269. <if test="endTime != null and endTime != ''">
  270. and a.scrq <![CDATA[<=]]> #{endTime}
  271. </if>
  272. <if test="accountSleeve != null and accountSleeve != ''">
  273. and a.account_sleeve = #{accountSleeve}
  274. </if>
  275. </trim>
  276. order by a.scrq desc
  277. </select>
  278. <!-- 查询虚拟入库 -->
  279. <select id="getWarehousingVirtual" resultType="com.tld.model.WarehousingVirtual">
  280. select id,
  281. unique_code,
  282. num,
  283. storage_location_code,
  284. wllb_code,
  285. supp_id,
  286. serial,
  287. type,
  288. produc_date,
  289. capacity,
  290. seq,
  291. user_id,
  292. storage_location_name,
  293. warehouse_transfer_id,
  294. wbs,
  295. receive_goods_id
  296. from tld_warehousing_virtual
  297. where unique_code = #{uniqueCode}
  298. and type = #{type} and warehouse_transfer_id = #{warehouseTransferId}
  299. order by id desc
  300. </select>
  301. <!-- 查询导出内容 -->
  302. <select id="export" resultType="java.util.LinkedHashMap">
  303. select
  304. b.name as materialName,
  305. a.wllb_code as wllbCode,
  306. h.name as supplierName,
  307. if(a.serial = '', null ,a.serial) as serial,
  308. if(a.produc_date = '', null ,a.produc_date) as producDate,
  309. if(a.produc_batch = '', null ,a.produc_batch) as producbatch,
  310. a.capacity,
  311. a.seq,
  312. a.type,
  313. c.user_name as userName,
  314. e.name as departmentName,
  315. g.storage_location_name as storageLocationName,
  316. a.scrq,
  317. a.storage_code,
  318. a.wbs,
  319. c.real_name as realName,
  320. a.order_code as orderCode,
  321. f.name as accountName,
  322. a.account_sleeve as accountSleeve,
  323. if(a.purchase_num = '', null, a.purchase_num) as purchaseNum
  324. from tld_storage a
  325. left join tld_material b on a.wllb_code = b.code
  326. left join tld_user c on a.user_id = c.id
  327. left join tld_department e on a.department_id = e.code
  328. left join tld_storage_location g on a.storage_location_code = g.storage_location_code
  329. left join tld_customer h on a.supplier_id = h.code
  330. left join tld_company f on a.account_sleeve = f.code
  331. <trim prefix="WHERE" prefixOverrides="and |or">
  332. <if test="storageCode != null and storageCode != ''">
  333. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  334. </if>
  335. <if test="wllbCode != null and wllbCode != ''">
  336. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  337. </if>
  338. <if test="materialName != null and materialName != ''">
  339. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  340. </if>
  341. <if test="userName != null and userName != ''">
  342. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  343. </if>
  344. <if test="realName != null and realName != ''">
  345. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  346. </if>
  347. <if test="storageLocationName != null and storageLocationName != ''">
  348. and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  349. </if>
  350. <if test="wbs != null and wbs != ''">
  351. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  352. </if>
  353. <if test="orderCode != null and orderCode != ''">
  354. and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
  355. </if>
  356. <if test="supplierId != null and supplierId != ''">
  357. and a.supplier_id = #{supplierId}
  358. </if>
  359. <if test="startTime != null and startTime != ''">
  360. and a.scrq <![CDATA[>=]]> #{startTime}
  361. </if>
  362. <if test="endTime != null and endTime != ''">
  363. and a.scrq <![CDATA[<=]]> #{endTime}
  364. </if>
  365. <if test="accountSleeve != null and accountSleeve != ''">
  366. and a.account_sleeve = #{accountSleeve}
  367. </if>
  368. </trim>
  369. order by a.scrq desc
  370. </select>
  371. <!-- 查询是否扫描 -->
  372. <select id="getScanIsNot" resultType="java.util.Map">
  373. select
  374. (select count(*)
  375. from tld_inventory a
  376. join tld_storage_location b on a.storage_location_code = b.storage_location_code
  377. where a.supplier_id = #{suppId} and a.serial = #{unique} and a.wllb_code = #{wllbCode} and a.produc_date =
  378. #{producDate}
  379. <if test="warehouseWhere != null and warehouseWhere != ''">
  380. and b.warehouse_where = #{warehouseWhere}
  381. </if>) as inventoryCount,
  382. (select count(*) from tld_warehousing_virtual where supp_id = #{suppId} and serial = #{unique} and wllb_code =
  383. #{wllbCode} and produc_date = #{producDate}) as virtualCount
  384. from dual
  385. </select>
  386. <!-- 查询物料是否存在 -->
  387. <select id="getMateriaIsExist" resultType="com.tld.model.MaterialClass">
  388. select id,
  389. code,
  390. name,
  391. tld_id,
  392. specification_and_model,
  393. unit_of_measurement,
  394. ifnull(size, 0) as size,
  395. wllb_class,
  396. is_not_disable,
  397. is_recommend,
  398. part_type
  399. from tld_material
  400. where code = #{wllbCode}
  401. </select>
  402. <!-- 查询库存是否同物料同批次存在 -->
  403. <select id="getInventoryProduc" resultType="java.util.Map">
  404. SELECT produc_batch as producDate,wbs as wbs,account_sleeve as accountSleeve,wllb_code as wllbCode
  405. FROM tld_inventory a
  406. JOIN tld_material b ON a.material_id = b.tld_id
  407. WHERE a.storage_location_code = #{storageLocationCode}
  408. and hold = '0'
  409. </select>
  410. <!-- 查询报工单 -->
  411. <select id="getNotice" resultType="com.tld.model.Notice">
  412. select
  413. a.id,
  414. a.notice_id,
  415. a.entry_number,
  416. a.production_code,
  417. a.material_id,
  418. a.wbs,
  419. a.measurement_id,
  420. a.num,
  421. a.type,
  422. a.warehousing_num,
  423. b.company_number,
  424. c.name as materialName,
  425. c.wllb_class as wllbClass,
  426. c.code as wllbCode,
  427. e.name as companyName,
  428. b.notice_time as noticeTime,
  429. b.source_type as sourceType,
  430. b.move_type as moveType,
  431. b.notice_code as noticeCode
  432. from tld_notice a
  433. join tld_notice_f b on a.notice_id = b.notice_id
  434. join tld_material c on a.material_id = c.tld_id
  435. join tld_company e on b.company_number = e.code
  436. <trim prefix="WHERE" prefixOverrides="and |or">
  437. <if test="type != null and type != ''">
  438. and a.type = #{type}
  439. </if>
  440. <if test="noticeId != null and noticeId != ''">
  441. and a.notice_id like CONCAT(CONCAT('%', #{noticeId}), '%')
  442. </if>
  443. <if test="entryNumber != null and entryNumber != ''">
  444. and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
  445. </if>
  446. <if test="wllbCode != null and wllbCode != ''">
  447. and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  448. </if>
  449. <if test="materialName != null and materialName != ''">
  450. and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
  451. </if>
  452. <if test="startTime != null and startTime != ''">
  453. and b.notice_time <![CDATA[>=]]> #{startTime}
  454. </if>
  455. <if test="endTime != null and endTime != ''">
  456. and b.notice_time <![CDATA[<=]]> #{endTime}
  457. </if>
  458. <if test="partType != null and partType != ''">
  459. and c.part_type = #{partType}
  460. </if>
  461. <if test="companyNumber != null and companyNumber != ''">
  462. and b.company_number = #{companyNumber}
  463. </if>
  464. <if test="productionCode != null and productionCode != ''">
  465. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  466. </if>
  467. <if test="wbs != null and wbs != ''">
  468. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  469. </if>
  470. <if test="moveType != null and moveType != ''">
  471. and b.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
  472. </if>
  473. <if test="sourceType != null and sourceType != ''">
  474. and b.source_type like CONCAT(CONCAT('%', #{sourceType}), '%')
  475. </if>
  476. <if test="noticeCode != null and noticeCode != ''">
  477. and b.notice_code like CONCAT(CONCAT('%', #{noticeCode}), '%')
  478. </if>
  479. </trim>
  480. order by a.id desc
  481. </select>
  482. <!-- 查询通知单是否入库 -->
  483. <select id="getNoticeId" resultType="com.tld.model.Notice">
  484. select a.id,
  485. a.notice_id,
  486. a.entry_number,
  487. a.production_code,
  488. a.material_id,
  489. a.wbs,
  490. a.measurement_id,
  491. a.num,
  492. a.type,
  493. a.warehousing_num,
  494. b.wllb_class,
  495. c.source_type,
  496. c.move_type,
  497. b.code as materialCode,
  498. c.notice_time as noticeTime,
  499. c.company_number
  500. from tld_notice a
  501. join tld_notice_f c on a.notice_id = c.notice_id
  502. left join tld_material b on a.material_id = b.tld_id
  503. where a.notice_id = #{noticeId} and a.material_id = #{materialId}
  504. </select>
  505. <!-- 半成品跟部分产成品入库存 -->
  506. <insert id="addInventoryNotice">
  507. insert into tld_inventory(storage_location_code, material_id, amount, hold, amount_lock, account_sleeve, wbs,
  508. produc_date, scrq, wllb_class, produc_batch, attribute, serial, supplier_id,
  509. wllb_code, totime)
  510. value (#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},#{producBatch},now(),#{wllbClass},#{producBatch},#{attribute},#{serial},#{supplierId},#{wllbCode},now());
  511. </insert>
  512. <!-- 查询库存里是否存在半成品虚拟库位 -->
  513. <select id="getInventoryNotice" resultType="int">
  514. select count(*)
  515. from tld_inventory
  516. where storage_location_code = #{storageLocationCode}
  517. and material_id = #{materialId}
  518. and account_sleeve = #{companyNumber}
  519. and wbs = #{wbs}
  520. </select>
  521. <!-- 增加半成品/产成品虚拟库位数量 -->
  522. <update id="updateInventoryNotice">
  523. update tld_inventory
  524. set amount = amount + #{warehousingNum},
  525. totime = now()
  526. where storage_location_code = #{storageLocationCode}
  527. and material_id = #{materialId}
  528. and wbs = #{wbs};
  529. </update>
  530. <!-- 半成品出库库存查询 -->
  531. <select id="getHalfInventory" resultType="com.tld.model.Inventory">
  532. select storage_location_code, wllb_class, material_id, amount
  533. from tld_inventory
  534. where storage_location_code = #{storageLocationCode}
  535. and material_id = #{materialId}
  536. and account_sleeve = #{companyNumber}
  537. and wbs = #{wbs}
  538. and hold = '0'
  539. order by produc_batch
  540. </select>
  541. <!-- 删除库存信息 -->
  542. <delete id="delInventoryNotice">
  543. delete
  544. from tld_inventory
  545. where storage_location_code = #{storageLocationCode}
  546. and material_id = #{materialId}
  547. </delete>
  548. <!--删除其它入库信息-->
  549. <delete id="delOtherReceivingGoods">
  550. delete from tld_notices where id = #{id}
  551. </delete>
  552. <!--删除其它出库信息-->
  553. <delete id="delOtherShipments">
  554. delete from tld_enquiry where id = #{id}
  555. </delete>
  556. <!-- 删减库存 -->
  557. <update id="updateInventoryNoticeNum">
  558. update tld_inventory
  559. set amount = amount - #{warehousingNum}
  560. where storage_location_code = #{storageLocationCode}
  561. and material_id = #{materialId}
  562. </update>
  563. <!-- 新增半成品入库流水 -->
  564. <insert id="addProduct">
  565. insert into tld_half_product(wllb_code, produc_date, produc_batch, capacity, user_id, storage_location_code,
  566. scrq, storage_code, wbs, production_code,account_sleeve,transmission_type)
  567. value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{storageCode},#{wbs}, #{productionCode},#{accountSleeve},0)
  568. </insert>
  569. <!-- 查询半成品入库流水-->
  570. <select id="getProduct" resultType="com.tld.model.Notice">
  571. select
  572. a.id,
  573. a.wllb_code,
  574. a.produc_date,
  575. a.produc_batch,
  576. a.capacity as warehousingNum,
  577. a.user_id,
  578. c.user_name,
  579. a.storage_location_code,
  580. a.scrq,
  581. b.name as materialName,
  582. b.code as materialCode,
  583. a.storage_code,
  584. a.wbs,
  585. a.production_code,
  586. c.real_name as realName,
  587. a.production_code as productionCode,
  588. a.account_sleeve as companyNumber,
  589. e.name as accountName
  590. from tld_half_product a
  591. left join tld_material b on a.wllb_code = b.code
  592. left join tld_user c on a.user_id = c.id
  593. left join tld_company e on a.account_sleeve = e.code
  594. <trim prefix="WHERE" prefixOverrides="and |or">
  595. <if test="startTime != null and startTime != ''">
  596. and a.scrq <![CDATA[>=]]> #{startTime}
  597. </if>
  598. <if test="endTime != null and endTime != ''">
  599. and a.scrq <![CDATA[<=]]> #{endTime}
  600. </if>
  601. <if test="wllbCode != null and wllbCode != ''">
  602. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  603. </if>
  604. <if test="materialName != null and materialName != ''">
  605. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  606. </if>
  607. <if test="storageLocationCode != null and storageLocationCode != ''">
  608. and a.storage_location_code = #{storageLocationCode}
  609. </if>
  610. <if test="userName != null and userName != ''">
  611. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  612. </if>
  613. <if test="realName != null and realName != ''">
  614. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  615. </if>
  616. <if test="productionCode != null and productionCode != ''">
  617. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  618. </if>
  619. <if test="storageCode != null and storageCode != ''">
  620. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  621. </if>
  622. <if test="productionCode != null and productionCode != ''">
  623. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  624. </if>
  625. <if test="wbs != null and wbs != ''">
  626. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  627. </if>
  628. <if test="companyNumber != null and companyNumber != ''">
  629. and a.account_sleeve = #{companyNumber}
  630. </if>
  631. </trim>
  632. order by a.scrq desc
  633. </select>
  634. <!-- 查询半成品入库流水导出-->
  635. <select id="productExcel" resultType="java.util.LinkedHashMap">
  636. select
  637. b.name,
  638. a.wllb_code,
  639. a.produc_date,
  640. a.capacity,
  641. c.user_name,
  642. a.scrq,
  643. a.storage_code,
  644. if(a.wbs = '' , null ,a.wbs) wbs,
  645. c.real_name as realName,
  646. if(a.production_code = '' , null ,a.production_code) as productionCode,
  647. e.name as accountName,
  648. a.account_sleeve as accountSleeve
  649. from tld_half_product a
  650. left join tld_material b on a.wllb_code = b.code
  651. left join tld_user c on a.user_id = c.id
  652. left join tld_company e on a.account_sleeve = e.code
  653. <trim prefix="WHERE" prefixOverrides="and |or">
  654. <if test="startTime != null and startTime != ''">
  655. and a.scrq <![CDATA[>=]]> #{startTime}
  656. </if>
  657. <if test="endTime != null and endTime != ''">
  658. and a.scrq <![CDATA[<=]]> #{endTime}
  659. </if>
  660. <if test="wllbCode != null and wllbCode != ''">
  661. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  662. </if>
  663. <if test="materialName != null and materialName != ''">
  664. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  665. </if>
  666. <if test="storageLocationCode != null and storageLocationCode != ''">
  667. and a.storage_location_code = #{storageLocationCode}
  668. </if>
  669. <if test="userName != null and userName != ''">
  670. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  671. </if>
  672. <if test="realName != null and realName != ''">
  673. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  674. </if>
  675. <if test="productionCode != null and productionCode != ''">
  676. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  677. </if>
  678. <if test="storageCode != null and storageCode != ''">
  679. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  680. </if>
  681. <if test="wbs != null and wbs != ''">
  682. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  683. </if>
  684. <if test="companyNumber != null and companyNumber != ''">
  685. and a.account_sleeve = #{companyNumber}
  686. </if>
  687. </trim>
  688. order by a.scrq desc
  689. </select>
  690. <!-- 查询要料单信息 -->
  691. <select id="getAskGoodsHalf" resultType="com.tld.model.AskGoods">
  692. select a.id,
  693. a.ask_goods_id,
  694. a.material_id,
  695. a.wbs,
  696. a.measurement_id,
  697. a.num,
  698. a.out_num,
  699. a.entry_number,
  700. b.source_type,
  701. b.move_type,
  702. c.code as wllbCode,
  703. a.type,
  704. b.department
  705. from tld_ask_goods a
  706. join tld_ask_goods_f b on a.ask_goods_id = b.ask_goods_id
  707. left join tld_material c on a.material_id = c.tld_id
  708. where a.ask_goods_id = #{askGoodsId}
  709. and a.material_id = #{materialId}
  710. </select>
  711. <!-- 修改要货单出库数量 -->
  712. <update id="updateAskGoodsHalf">
  713. update tld_ask_goods
  714. set out_num = ifnull(out_num, 0) + #{warehousingNum}
  715. <if test="type != null and type != ''">
  716. ,type = '1'
  717. </if>
  718. where id = #{id}
  719. </update>
  720. <!-- 新增半成品流水 -->
  721. <insert id="addRemovalHalfProduct">
  722. insert into tld_removal_half_product(wllb_code, num, user_id, scrq, ask_goods_id, department, storage_code, wbs, account_sleeve)
  723. value (#{wllbCode},#{num},#{userId},now(),#{askGoodsId},#{department},#{storageCode},#{wbs},#{companyNumber})
  724. </insert>
  725. <!-- 查询指定物料内容 -->
  726. <select id="getMaterial" resultType="com.tld.model.MaterialClass">
  727. select
  728. code as wllbCode,
  729. name as wllbName,
  730. tld_id,
  731. specification_and_model,
  732. unit_of_measurement,
  733. size,
  734. wllb_class,
  735. is_not_disable,
  736. ifnull(is_recommend,'') as isRecommend,
  737. part_type
  738. from tld_material
  739. <trim prefix="WHERE" prefixOverrides="and |or">
  740. <if test="materialId != null and materialId != ''">
  741. and tld_id = #{materialId}
  742. </if>
  743. <if test="materialCode != null and materialCode != ''">
  744. and code = #{materialCode}
  745. </if>
  746. </trim>
  747. </select>
  748. <!-- 查询库存信息 -->
  749. <select id="getInventoryInfo" resultType="com.tld.model.Inventory">
  750. select storage_location_code,
  751. wllb_class,
  752. library_type,
  753. material_id,
  754. amount,
  755. total,
  756. totime,
  757. hold,
  758. amount_lock,
  759. account_sleeve,
  760. wbs,
  761. supplier_id,
  762. serial,
  763. wllb_code,
  764. produc_date,
  765. scrq,
  766. produc_batch,
  767. attribute
  768. from tld_inventory
  769. where storage_location_code = #{storageLocationCode}
  770. </select>
  771. <!-- 产成品入库 -->
  772. <insert id="addHalf">
  773. insert into tld_half(wllb_code, produc_date, produc_batch, capacity, user_id, storage_location_code, scrq,
  774. serial, seq, attribute, storage_code, wbs, production_code,account_sleeve,transmission_type)
  775. value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{serial},#{seq},#{attribute},#{storageCode},#{wbs},#{productionCode},#{accountSleeve},0)
  776. </insert>
  777. <!-- 查询虚拟表数据进行入库 -->
  778. <select id="getVirtualNotice" resultType="com.tld.model.WarehousingVirtual">
  779. select a.id,
  780. a.unique_code,
  781. a.num,
  782. a.storage_location_code,
  783. a.wllb_code,
  784. a.supp_id,
  785. a.serial,
  786. a.type,
  787. a.produc_date,
  788. a.capacity,
  789. a.seq,
  790. a.user_id,
  791. a.attribute,
  792. a.storage_location_name,
  793. b.user_name,
  794. a.account_sleeve
  795. from tld_warehousing_virtual a
  796. left join tld_user b on a.user_id = b.id
  797. where a.unique_code = #{uniqueCode}
  798. and a.type = #{type}
  799. and a.notice_id = #{noticeId}
  800. </select>
  801. <!-- 产成品入库流水 -->
  802. <select id="getHalf" resultType="com.tld.model.Notice">
  803. select
  804. a.id,
  805. a.wllb_code,
  806. a.produc_date,
  807. a.produc_batch,
  808. a.capacity,
  809. a.user_id,
  810. a.storage_location_code,
  811. e.storage_location_name as storageLocationName,
  812. a.scrq,
  813. a.serial,
  814. a.seq,
  815. a.attribute,
  816. b.name as materialName,
  817. c.user_name as userName,
  818. b.code as materialCode,
  819. a.storage_code,
  820. a.wbs,
  821. c.real_name as realName,
  822. a.production_code as productionCode,
  823. a.account_sleeve as companyNumber,
  824. f.name as accountName
  825. from tld_half a
  826. left join tld_material b on a.wllb_code = b.code
  827. left join tld_user c on a.user_id = c.id
  828. left join tld_storage_location e on a.storage_location_code = e.storage_location_code
  829. left join tld_company f on a.account_sleeve = f.code
  830. <trim prefix="WHERE" prefixOverrides="and |or">
  831. <if test="startTime != null and startTime != ''">
  832. and a.scrq <![CDATA[>=]]> #{startTime}
  833. </if>
  834. <if test="endTime != null and endTime != ''">
  835. and a.scrq <![CDATA[<=]]> #{endTime}
  836. </if>
  837. <if test="materialName != null and materialName != ''">
  838. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  839. </if>
  840. <if test="wllbCode != null and wllbCode != ''">
  841. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  842. </if>
  843. <if test="userName != null and userName != ''">
  844. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  845. </if>
  846. <if test="realName != null and realName != ''">
  847. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  848. </if>
  849. <if test="attribute != null and attribute != ''">
  850. and a.attribute like CONCAT(CONCAT('%', #{attribute}), '%')
  851. </if>
  852. <if test="storageCode != null and storageCode != ''">
  853. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  854. </if>
  855. <if test="wbs != null and wbs != ''">
  856. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  857. </if>
  858. <if test="storageLocationName != null and storageLocationName != ''">
  859. and e.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  860. </if>
  861. <if test="productionCode != null and productionCode != ''">
  862. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  863. </if>
  864. <if test="companyNumber != null and companyNumber != ''">
  865. and a.account_sleeve = #{companyNumber}
  866. </if>
  867. </trim>
  868. order by a.scrq desc
  869. </select>
  870. <!-- 产成品导出 -->
  871. <select id="getHalfExcel" resultType="java.util.LinkedHashMap">
  872. select
  873. b.name as materialName,
  874. a.wllb_code,
  875. if(a.produc_batch = '' , null , a.produc_batch) as producBatch,
  876. a.capacity,
  877. c.user_name as userName,
  878. a.storage_location_code,
  879. a.scrq,
  880. a.serial,
  881. if(a.attribute = '' , null , a.attribute) as attribute,
  882. a.storage_code,
  883. if(a.wbs = '' , null , a.wbs) as wbs,
  884. c.real_name as realName,
  885. a.production_code as productionCode,
  886. f.name as accountName,
  887. a.account_sleeve as accountSleeve
  888. from tld_half a
  889. left join tld_material b on a.wllb_code = b.code
  890. left join tld_user c on a.user_id = c.id
  891. left join tld_company f on a.account_sleeve = f.code
  892. <trim prefix="WHERE" prefixOverrides="and |or">
  893. <if test="startTime != null and startTime != ''">
  894. and a.scrq <![CDATA[>=]]> #{startTime}
  895. </if>
  896. <if test="endTime != null and endTime != ''">
  897. and a.scrq <![CDATA[<=]]> #{endTime}
  898. </if>
  899. <if test="materialName != null and materialName != ''">
  900. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  901. </if>
  902. <if test="wllbCode != null and wllbCode != ''">
  903. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  904. </if>
  905. <if test="userName != null and userName != ''">
  906. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  907. </if>
  908. <if test="realName != null and realName != ''">
  909. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  910. </if>
  911. <if test="attribute != null and attribute != ''">
  912. and a.attribute like CONCAT(CONCAT('%', #{attribute}), '%')
  913. </if>
  914. <if test="storageCode != null and storageCode != ''">
  915. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  916. </if>
  917. <if test="wbs != null and wbs != ''">
  918. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  919. </if>
  920. <if test="productionCode != null and productionCode != ''">
  921. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  922. </if>
  923. <if test="storageLocationName != null and storageLocationName != ''">
  924. and e.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  925. </if>
  926. <if test="companyNumber != null and companyNumber != ''">
  927. and a.account_sleeve = #{companyNumber}
  928. </if>
  929. </trim>
  930. order by a.scrq desc
  931. </select>
  932. <!-- 查询通知单虚拟库扫描数 -->
  933. <select id="getSumScanNumVal" resultType="int">
  934. SELECT ifnull(sum(a.num), 0)
  935. FROM tld_warehousing_virtual a
  936. left join tld_material b on a.wllb_code = b.code
  937. WHERE a.notice_id = #{noticeId} and b.tld_id = #{materialId}
  938. </select>
  939. <!-- 修改报工单入库数量 -->
  940. <update id="updateNotice">
  941. update tld_notice
  942. set warehousing_num = (warehousing_num + 0) + #{warehousingNum}
  943. <if test="type != null and type != ''">
  944. ,type = '1'
  945. </if>
  946. where notice_id = #{noticeId}
  947. and material_id = #{materialId}
  948. </update>
  949. <!-- 查询产成品是否扫描 -->
  950. <select id="getScanIsNotProduct" resultType="java.util.Map">
  951. select (select count(*)
  952. from tld_inventory
  953. where attribute = #{attribute}
  954. and serial = #{serial}
  955. and wllb_code = #{materialCode}
  956. and produc_date = #{producBatch}) as inventoryCount,
  957. (select count(*)
  958. from tld_warehousing_virtual
  959. where attribute = #{attribute}
  960. and serial = #{serial}
  961. and wllb_code = #{materialCode}
  962. and produc_date = #{producBatch}) as virtualCount
  963. from dual
  964. </select>
  965. <!-- 查询昨天没满的库位 -->
  966. <select id="getStorageLocationCode" resultType="String">
  967. SELECT ifnull(max(storage_location_code), "0")
  968. FROM tld_inventory
  969. WHERE attribute = #{attribute} and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE() and material_id = #{materialId} and account_sleeve = #{companyNumber}
  970. <if test="producBatch != null">
  971. and produc_batch = #{producBatch}
  972. </if>
  973. ORDER BY scrq desc LIMIT 1
  974. </select>
  975. <select id="getCountStorage" resultType="int">
  976. SELECT count(*)
  977. FROM tld_inventory
  978. where attribute = #{attribute}
  979. and storage_location_code = #{storageLocationCode}
  980. and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE()
  981. and material_id = #{materialId}
  982. <if test="producBatch != null">
  983. and produc_batch = #{producBatch}
  984. </if>
  985. ORDER BY scrq desc LIMIT 1
  986. </select>
  987. <!-- 增加流水入库编号 -->
  988. <update id="updateStorage">
  989. update tld_storage
  990. set storage_code = #{storageCode}
  991. where wllb_code = #{wllbCode}
  992. and supplier_id = #{suppId}
  993. and serial = #{serial}
  994. and produc_batch = #{producDate}
  995. </update>
  996. <!-- 查询公共设置 -->
  997. <select id="getNumUtil" resultType="int">
  998. select num
  999. from tld_util
  1000. where type = #{type}
  1001. </select>
  1002. <!-- 其他入库 -->
  1003. <update id="updateInventoryOther">
  1004. update tld_inventory
  1005. set amount = (amount + 0) + #{amount}
  1006. where id = #{id}
  1007. </update>
  1008. <!-- 移库虚拟库入库 -->
  1009. <update id="updateVitrualNum">
  1010. update tld_inventory
  1011. set amount = amount + #{num}
  1012. where material_id = #{materialId}
  1013. and storage_location_code = #{storageLocationCode}
  1014. </update>
  1015. <!-- 其他入库返回gs -->
  1016. <insert id="addReturnWarehousingOther">
  1017. insert into tld_return_gs_other_warehousing
  1018. (storage_code, account_sleeve, storage_location_code, notice_id, notice_code,
  1019. amount,wbs,wbs_code,wbs_name,notice_time,warehouse_where,source_type,move_type,entry_number,wms_item_id,material_id,wms_id)
  1020. value
  1021. (#{storageCode},#{companyNumber},#{storageLocationCode},#{noticeId},#{noticeCode},#{num},#{wbs},#{code},#{name},
  1022. now(),#{warehouseWhere},#{sourceType},#{moveType},#{entryNumber},#{wmsItemId},#{materialId},#{wmsId})
  1023. </insert>
  1024. <!-- 其他入库 -->
  1025. <insert id="addInventoryOther">
  1026. insert into tld_inventory(storage_location_code, wllb_class, library_type, material_id, amount, totime,
  1027. amount_lock, account_sleeve, wbs, supplier_id, serial, wllb_code, produc_date, scrq,
  1028. produc_batch, attribute)
  1029. value (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},now(),'0',#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},now(),#{producDate},#{attribute})
  1030. </insert>
  1031. <!-- 查询扫描数量 -->
  1032. <select id="getSumWarehousingVirtual" resultType="java.util.Map">
  1033. select
  1034. (select ifnull(sum(num), 0) from tld_warehousing_virtual where receive_goods_id = #{receiveGoodsId}) as scanNum,
  1035. (select (qualified_num + 0) - ifnull((warehousing_num + 0), 0) from tld_receive_goods where id = #{receiveGoodsId}) as num
  1036. from dual
  1037. </select>
  1038. <!-- 查询扫描数量 -->
  1039. <select id="getWarehouseTransferVirtual" resultType="java.util.Map">
  1040. select
  1041. (select ifnull(sum(num), 0) from tld_warehousing_virtual where warehouse_transfer_id = #{warehouseTransferId} and wllb_code = #{wllbCode}) as scanNum,
  1042. (select (num + 0) - ifnull((out_num + 0), 0) from tld_warehouse_transfer where warehouse_transfer_id = #{warehouseTransferId} and material_id = #{materialId}) as num
  1043. from dual
  1044. </select>
  1045. <!-- 流水增加传输状态 -->
  1046. <update id="updateWarehousingType">
  1047. update tld_storage set transmission_type = #{type} where storage_code = #{storageCode}
  1048. </update>
  1049. <!-- 查询其他入库 -->
  1050. <select id="getNotices" resultType="com.tld.model.Notice">
  1051. select
  1052. b.notice_code,
  1053. b.notice_id,
  1054. b.company_number,
  1055. b.source_type,
  1056. b.move_type,
  1057. a.entry_number,
  1058. a.id as wmsItemId,
  1059. b.id as wmsId,
  1060. a.wbs,
  1061. c.code,
  1062. c.name,
  1063. a.entry_number
  1064. from tld_notices a
  1065. join tld_notices_f b on a.notice_id = b.notice_id
  1066. left join tld_wbs c on a.wbs = c.tld_id
  1067. where a.notice_id = #{noticeId} and a.entry_number = #{entryNumber} and a.material_id = #{materialId}
  1068. </select>
  1069. <!--查询删除信息-->
  1070. <select id="getOtherReceivingGoods" resultType="java.util.Map">
  1071. select * from tld_notices where id = #{id}
  1072. </select>
  1073. <!--查询删除信息-->
  1074. <select id="getOtherShipments" resultType="java.util.Map">
  1075. select * from tld_enquiry where id = #{id}
  1076. </select>
  1077. <!-- 往单据上增加数量 -->
  1078. <update id="updateNoticesWarehousingNum">
  1079. update tld_notices set warehousing_num = warehousing_num + #{amount} where notice_id = #{noticeId} and entry_number = #{entryNumber}
  1080. </update>
  1081. </mapper>