WarehousingMapper.xml 46 KB

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