AskGoodsMapper.xml 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609
  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.AskGoodsMapper">
  5. <!-- 查询要货单id+物料id是否存在 -->
  6. <select id="getAskGoods" resultType="int">
  7. select count(*)
  8. from tld_ask_goods
  9. where ask_goods_id = #{askGoodsId}
  10. and material_id = #{materialId}
  11. </select>
  12. <!-- 修改要料申请单数量 -->
  13. <update id="updateAskGoodsNum">
  14. update tld_ask_goods
  15. set num =#{num}
  16. where ask_goods_id = #{askGoodsId}
  17. and material_id = #{materialId}
  18. </update>
  19. <!-- 新增要料申请单 -->
  20. <insert id="addAskGoods">
  21. insert into tld_ask_goods(ask_goods_id, entry_number, production_code, material_id, wbs, measurement_id, num,
  22. type, out_num)
  23. values (#{askGoodsId}, #{entryNumber}, #{productionCode}, #{materialId}, #{wbs}, #{measurementId}, #{num},
  24. #{type}, '0')
  25. </insert>
  26. <!-- 新增要料日志 -->
  27. <insert id="addAskGoodsLog">
  28. insert into tld_ask_goods_log(ask_goods_id, entry_number, production_code, material_id, wbs, measurement_id,
  29. num, out_num, ask_goods_code, company_number, sqrq, department_id, source_type,
  30. move_type, ask_goods_type,request_type_number,request_type_name,if_commodity)
  31. values (#{askGoodsId}, #{entryNumber}, #{productionCode}, #{materialId}, #{wbs}, #{measurementId}, #{num},
  32. #{outNum}, #{askGoodsCode}, #{companyNumber}, #{sqrq}, #{departmentId}, #{sourceType}, #{moveType},
  33. #{askGoodsType},#{requestTypeNumber},#{requestTypeName},#{ifCommodity})
  34. </insert>
  35. <!-- 查询次要货单是否存在 -->
  36. <select id="getAskGoodsf" resultType="int">
  37. select count(*)
  38. from tld_ask_goods_f
  39. where ask_goods_id = #{askGoodsId}
  40. and ask_goods_code = #{askGoodsCode}
  41. </select>
  42. <!-- 新增要料申请单父级 -->
  43. <insert id="addAskGoodsf">
  44. insert into tld_ask_goods_f(ask_goods_id, ask_goods_code, company_number, sqrq, department, source_type,
  45. move_type,request_type_number,request_type_name,if_commodity)
  46. values (#{askGoodsId}, #{askGoodsCode}, #{companyNumber}, #{sqrq}, #{departmentId}, #{sourceType}, #{moveType},#{requestTypeNumber},#{requestTypeName},#{ifCommodity})
  47. </insert>
  48. <!-- 查询生产领料单 -->
  49. <select id="getAskGoodsfList" resultType="com.tld.model.AskGoods">
  50. SELECT a.ask_goods_id,
  51. a.material_id,
  52. IFNULL(a.out_num, 0) AS num,
  53. e.NAME AS materialName,
  54. e.CODE AS materialCode,
  55. b.ask_goods_code,
  56. b.company_number,
  57. c.name as departmentName,
  58. g.name as companyName,
  59. b.source_type,
  60. b.move_type,
  61. a.entry_number,
  62. a.production_code,
  63. a.wbs
  64. FROM tld_ask_goods a
  65. JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
  66. LEFT JOIN tld_department c ON b.department = c.code
  67. JOIN tld_material e ON a.material_id = e.tld_id
  68. left join tld_company g on b.company_number = g.code
  69. WHERE (a.num + 0) <![CDATA[>]]> (
  70. IFNULL(a.out_num, 0) + 0)
  71. and e.part_type != '半成品' and e.part_type != '产成品'
  72. </select>
  73. <!-- 查询指定生产单的物料 -->
  74. <select id="getAskGoodsMaterial" resultType="com.tld.model.AskGoods">
  75. SELECT a.ask_goods_id,
  76. a.material_id,
  77. a.num,
  78. IFNULL(a.out_num, 0) AS out_num,
  79. e.NAME AS materialName,
  80. e.CODE AS materialCode,
  81. e.part_type as partType,
  82. b.ask_goods_code,
  83. b.company_number,
  84. b.sqrq,
  85. c.name,
  86. c.code,
  87. c.id AS departmentId,
  88. a.production_code,
  89. a.wbs,
  90. a.entry_number,
  91. e.wllb_class
  92. FROM tld_ask_goods a
  93. JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
  94. LEFT JOIN tld_department c ON b.department = c.code
  95. JOIN tld_material e ON a.material_id = e.tld_id
  96. WHERE (a.num + 0) <![CDATA[>]]> (
  97. IFNULL(a.out_num, 0) + 0)
  98. and e.part_type != '半成品' and e.part_type != '产成品'
  99. and a.ask_goods_id = #{askGoodsId} and e.code in (select material_id from tld_user_material where user_id = #{userId})
  100. </select>
  101. <!-- 查询指定生产单的物料 -->
  102. <select id="getAskGoodsMaterialTest" resultType="com.tld.model.AskGoods">
  103. SELECT a.ask_goods_id,
  104. a.material_id,
  105. a.num,
  106. IFNULL(a.out_num, 0) AS out_num,
  107. e.NAME AS materialName,
  108. e.CODE AS materialCode,
  109. e.part_type as partType,
  110. b.ask_goods_code,
  111. b.company_number,
  112. b.sqrq,
  113. c.name,
  114. c.code,
  115. c.id AS departmentId,
  116. a.production_code,
  117. a.wbs,
  118. a.entry_number,
  119. e.wllb_class,
  120. b.sqrq
  121. FROM tld_invite a
  122. JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
  123. LEFT JOIN tld_department c ON b.department = c.code
  124. JOIN tld_material e ON a.material_id = e.tld_id
  125. WHERE (a.num + 0) <![CDATA[>]]> (
  126. IFNULL(a.out_num, 0) + 0) and b.sqrq > '2023-05-12'
  127. </select>
  128. <!-- 物料库位选择 -->
  129. <select id="getMaterialCk" resultType="com.tld.model.Inventory">
  130. select
  131. a.id,
  132. a.storage_location_code,
  133. a.wllb_class,
  134. a.library_type,
  135. a.material_id,
  136. (a.amount - ifnull(a.amount_lock, 0)) as amount,
  137. a.total,
  138. a.totime,
  139. a.hold,
  140. a.amount_lock,
  141. a.account_sleeve,
  142. a.wbs,
  143. a.supplier_id,
  144. a.serial,
  145. a.wllb_code,
  146. a.produc_date,
  147. a.scrq,
  148. b.storage_location_name as storageLocationName
  149. from tld_inventory a
  150. join tld_storage_location b on a.storage_location_code = b.storage_location_code
  151. join tld_warehouse c on b.warehouse_where = c.tld_id
  152. where a.material_id = #{materialId}
  153. and a.account_sleeve = #{companyNumber}
  154. and a.hold = '0'
  155. and (c.warehouse_type = '0' or c.warehouse_type = '1' or c.warehouse_type = '2')
  156. and a.wbs = #{wbs}
  157. order by a.produc_batch
  158. </select>
  159. <!-- 新增出库虚拟表 -->
  160. <insert id="addAskGoodsVitrual">
  161. insert into tld_ask_goods_vitrual(unique_code, supplier_id, serial, wllb_code, produc_date, ask_goods_id, type,
  162. storage_location_code, num, user_id, department, attribute, account_sleeve,
  163. storage_location_code_rk, wbs, entry_number)
  164. values (#{uniqueCode}, #{supplierId}, #{serial}, #{wllbCode}, #{producDate}, #{askGoodsId}, #{type},
  165. #{storageLocationCode}, #{num}, #{userId}, #{department}, #{attribute}, #{companyNumber},
  166. #{storageLocationCodeRk}, #{wbs}, #{entryNumber})
  167. </insert>
  168. <!-- 查询指定库存内容 -->
  169. <select id="getInventory" resultType="com.tld.model.Inventory">
  170. select id,
  171. storage_location_code,
  172. wllb_class,
  173. library_type,
  174. material_id,
  175. amount,
  176. total,
  177. totime,
  178. hold,
  179. amount_lock,
  180. account_sleeve,
  181. wbs,
  182. supplier_id,
  183. serial,
  184. wllb_code,
  185. produc_date,
  186. scrq
  187. from tld_inventory
  188. where supplier_id = #{supplierId}
  189. and serial = #{serial}
  190. and wllb_code = #{wllbCode}
  191. and produc_date = #{producDate}
  192. and account_sleeve = #{companyNumber}
  193. <if test="wbs != null">
  194. and wbs = #{wbs}
  195. </if>
  196. </select>
  197. <!-- 查询指定库存内容 -->
  198. <select id="getInventoryWarehousing" resultType="com.tld.model.Inventory">
  199. select id,
  200. storage_location_code,
  201. wllb_class,
  202. library_type,
  203. material_id,
  204. amount,
  205. total,
  206. totime,
  207. hold,
  208. amount_lock,
  209. account_sleeve,
  210. wbs,
  211. supplier_id,
  212. serial,
  213. wllb_code,
  214. produc_date,
  215. scrq
  216. from tld_inventory
  217. where storage_location_code = #{storageLocationCode}
  218. and wllb_code = #{wllbCode}
  219. and account_sleeve = #{companyNumber}
  220. and wbs = #{wbs}
  221. </select>
  222. <!-- 查询库存是否充足 -->
  223. <select id="getAsk" resultType="com.tld.model.AskGoods">
  224. SELECT ifnull(sum(a.num), 0) as num
  225. FROM tld_ask_goods_vitrual a
  226. join tld_material b on a.wllb_code = b.code and b.tld_id = #{materialId}
  227. where a.storage_location_code = #{storageLocationCode}
  228. and a.serial = #{serial} and wbs = #{wbs} and account_sleeve = #{accountSleeve}
  229. </select>
  230. <!-- 查询是否扫描 -->
  231. <select id="getScanIsNot" resultType="java.util.Map">
  232. select (select ifnull(max(amount), 0)
  233. from tld_inventory
  234. where supplier_id = #{supplierId}
  235. and serial = #{serial}
  236. and wllb_code = #{wllbCode}
  237. and produc_date = #{producDate}) as inventoryNum,
  238. (select ifnull(sum(num), 0)
  239. from tld_ask_goods_vitrual
  240. where supplier_id = #{supplierId}
  241. and serial = #{serial}
  242. and wllb_code = #{wllbCode}
  243. and produc_date = #{producDate}
  244. and type = #{type}) as virtualNum
  245. from dual
  246. </select>
  247. <!-- 查询指定送货单信息 -->
  248. <select id="getAsknInfo" resultType="com.tld.model.AskGoods">
  249. SELECT a.id,
  250. a.ask_goods_id,
  251. a.entry_number,
  252. a.production_code,
  253. a.material_id,
  254. a.wbs,
  255. a.measurement_id,
  256. a.num,
  257. ifnull(a.out_num, 0) as out_num
  258. FROM tld_ask_goods a
  259. join tld_material b on a.material_id = b.tld_id
  260. where a.ask_goods_id = #{askGoodsId}
  261. and b.code = #{wllbCode} and a.entry_number = #{entryNumber}
  262. </select>
  263. <!-- 查询指定移庫單 -->
  264. <select id="getWareInfo" resultType="com.tld.model.AskGoods">
  265. SELECT a.id,
  266. a.warehouse_transfer_id as askGoodsId,
  267. a.entry_number,
  268. a.material_id,
  269. a.wbs,
  270. a.measurement_id,
  271. a.num,
  272. ifnull(a.out_num, 0) as out_num
  273. FROM tld_warehouse_transfer a
  274. join tld_material b on a.material_id = b.tld_id
  275. where a.warehouse_transfer_id = #{askGoodsId}
  276. and b.code = #{wllbCode}
  277. </select>
  278. <!-- 查询已扫描总数 -->
  279. <select id="getAskInfoNumVitrual" resultType="int">
  280. select ifnull(sum(num), 0)
  281. from tld_ask_goods_vitrual
  282. where wllb_code = #{wllbCode}
  283. and ask_goods_id = #{askGoodsId}
  284. and account_sleeve = #{accountSleeve}
  285. and wbs = #{wbs}
  286. and type = #{type}
  287. </select>
  288. <!-- 查询此库存在虚拟表里占用的数量 -->
  289. <select id="getInventoryAlready" resultType="int">
  290. select ifnull(sum(num), 0)
  291. from tld_ask_goods_vitrual
  292. where supplier_id = #{supplierId}
  293. and serial = #{serial}
  294. and wllb_code = #{wllbCode}
  295. and produc_date = #{producDate}
  296. and account_sleeve = #{accountSleeve}
  297. and wbs = #{wbs}
  298. and type = #{type}
  299. </select>
  300. <!-- 查询虚拟表指定pda跟状态的的数据 -->
  301. <select id="getVirtualUniqueCode" resultType="com.tld.model.AskGoods">
  302. select id,
  303. unique_code,
  304. supplier_id,
  305. serial,
  306. wllb_code,
  307. produc_date,
  308. ask_goods_id,
  309. type,
  310. storage_location_code,
  311. num,
  312. user_id,
  313. department,
  314. account_sleeve,
  315. wbs,
  316. storage_location_code_rk,
  317. entry_number
  318. from tld_ask_goods_vitrual
  319. where unique_code = #{uniqueCode}
  320. and type = #{type}
  321. and ask_goods_id = #{askGoodsId}
  322. </select>
  323. <!-- 删除库存 -->
  324. <delete id="deleteInventory">
  325. delete
  326. from tld_inventory
  327. where id = #{id}
  328. </delete>
  329. <!-- 修改库存数量 -->
  330. <update id="updateInventory">
  331. UPDATE tld_inventory
  332. SET amount = amount - #{amount}
  333. WHERE id = #{id}
  334. </update>
  335. <!-- 删除虚拟表出库记录 -->
  336. <delete id="deleteVirtual">
  337. delete
  338. from tld_ask_goods_vitrual
  339. where id = #{id}
  340. </delete>
  341. <!-- 插入出库流水 -->
  342. <insert id="addRemoval">
  343. insert into tld_removal(wllb_code, supplier_id, serial, num, type, user_id, storage_location_code, scrq,
  344. process, ask_goods_id, produc_date, department, storage_code, wbs, account_sleeve,transmission_type)
  345. values (#{wllbCode}, #{supplierId}, #{serial}, #{num}, #{type}, #{userId}, #{storageLocationCode}, now(),
  346. #{process}, #{askGoodsId}, #{producDate}, #{department}, #{storageCode}, #{wbs}, #{companyNumber},'0')
  347. </insert>
  348. <!-- 查询指定物料类型的id -->
  349. <select id="getMaterialId" resultType="String">
  350. select tld_id
  351. from tld_material
  352. where code = #{wllbCode}
  353. </select>
  354. <!-- 查询要料申请单内容 -->
  355. <select id="getAskDetailed" resultType="com.tld.model.AskGoods">
  356. select id,
  357. ask_goods_id,
  358. entry_number,
  359. production_code,
  360. material_id,
  361. wbs,
  362. measurement_id,
  363. num,
  364. out_num
  365. from tld_ask_goods
  366. where ask_goods_id = #{askGoodsId}
  367. and material_id = #{materialId}
  368. <if test="entryNumber != null and entryNumber != ''">
  369. and entry_number = #{entryNumber}
  370. </if>
  371. </select>
  372. <!-- 新增返回gs数据字表信息 -->
  373. <insert id="addReturnGsRemoval">
  374. insert into tld_return_gs_removal_z(material_id, wbs, num, entry_number, document_id, document_points_id,
  375. storage_location_code)
  376. values (#{materialId}, #{wbs}, #{num}, #{entryNumber}, #{documentId}, #{documentPointsId},
  377. #{storageLocationCode})
  378. </insert>
  379. <!-- 查询要货单父级信息 -->
  380. <select id="getAskDetailedF" resultType="com.tld.model.AskGoods">
  381. select id,
  382. ask_goods_id,
  383. ask_goods_code,
  384. company_number,
  385. sqrq,
  386. department,
  387. source_type,
  388. move_type
  389. from tld_ask_goods_f
  390. where ask_goods_id = #{askGoodsId}
  391. </select>
  392. <!-- 新增返回gs数据父表信息 -->
  393. <insert id="addReturnGsRemovalF">
  394. insert into tld_return_gs_removal(document_id, removal_code, source_type, move_type, scrq, delivery_type)
  395. values (#{documentId}, #{removalCode}, #{sourceType}, #{moveType}, now(), #{deliveryType})
  396. </insert>
  397. <!-- 添加 tld_access 记录-->
  398. <insert id="addAccess">
  399. insert into tld_access (type, data, scrq, access_type)
  400. values (#{names}, #{returnGsRemoval}, now(), #{accessType})
  401. </insert>
  402. <!--出库回传数据导入-->
  403. <insert id="importExcel">
  404. insert into tld_outgoing_return(ask_id,ask_code,entry_number,amount,amount_num,amount_number,move_type,
  405. material_id,inventory_organization,warehouse,wbs)
  406. values
  407. <foreach collection="list" item="item" index="index" separator=",">
  408. (#{item.askId},#{item.askCode},#{item.entryNumber},#{item.amount},#{item.amountNum},#{item.amountNumber},#{item.moveType},#{item.materialId},#{item.inventoryOrganization},#{item.warehouse}
  409. ,#{item.wbs})
  410. </foreach>
  411. </insert>
  412. <!--添加GS返回数据-->
  413. <insert id="addReturnWarehousing">
  414. insert into tld_return_gs_warehousing(storage_code,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number,storage_location_code)
  415. values(#{storageCode},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber},#{storageLocationCode})
  416. </insert>
  417. <!--销售出库导入数据-->
  418. <insert id="marketImport">
  419. insert into tld_market_return(order_number,order_officer,supplier_name,material_code,material_name,num,arrival_time,
  420. arrival_type,company,remark,delivery_order)
  421. values
  422. <foreach collection="list" item="item" index="index" separator=",">
  423. (#{item.orderNumber},#{item.orderOfficer},#{item.supplierName},#{item.materialCode},#{item.materialName},#{item.num},#{item.arrivalTime},#{item.arrivalType},#{item.company},#{item.remark}
  424. ,#{item.deliveryOrder})
  425. </foreach>
  426. </insert>
  427. <!--销售出库导入数据导入物料code-->
  428. <insert id="marketImports">
  429. insert into tld_market_return(material_code)
  430. values
  431. <foreach collection="list" item="item" index="index" separator=",">
  432. (#{item.materialCode})
  433. </foreach>
  434. </insert>
  435. <!-- 查询当天出库数量 -->
  436. <select id="getReturnRemovalCount" resultType="int">
  437. select count(*)
  438. from tld_return_gs_removal
  439. where scrq BETWEEN CONCAT(CURDATE(), ' 00:00:00') AND CONCAT(CURDATE(), ' 23:59:59');
  440. </select>
  441. <!-- 查询回传数据 -->
  442. <select id="plugOutRemoval" resultType="java.util.Map">
  443. select id,
  444. document_id as askGoodsId,
  445. removal_code as removalCode,
  446. source_type as sourceType,
  447. move_type as moveType,
  448. scrq
  449. from tld_return_gs_removal
  450. where document_id = #{removalCode}
  451. </select>
  452. <!-- 查询字表回传数据 -->
  453. <select id="getRemovalz" resultType="java.util.Map">
  454. SELECT a.material_id AS materialId,
  455. a.wbs,
  456. a.num,
  457. a.entry_number AS entryNumber,
  458. a.document_id AS askGoodsId,
  459. a.document_points_id AS askId,
  460. ifnull(a.wbs, '') as wbsId,
  461. ifnull(c.code, '') as wbsCode,
  462. ifnull(c.name, '') as wbsName
  463. FROM tld_return_gs_removal_z a
  464. join tld_storage_location b on a.storage_location_code = b.storage_location_code
  465. left join tld_wbs c on a.wbs = c.tld_id
  466. WHERE a.document_id = #{askGoodsId}
  467. and b.warehouse_where = #{warehouseWhere}
  468. </select>
  469. <!-- 查询出库流水 -->
  470. <select id="getRemoval" resultType="com.tld.model.AskGoods">
  471. select
  472. a.id,
  473. b.name as materialName,
  474. a.wllb_code,
  475. h.name as supplierName,
  476. a.serial,
  477. a.type,
  478. c.user_name as userName,
  479. e.name as department,
  480. g.storage_location_name as storageLocationName,
  481. a.scrq,
  482. a.num,
  483. a.storage_code,
  484. a.wbs,
  485. a.ask_goods_id,
  486. c.real_name as realName,
  487. a.account_sleeve,
  488. f.name as accountName,
  489. p.ask_goods_code as askGoodsCode
  490. from tld_removal a
  491. left join tld_material b on a.wllb_code = b.code
  492. left join tld_user c on a.user_id = c.id
  493. left join tld_department e on a.department = e.code
  494. left join tld_storage_location g on a.storage_location_code = g.storage_location_code
  495. left join tld_customer h on a.supplier_id = h.code
  496. left join tld_company f on a.account_sleeve = f.code
  497. left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
  498. <trim prefix="WHERE" prefixOverrides="and |or">
  499. <if test="startTime != null and startTime != ''">
  500. and a.scrq <![CDATA[>=]]> #{startTime}
  501. </if>
  502. <if test="endTime != null and endTime != ''">
  503. and a.scrq <![CDATA[<=]]> #{endTime}
  504. </if>
  505. <if test="type != null and type != ''">
  506. and a.type like CONCAT(CONCAT('%', #{type}), '%')
  507. </if>
  508. <if test="supplierId != null and supplierId != ''">
  509. and a.supplier_id = #{supplierId}
  510. </if>
  511. <if test="department != null and department != ''">
  512. and a.department = #{department}
  513. </if>
  514. <if test="storageCode != null and storageCode != ''">
  515. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  516. </if>
  517. <if test="storageLocationName != null and storageLocationName != ''">
  518. and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  519. </if>
  520. <if test="wllbCode != null and wllbCode != ''">
  521. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  522. </if>
  523. <if test="materialName != null and materialName != ''">
  524. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  525. </if>
  526. <if test="userName != null and userName != ''">
  527. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  528. </if>
  529. <if test="realName != null and realName != ''">
  530. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  531. </if>
  532. <if test="askGoodsId != null and askGoodsId != ''">
  533. and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
  534. </if>
  535. <if test="askGoodsCode != null and askGoodsCode != ''">
  536. and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
  537. </if>
  538. <if test="wbs != null and wbs != ''">
  539. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  540. </if>
  541. <if test="accountSleeve != null and accountSleeve != ''">
  542. and a.account_sleeve = #{accountSleeve}
  543. </if>
  544. </trim>
  545. order by a.id desc
  546. </select>
  547. <!-- 导出 -->
  548. <select id="export" resultType="java.util.LinkedHashMap">
  549. select
  550. b.name as materialName,
  551. if(h.name = '',null,h.name) as supplierName,
  552. if(a.serial = '',null,a.serial) as serial,
  553. a.type,
  554. c.user_name as userName,
  555. e.name as department,
  556. g.storage_location_name as storageLocationName,
  557. a.scrq,
  558. a.num,
  559. p.ask_goods_code,
  560. c.real_name,
  561. f.name as accountName
  562. from tld_removal a
  563. left join tld_material b on a.wllb_code = b.code
  564. left join tld_user c on a.user_id = c.id
  565. left join tld_department e on a.department = e.code
  566. left join tld_storage_location g on a.storage_location_code = g.storage_location_code
  567. left join tld_customer h on a.supplier_id = h.code
  568. left join tld_company f on a.account_sleeve = f.code
  569. left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
  570. <trim prefix="WHERE" prefixOverrides="and |or">
  571. <if test="startTime != null and startTime != ''">
  572. and a.scrq <![CDATA[>=]]> #{startTime}
  573. </if>
  574. <if test="endTime != null and endTime != ''">
  575. and a.scrq <![CDATA[<=]]> #{endTime}
  576. </if>
  577. <if test="type != null and type != ''">
  578. and a.type like CONCAT(CONCAT('%', #{type}), '%')
  579. </if>
  580. <if test="supplierId != null and supplierId != ''">
  581. and a.supplier_id = #{supplierId}
  582. </if>
  583. <if test="department != null and department != ''">
  584. and a.department = #{department}
  585. </if>
  586. <if test="storageCode != null and storageCode != ''">
  587. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  588. </if>
  589. <if test="storageLocationName != null and storageLocationName != ''">
  590. and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  591. </if>
  592. <if test="wllbCode != null and wllbCode != ''">
  593. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  594. </if>
  595. <if test="materialName != null and materialName != ''">
  596. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  597. </if>
  598. <if test="userName != null and userName != ''">
  599. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  600. </if>
  601. <if test="realName != null and realName != ''">
  602. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  603. </if>
  604. <if test="askGoodsId != null and askGoodsId != ''">
  605. and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
  606. </if>
  607. <if test="askGoodsCode != null and askGoodsCode != ''">
  608. and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
  609. </if>
  610. <if test="wbs != null and wbs != ''">
  611. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  612. </if>
  613. <if test="accountSleeve != null and accountSleeve != ''">
  614. and a.account_sleeve = #{accountSleeve}
  615. </if>
  616. </trim>
  617. order by a.id desc
  618. </select>
  619. <!-- 查询指定pda出库虚拟表 -->
  620. <select id="getAskGoodsVitrual" resultType="com.tld.model.AskGoods">
  621. select id,
  622. unique_code,
  623. supplier_id,
  624. serial,
  625. wllb_code,
  626. produc_date,
  627. ask_goods_id,
  628. type,
  629. storage_location_code,
  630. num,
  631. user_id,
  632. department,
  633. account_sleeve,
  634. wbs,
  635. attribute,
  636. entry_number
  637. from tld_ask_goods_vitrual
  638. where unique_code = #{uniqueCode}
  639. and type = #{type}
  640. </select>
  641. <!-- 删除指定虚拟表数据 -->
  642. <delete id="delAskGoodsVitrual">
  643. delete
  644. from tld_ask_goods_vitrual
  645. where id = #{id}
  646. and type = #{type}
  647. </delete>
  648. <!-- 删除出库回传主表信息 -->
  649. <delete id="delPlugOutRemoval">
  650. delete
  651. from tld_return_gs_removal
  652. where document_id = #{removalCode}
  653. </delete>
  654. <!-- 删除出库回传子表信息 -->
  655. <delete id="delRemovalz">
  656. delete
  657. from tld_return_gs_removal_z
  658. where document_id = #{removalCode}
  659. </delete>
  660. <!-- 删除入库回传信息 -->
  661. <delete id="delPlugOutWarehousing">
  662. delete
  663. from tld_return_gs_warehousing
  664. where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
  665. </delete>
  666. <!-- 修改出库数量 -->
  667. <update id="updateOutNum">
  668. update tld_ask_goods
  669. set out_num = ifnull(out_num, 0) + #{num}
  670. where material_id = #{materialId}
  671. and ask_goods_id = #{askGoodsId}
  672. <if test="entryNumber != null and entryNumber != ''">
  673. and entry_number = #{entryNumber}
  674. </if>
  675. </update>
  676. <!-- 查询指定pda 指定物料扫描总数 -->
  677. <select id="getScanNum" resultType="String">
  678. select if(sum(num) is null, 0, sum(num))
  679. from tld_ask_goods_vitrual
  680. where unique_code = #{uniqueCode}
  681. and ask_goods_id = #{askGoodsId}
  682. and wllb_code = #{wllbCode}
  683. and entry_number = #{entryNumber}
  684. </select>
  685. <!-- 查询半成品出库数据 -->
  686. <select id="getGoodsHalf" resultType="com.tld.model.AskGoods">
  687. SELECT
  688. a.id,
  689. a.material_id,
  690. a.num,
  691. a.production_code,
  692. b.name as materialName,
  693. b.code as materialCode,
  694. a.out_num,
  695. a.ask_goods_id,
  696. c.company_number,
  697. e.name as department,
  698. a.type,
  699. a.wbs,
  700. a.entry_number,
  701. g.name as companyName,
  702. c.source_type,
  703. c.move_type,
  704. c.sqrq,
  705. c.ask_goods_code
  706. FROM
  707. tld_ask_goods a
  708. join tld_material b on a.material_id = b.tld_id
  709. join tld_ask_goods_f c on a.ask_goods_id = c.ask_goods_id
  710. left join tld_department e on c.department = e.code
  711. left join tld_company g on c.company_number = g.code
  712. WHERE
  713. -- (a.num + 0) <![CDATA[>]]> (a.out_num + 0)
  714. b.part_type = #{partType}
  715. <if test="userId != null and userId != ''">
  716. and b.code in (select material_id from tld_user_material where user_id = #{userId})
  717. </if>
  718. <if test="productionCode != null and productionCode != ''">
  719. and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
  720. </if>
  721. <if test="askGoodsId != null and askGoodsId != ''">
  722. and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
  723. </if>
  724. <if test="askGoodsCode != null and askGoodsCode != ''">
  725. and c.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
  726. </if>
  727. <if test="id != null and id != ''">
  728. and a.id = #{id}
  729. </if>
  730. <if test="type != null and type != ''">
  731. and a.type = #{type}
  732. </if>
  733. <if test="startTime != null and startTime != ''">
  734. and c.sqrq <![CDATA[>=]]> #{startTime}
  735. </if>
  736. <if test="endTime != null and endTime != ''">
  737. and c.sqrq <![CDATA[<=]]> #{endTime}
  738. </if>
  739. <if test="materialName != null and materialName != ''">
  740. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  741. </if>
  742. <if test="materialCode != null and materialCode != ''">
  743. and b.code like CONCAT(CONCAT('%', #{materialCode}), '%')
  744. </if>
  745. <if test="departmentCode != null and departmentCode != ''">
  746. and c.department = #{departmentCode}
  747. </if>
  748. <if test="companyCode != null and companyCode != ''">
  749. and c.company_number = #{companyCode}
  750. </if>
  751. <if test="entryNumber != null and entryNumber != ''">
  752. and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
  753. </if>
  754. <if test="sourceType != null and sourceType != ''">
  755. and c.source_type like CONCAT(CONCAT('%', #{sourceType}), '%')
  756. </if>
  757. <if test="moveType != null and moveType != ''">
  758. and c.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
  759. </if>
  760. order by a.id desc
  761. </select>
  762. <!-- 查询半成品出库流水 -->
  763. <select id="getRemovalHalfProduct" resultType="com.tld.model.AskGoods">
  764. select
  765. a.id,
  766. a.wllb_code,
  767. a.num,
  768. a.user_id,
  769. a.scrq,
  770. a.ask_goods_id,
  771. c.name as department,
  772. b.name as materialName,
  773. e.user_name as userName,
  774. b.code as materialCode,
  775. a.storage_code,
  776. a.wbs,
  777. e.real_name as realName,
  778. a.account_sleeve,
  779. f.name as accountName,
  780. p.ask_goods_code as askGoodsCode
  781. from tld_removal_half_product a
  782. left join tld_material b on a.wllb_code = b.code
  783. left join tld_department c on a.department = c.code
  784. left join tld_user e on a.user_id = e.id
  785. left join tld_company f on a.account_sleeve = f.code
  786. left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
  787. <trim prefix="WHERE" prefixOverrides="and |or">
  788. <if test="wllbCode != null and wllbCode != ''">
  789. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  790. </if>
  791. <if test="startTime != null and startTime != ''">
  792. and a.scrq <![CDATA[>=]]> #{startTime}
  793. </if>
  794. <if test="endTime != null and endTime != ''">
  795. and a.scrq <![CDATA[<=]]> #{endTime}
  796. </if>
  797. <if test="departmentCode != null and departmentCode != ''">
  798. and a.department = #{departmentCode}
  799. </if>
  800. <if test="materialName != null and materialName != ''">
  801. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  802. </if>
  803. <if test="userName != null and userName != ''">
  804. and e.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  805. </if>
  806. <if test="realName != null and realName != ''">
  807. and e.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  808. </if>
  809. <if test="askGoodsId != null and askGoodsId != ''">
  810. and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
  811. </if>
  812. <if test="askGoodsCode != null and askGoodsCode != ''">
  813. and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
  814. </if>
  815. <if test="storageCode != null and storageCode != ''">
  816. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  817. </if>
  818. <if test="wbs != null and wbs != ''">
  819. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  820. </if>
  821. <if test="accountSleeve != null and accountSleeve != ''">
  822. and a.account_sleeve = #{accountSleeve}
  823. </if>
  824. </trim>
  825. order by a.scrq desc
  826. </select>
  827. <!-- 查询半成品出库流水导出 -->
  828. <select id="getRemovalHalfProductExcel" resultType="java.util.LinkedHashMap">
  829. select
  830. if(p.ask_goods_code = '' , null , p.ask_goods_code ) as askGoodsCode,
  831. a.storage_code as storageCode,
  832. a.wllb_code as wllbCode,
  833. b.name as materialName,
  834. a.num,
  835. e.user_name as userName,
  836. if(c.name = '' , null , c.name ) as department,
  837. if(a.wbs = '' , null , a.wbs ) as wbs,
  838. a.scrq,
  839. e.real_name as realName,
  840. f.name as accountName
  841. from tld_removal_half_product a
  842. left join tld_material b on a.wllb_code = b.code
  843. left join tld_department c on a.department = c.code
  844. left join tld_user e on a.user_id = e.id
  845. left join tld_company f on a.account_sleeve = f.code
  846. left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
  847. <trim prefix="WHERE" prefixOverrides="and |or">
  848. <if test="wllbCode != null and wllbCode != ''">
  849. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  850. </if>
  851. <if test="startTime != null and startTime != ''">
  852. and a.scrq <![CDATA[>=]]> #{startTime}
  853. </if>
  854. <if test="endTime != null and endTime != ''">
  855. and a.scrq <![CDATA[<=]]> #{endTime}
  856. </if>
  857. <if test="departmentCode != null and departmentCode != ''">
  858. and a.department = #{departmentCode}
  859. </if>
  860. <if test="materialName != null and materialName != ''">
  861. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  862. </if>
  863. <if test="userName != null and userName != ''">
  864. and e.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  865. </if>
  866. <if test="realName != null and realName != ''">
  867. and e.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  868. </if>
  869. <if test="askGoodsId != null and askGoodsId != ''">
  870. and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
  871. </if>
  872. <if test="askGoodsCode != null and askGoodsCode != ''">
  873. and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
  874. </if>
  875. <if test="storageCode != null and storageCode != ''">
  876. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  877. </if>
  878. <if test="wbs != null and wbs != ''">
  879. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  880. </if>
  881. <if test="accountSleeve != null and accountSleeve != ''">
  882. and a.account_sleeve = #{accountSleeve}
  883. </if>
  884. </trim>
  885. order by a.scrq desc
  886. </select>
  887. <!-- 产成品出库流水 -->
  888. <select id="getRemovalHalf" resultType="com.tld.model.AskGoods">
  889. select
  890. a.id,
  891. a.wllb_code,
  892. a.num,
  893. a.user_id,
  894. a.scrq,
  895. a.delivery_id,
  896. a.company_number,
  897. a.customer_code,
  898. b.name as materialName,
  899. c.user_name as userName,
  900. e.name as customerName,
  901. f.name as companyName,
  902. b.code as materialCode,
  903. a.serial,
  904. a.storage_code,
  905. a.wbs,
  906. c.real_name as realName,
  907. p.delivery_code as deliveryCode
  908. from tld_removal_half a
  909. left join tld_material b on a.wllb_code = b.code
  910. left join tld_user c on a.user_id = c.id
  911. left join tld_customer e on a.customer_code = e.code
  912. left join tld_company f on a.company_number = f.code
  913. left join tld_delivery_f p on a.delivery_id = p.delivery_id
  914. <trim prefix="WHERE" prefixOverrides="and |or">
  915. <if test="wllbCode != null and wllbCode != ''">
  916. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  917. </if>
  918. <if test="materialName != null and materialName != ''">
  919. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  920. </if>
  921. <if test="userName != null and userName != ''">
  922. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  923. </if>
  924. <if test="realName != null and realName != ''">
  925. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  926. </if>
  927. <if test="deliveryId != null and deliveryId != ''">
  928. and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
  929. </if>
  930. <if test="deliveryCode != null and deliveryCode != ''">
  931. and p.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
  932. </if>
  933. <if test="companyCode != null and companyCode != ''">
  934. and a.company_number = #{companyCode}
  935. </if>
  936. <if test="customerCode != null and customerCode != ''">
  937. and a.customer_code = #{customerCode}
  938. </if>
  939. <if test="storageCode != null and storageCode != ''">
  940. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  941. </if>
  942. <if test="wbs != null and wbs != ''">
  943. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  944. </if>
  945. <if test="startTime != null and startTime != ''">
  946. and a.scrq <![CDATA[>=]]> #{startTime}
  947. </if>
  948. <if test="endTime != null and endTime != ''">
  949. and a.scrq <![CDATA[<=]]> #{endTime}
  950. </if>
  951. </trim>
  952. order by a.scrq desc
  953. </select>
  954. <!-- 产成品导出出库流水 -->
  955. <select id="getRemovalHalfExcel" resultType="java.util.LinkedHashMap">
  956. select
  957. p.delivery_code as deliveryCode,
  958. b.name as materialName,
  959. a.num,
  960. c.user_name as userName,
  961. a.scrq,
  962. f.name as companyName,
  963. e.name,
  964. a.storage_code,
  965. a.wbs,
  966. c.real_name as realName
  967. from tld_removal_half a
  968. left join tld_material b on a.wllb_code = b.code
  969. left join tld_user c on a.user_id = c.id
  970. left join tld_customer e on a.customer_code = e.code
  971. left join tld_company f on a.company_number = f.code
  972. left join tld_delivery_f p on a.delivery_id = p.delivery_id
  973. <trim prefix="WHERE" prefixOverrides="and |or">
  974. <if test="wllbCode != null and wllbCode != ''">
  975. and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
  976. </if>
  977. <if test="materialName != null and materialName != ''">
  978. and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
  979. </if>
  980. <if test="userName != null and userName != ''">
  981. and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
  982. </if>
  983. <if test="realName != null and realName != ''">
  984. and c.real_name like CONCAT(CONCAT('%', #{realName}), '%')
  985. </if>
  986. <if test="deliveryId != null and deliveryId != ''">
  987. and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
  988. </if>
  989. <if test="deliveryCode != null and deliveryCode != ''">
  990. and p.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
  991. </if>
  992. <if test="companyCode != null and companyCode != ''">
  993. and a.company_number = #{companyCode}
  994. </if>
  995. <if test="customerCode != null and customerCode != ''">
  996. and a.customer_code = #{customerCode}
  997. </if>
  998. <if test="storageCode != null and storageCode != ''">
  999. and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
  1000. </if>
  1001. <if test="wbs != null and wbs != ''">
  1002. and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
  1003. </if>
  1004. <if test="startTime != null and startTime != ''">
  1005. and a.scrq <![CDATA[>=]]> #{startTime}
  1006. </if>
  1007. <if test="endTime != null and endTime != ''">
  1008. and a.scrq <![CDATA[<=]]> #{endTime}
  1009. </if>
  1010. </trim>
  1011. order by a.scrq desc
  1012. </select>
  1013. <!-- 查询指定物料的库存 -->
  1014. <select id="getInventoryInfo" resultType="com.tld.model.Inventory">
  1015. select
  1016. id,
  1017. storage_location_code,
  1018. wllb_class,
  1019. library_type,
  1020. material_id,
  1021. amount,
  1022. total,
  1023. totime,
  1024. hold,
  1025. amount_lock,
  1026. account_sleeve,
  1027. wbs,
  1028. supplier_id,
  1029. serial,
  1030. wllb_code,
  1031. produc_date,
  1032. scrq,
  1033. produc_batch,
  1034. attribute
  1035. from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and
  1036. account_sleeve = #{accountSleeve} and amount <![CDATA[>=]]> (#{num} + 0)
  1037. <if test="wbs != null">
  1038. and wbs = #{wbs}
  1039. </if>
  1040. <if test="storageLocationCode != '' and storageLocationCode != null">
  1041. and storage_location_code = #{storageLocationCode}
  1042. </if>
  1043. <if test="serial != '' and serial != null">
  1044. and serial = #{serial}
  1045. </if>
  1046. <if test="attribute != '' and attribute != null">
  1047. and attribute = #{attribute}
  1048. </if>
  1049. <if test="producDate != '' and producDate != null">
  1050. and produc_date = #{producDate}
  1051. </if>
  1052. <if test="supplierId != '' and supplierId != null">
  1053. and supplier_id = #{supplierId}
  1054. </if>
  1055. order by produc_batch
  1056. </select>
  1057. <!-- 其他入库查询库存是否存在 -->
  1058. <select id="getInventoryInfoOther" resultType="com.tld.model.Inventory">
  1059. select
  1060. a.id,
  1061. a.storage_location_code,
  1062. a.wllb_class,
  1063. a.library_type,
  1064. a.material_id,
  1065. a.amount,
  1066. a.total,
  1067. a.totime,
  1068. a.hold,
  1069. a.amount_lock,
  1070. a.account_sleeve,
  1071. a.wbs,
  1072. a.supplier_id,
  1073. a.serial,
  1074. a.wllb_code,
  1075. a.produc_date,
  1076. a.scrq,
  1077. a.produc_batch,
  1078. a.attribute,
  1079. b.name as accountName,
  1080. c.storage_location_name as storageLocationName,
  1081. c.warehouse_where as warehouseWhere
  1082. from tld_inventory a
  1083. left join tld_company b on a.account_sleeve = b.code
  1084. left join tld_storage_location c on a.storage_location_code = c.storage_location_code
  1085. where material_id = #{materialId}
  1086. <if test="wbs != '' and wbs != null">
  1087. and a.wbs = #{wbs}
  1088. </if>
  1089. <if test="serial != '' and serial != null">
  1090. and a.serial = #{serial}
  1091. </if>
  1092. <if test="attribute != '' and attribute != null">
  1093. and a.attribute = #{attribute}
  1094. </if>
  1095. <if test="producDate != '' and producDate != null">
  1096. and a.produc_batch = #{producDate}
  1097. </if>
  1098. <if test="supplierId != '' and supplierId != null">
  1099. and a.supplier_id = #{supplierId}
  1100. </if>
  1101. <if test="storageLocationCode != '' and storageLocationCode != null">
  1102. and a.storage_location_code = #{storageLocationCode}
  1103. </if>
  1104. <if test="accountSleeve != '' and accountSleeve != null">
  1105. and a.account_sleeve = #{accountSleeve}
  1106. </if>
  1107. </select>
  1108. <!-- 查询仓库 -->
  1109. <select id="getWarehouseWhere" resultType="String">
  1110. SELECT DISTINCT b.warehouse_where
  1111. FROM tld_return_gs_removal_z a
  1112. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1113. WHERE a.document_id = #{removalCode}
  1114. </select>
  1115. <!-- 查询半成品原始数据 -->
  1116. <select id="getInventoryNotice" resultType="java.util.Map">
  1117. select *
  1118. from tld_notice
  1119. where id = #{id}
  1120. </select>
  1121. <!-- 删除半成品/产成品入库通知原始信息 -->
  1122. <delete id="delInventoryNotice">
  1123. delete
  1124. from tld_notice
  1125. where id = #{id}
  1126. </delete>
  1127. <!-- 查询要料申请单 -->
  1128. <select id="getDelAskGoods" resultType="java.util.Map">
  1129. select *
  1130. from tld_ask_goods
  1131. where id = #{id}
  1132. </select>
  1133. <!-- 销售发货单接口文档 父表信息 -->
  1134. <select id="getGsRemoval" resultType="java.util.Map">
  1135. select id,
  1136. document_id as askGoodsId,
  1137. removal_code as removalCode,
  1138. source_type as sourceType,
  1139. move_type as moveType,
  1140. scrq
  1141. from tld_return_gs_removal
  1142. where removal_code = #{removalCode}
  1143. </select>
  1144. <!--查询移库子表中的供货仓库仓库-->
  1145. <select id="getSupplyWarehouseWhere" resultType="java.lang.String">
  1146. SELECT supply_warehouse_id
  1147. FROM tld_return_warehouse_transfer_z
  1148. WHERE warehouse_transfer_id = #{removalCode}
  1149. GROUP BY supply_warehouse_id
  1150. </select>
  1151. <!--查询移库父表信息-->
  1152. <select id="getReturnWarehouseTransfer" resultType="java.util.Map">
  1153. select id,
  1154. warehouse_transfer_id as warehouseTransferId,
  1155. warehouse_transfer_code as warehouseTransferCode,
  1156. ask_goods_warehouse_id as askGoodsWarehouseId,
  1157. warehouse_transfer_type as warehouseTransferType,
  1158. scrq
  1159. from tld_return_warehouse_transfer
  1160. where warehouse_transfer_code = #{removalCode}
  1161. </select>
  1162. <!--查询出父表中的移库id根据code-->
  1163. <select id="getSupplyWarehouseWheres" resultType="java.lang.String">
  1164. select warehouse_transfer_id as warehouseTransferId
  1165. from tld_return_warehouse_transfer
  1166. where warehouse_transfer_code = #{removalCode}
  1167. </select>
  1168. <!--查询移库子表信息-->
  1169. <select id="getReturnWarehouseTransferZ" resultType="java.util.Map">
  1170. select a.id,
  1171. a.warehouse_transfer_id as warehouseTransferId,
  1172. a.entry_number as entryNumber,
  1173. a.supply_warehouse_id as supplyWarehouseId,
  1174. a.material_id as materialId,
  1175. ifnull(a.wbs, '') as wbsId,
  1176. a.out_num as outNum,
  1177. ifnull(b.code, '') as wbsCode,
  1178. ifnull(b.name, '') as wbsName
  1179. from tld_return_warehouse_transfer_z a
  1180. left join tld_wbs b on a.wbs = b.tld_id
  1181. where a.warehouse_transfer_id = #{warehouseTransferId}
  1182. and a.supply_warehouse_id = #{warehouseWhere}
  1183. </select>
  1184. <!-- 删除生产领料 -->
  1185. <delete id="delAskGoods">
  1186. delete
  1187. from tld_ask_goods
  1188. where id = #{id}
  1189. </delete>
  1190. <!--删除移库父表-->
  1191. <delete id="delReturnWarehouseTransfer">
  1192. delete
  1193. from tld_return_warehouse_transfer
  1194. where warehouse_transfer_code = #{removalCode}
  1195. </delete>
  1196. <!--删除移库子表-->
  1197. <delete id="delReturnWarehouseTransferZ">
  1198. delete
  1199. from tld_return_warehouse_transfer_z
  1200. where warehouse_transfer_id = #{warehouseTransferTd}
  1201. </delete>
  1202. <!--删除生产收货父表-->
  1203. <delete id="delNoticeParent">
  1204. delete
  1205. from tld_notice_f
  1206. where notice_id = #{orderNumber}
  1207. </delete>
  1208. <!--删除生产收货子表-->
  1209. <delete id="delNoticeSubtabulation">
  1210. delete
  1211. from tld_notice
  1212. where notice_id = #{orderNumber}
  1213. </delete>
  1214. <!--删除其它入库父表信息-->
  1215. <delete id="delNoticesParent">
  1216. delete
  1217. from tld_return_gs_other_warehousing
  1218. where storage_code = #{noticeId}
  1219. </delete>
  1220. <!--删除其它入库子表信息-->
  1221. <delete id="delNoticesSubtabulation">
  1222. delete
  1223. from tld_notices
  1224. where notice_id = #{noticeId}
  1225. </delete>
  1226. <!--删除虚拟表-->
  1227. <delete id="delReturnGsWarehousing">
  1228. delete
  1229. from tld_return_gs_warehousing
  1230. where order_number = #{orderNumber}
  1231. </delete>
  1232. <!-- 查询名牌物料CODE -->
  1233. <select id="getMing" resultType="String">
  1234. select wllb_code from tld_mingpai where code = #{code}
  1235. </select>
  1236. <!--查询入库单信息-->
  1237. <select id="getReturnGsWarehousing" resultType="com.tld.model.ReturnWarehousing">
  1238. select
  1239. id,
  1240. storage_code,
  1241. gs_ck,
  1242. source_type,
  1243. move_type,
  1244. entry_number,
  1245. wbs,
  1246. material_id,
  1247. warehousing_num,
  1248. receive_goods_id,
  1249. scrq,
  1250. order_number,
  1251. user_name,
  1252. storage_location_code
  1253. from tld_return_gs_warehousing where storage_code = #{removalCode}
  1254. </select>
  1255. <!--根据库位查询仓库-->
  1256. <select id="getStorageLocationWarehouseWhere" resultType="java.util.Map">
  1257. SELECT
  1258. a.id as id,
  1259. a.storage_code as storageCde,
  1260. a.gs_ck as accountSleeve,
  1261. a.source_type as sourceType,
  1262. a.move_type as moveType,
  1263. a.entry_number as entryNumber,
  1264. ifnull(a.wbs, '') as wbsId,
  1265. a.material_id as materialId,
  1266. a.warehousing_num as num,
  1267. a.receive_goods_id as receiveGoodsId,
  1268. a.scrq as scrq,
  1269. a.order_number as orderNumber,
  1270. a.user_name as userName,
  1271. a.storage_location_code as storageLocationCode,
  1272. b.warehouse_where as warehouseWhere
  1273. FROM tld_return_gs_warehousing a
  1274. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1275. WHERE a.storage_code = #{removalCode}
  1276. group by b.warehouse_where
  1277. </select>
  1278. <!--查询父表信息-->
  1279. <select id="getNoticeParent" resultType="java.util.Map">
  1280. select
  1281. id as id,
  1282. notice_id as noticeId,
  1283. notice_code as noticeCode,
  1284. company_number as companyNumber,
  1285. notice_time as noticeTime,
  1286. source_type as sourceType,
  1287. move_type as moveType
  1288. from tld_notice_f where notice_id = #{orderNumber}
  1289. </select>
  1290. <!--查询子表信息-->
  1291. <select id="getNoticeSubtabulation" resultType="java.util.Map">
  1292. select
  1293. a.id as id,
  1294. a.notice_id as noticeId,
  1295. a.entry_number as entryNumber,
  1296. a.production_code as productionCode,
  1297. a.material_id as materialId,
  1298. ifnull(a.wbs, '') as wbsId,
  1299. a.measurement_id as measurementId,
  1300. a.num as num,
  1301. a.type as type,
  1302. a.warehousing_num as warehousingNum,
  1303. ifnull(b.code, '') as wbsCode,
  1304. ifnull(b.name, '') as wbsName
  1305. from tld_notice a
  1306. left join tld_wbs b on a.wbs = b.tld_id
  1307. where a.notice_id = #{orderNumber}
  1308. </select>
  1309. <!--查询库存数量-->
  1310. <select id="getAmount" resultType="java.lang.String">
  1311. select ifnull(sum(amount),'0') as amount from tld_inventory where wbs = #{wbs} and account_sleeve = #{companyNumber} and wllb_code = #{materialCode}
  1312. </select>
  1313. <!--根据入库单编号查询入库单信息-->
  1314. <select id="getReturnGsOtherWarehousing" resultType="com.tld.model.ReturnWarehousing">
  1315. select
  1316. distinct
  1317. id,
  1318. storage_code,
  1319. account_sleeve,
  1320. storage_location_code,
  1321. wbs,
  1322. amount,
  1323. material_id,
  1324. notice_id
  1325. from tld_return_gs_other_warehousing where storage_code = #{removalCode}
  1326. group by notice_id
  1327. </select>
  1328. <!--查询其他入库表信息-->
  1329. <select id="getNoticesParent" resultType="java.util.Map">
  1330. SELECT
  1331. a.id as id,
  1332. a.storage_code as storageCde,
  1333. a.account_sleeve as accountSleeve,
  1334. a.storage_location_code as storageLocationCode,
  1335. a.notice_id as noticeId,
  1336. a.notice_code as noticeCode,
  1337. a.amount as amount,
  1338. ifnull(a.wbs, '') as wbsId,
  1339. ifnull(a.wbs_code, '') as wbsCode,
  1340. ifnull(a.wbs_name, '') as wbsName,
  1341. a.notice_time as noticeTime,
  1342. a.source_type as sourceType,
  1343. a.move_type as moveType,
  1344. a.entry_number as entryNumber,
  1345. a.wms_item_id as wmsItemId,
  1346. a.material_id as materialId,
  1347. a.wms_id as wmsId,
  1348. b.warehouse_where as warehouseWhere
  1349. FROM tld_return_gs_other_warehousing a
  1350. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1351. WHERE a.storage_code = #{noticeId} and a.storage_location_code = #{storageLocationCode}
  1352. </select>
  1353. <!--查询其他入库子表信息-->
  1354. <select id="getNoticesSubtabulation" resultType="java.util.Map">
  1355. select
  1356. a.id as id,
  1357. a.notice_id as noticeId,
  1358. a.entry_number as entryNumber,
  1359. a.material_id as materialId,
  1360. ifnull(a.wbs, '') as wbsId,
  1361. a.measurement_id as measurementId,
  1362. a.num as num,
  1363. a.type as type,
  1364. a.warehousing_num as warehousingNum,
  1365. ifnull(b.code, '') as wbsCode,
  1366. ifnull(b.name, '') as wbsName
  1367. from tld_notices a
  1368. left join tld_wbs b on a.wbs = b.tld_id
  1369. join tld_storage_location c on a.storage_location_code = c.storage_location_code
  1370. where a.notice_id = #{noticeId}
  1371. </select>
  1372. <!--查询仓库信息-->
  1373. <select id="getCreateOtherInStockWarehouseWhere" resultType="java.util.Map">
  1374. SELECT
  1375. a.id as id,
  1376. a.storage_code as storageCde,
  1377. a.account_sleeve as accountSleeve,
  1378. a.storage_location_code as storageLocationCode,
  1379. a.notice_id as noticeId,
  1380. a.notice_code as noticeCode,
  1381. a.amount as amount,
  1382. ifnull(a.wbs, '') as wbsId,
  1383. ifnull(a.wbs_code, '') as wbsCode,
  1384. ifnull(a.wbs_name, '') as wbsName,
  1385. a.notice_time as noticeTime,
  1386. a.source_type as sourceType,
  1387. a.move_type as moveType,
  1388. a.entry_number as entryNumber,
  1389. a.wms_item_id as wmsItemId,
  1390. a.material_id as materialId,
  1391. a.wms_id as wmsId,
  1392. b.warehouse_where as warehouseWhere
  1393. FROM tld_return_gs_other_warehousing a
  1394. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1395. WHERE a.storage_code = #{removalCode}
  1396. group by b.warehouse_where
  1397. </select>
  1398. <!--查询其他发货补领料仓库-->
  1399. <select id="getCreateOtherDeliveryMaterialsWarehouseWhere" resultType="java.util.Map">
  1400. SELECT DISTINCT b.warehouse_where as warehouseWhere
  1401. FROM tld_return_gs_removal_z a
  1402. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1403. join tld_return_gs_removal c on a.document_id = c.document_id
  1404. WHERE c.removal_code = #{removalCode}
  1405. </select>
  1406. <!--查询其他发货父表信息-->
  1407. <select id="getCreateOtherDeliveryMaterialsParent" resultType="java.util.Map">
  1408. select
  1409. id as id,
  1410. ask_goods_id as askGoodsId,
  1411. ask_goods_code as askGoodsCode,
  1412. company_number as companyNumber,
  1413. sqrq as sqrq,
  1414. department as department,
  1415. request_type_number as requestTypeNumber,
  1416. request_type_name as requestType_name,
  1417. source_type as sourceType,
  1418. move_type as moveType,
  1419. if_commodity as ifCommodity,
  1420. ifnull(product_code, '') as productCode,
  1421. from tld_enquiry_f where ask_goods_id = #{documentId}
  1422. </select>
  1423. <!--其他发货父表信息-->
  1424. <select id="getGsRemovals" resultType="java.util.Map">
  1425. select id,
  1426. document_id as askGoodsId,
  1427. removal_code as removalCode,
  1428. source_type as sourceType,
  1429. move_type as moveType,
  1430. scrq
  1431. from tld_return_gs_removal
  1432. where removal_code = #{removalCode}
  1433. </select>
  1434. <!--销售发货单接口查询仓库-->
  1435. <select id="getWarehouseWheres" resultType="java.lang.String">
  1436. SELECT DISTINCT b.warehouse_where as warehouseWhere
  1437. FROM tld_return_gs_removal_z a
  1438. JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
  1439. join tld_return_gs_removal c on a.document_id = c.document_id
  1440. WHERE c.removal_code = #{removalCode}
  1441. </select>
  1442. <select id="test03" resultType="java.util.Map">
  1443. select order_number as orderNumber from tld_return_gs_warehousing where source_type <![CDATA[!=]]> 'W'
  1444. </select>
  1445. <!--生产收货接口文档/报工单 w-->
  1446. <select id="test04" resultType="java.util.Map">
  1447. select storage_code as storageCode from tld_return_gs_warehousing where source_type <![CDATA[=]]> 'W'
  1448. </select>
  1449. <select id="getOutgoingReturnList" resultType="com.tld.model.OutgoingReturn">
  1450. select id,ask_id,ask_code,entry_number,amount,amount_num,amount_number,move_type,material_id,inventory_organization,warehouse,wbs from tld_outgoing_return
  1451. </select>
  1452. <!--查询storage_location_code库位编号-->
  1453. <select id="getLocationCode" resultType="java.lang.String">
  1454. select storage_location_code from tld_storage_location where warehouse_where = #{warehouse} limit 1
  1455. </select>
  1456. <!--查询单据id-->
  1457. <select id="getOutgoingReturn" resultType="com.tld.model.ReturRemoval">
  1458. select id,document_id,removal_code,source_type,move_type,scrq,delivery_type from tld_return_gs_removal
  1459. </select>
  1460. <!--查询父表信息-->
  1461. <select id="getReturnInStorageF" resultType="com.tld.model.ReceiveGoods">
  1462. select order_number,order_code,company_number,supplier_id,arrival_time,order_type,source_type,move_type from tld_receive_goods_f
  1463. </select>
  1464. <!--查询子表信息-->
  1465. <select id="getReturnInStorageZ" resultType="com.tld.model.ReceiveGoods">
  1466. select order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num from tld_receive_goods where order_code = #{orderCode}
  1467. </select>
  1468. <!--查询物料类型-->
  1469. <select id="getMaterialPartType" resultType="java.lang.String">
  1470. select part_type from tld_material where tld_id = #{materialId}
  1471. </select>
  1472. <!--出库错误信息回调-->
  1473. <select id="getOutgoingReturnError" resultType="com.tld.model.Error">
  1474. select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
  1475. where transmission_type = '3'
  1476. and type = '出库回传'
  1477. </select>
  1478. <!--查询销售出库导入数据-->
  1479. <select id="getMarketList" resultType="com.tld.model.MarketReturn">
  1480. select id,order_number,order_officer,supplier_name,material_code,material_name,num,arrival_time,arrival_type,company,remark,delivery_order,delivery_or_not from tld_market_return
  1481. </select>
  1482. <!--查询销售单父子表信息-->
  1483. <select id="getDeliveryF" resultType="com.tld.model.Delivery">
  1484. select
  1485. id,delivery_id,delivery_code,company_number,customer_code,bills_time,delivery_type,source_type,move_type,project_name,project_code
  1486. from tld_delivery_f
  1487. where company_number = '8130'
  1488. and delivery_code = #{deliveryOrder}
  1489. </select>
  1490. <!--查询销售单父子表信息-->
  1491. <select id="getDeliveryZ" resultType="com.tld.model.Delivery">
  1492. select
  1493. id,delivery_id,entry_number,material_id,wbs,measurement_id,gs_delivery_num,gs_cancel_num,out_num,status
  1494. from tld_delivery
  1495. where delivery_id = #{deliveryId}
  1496. and material_id = #{materialId}
  1497. and out_num <![CDATA[=]]> '0'
  1498. </select>
  1499. <!--查询符合条件的数据-->
  1500. <select id="getStorage" resultType="java.util.LinkedHashMap">
  1501. select
  1502. IFNULL(a.wllb_code, '') AS wllbCode,
  1503. IFNULL(a.supplier_id, '') AS supplier_id,
  1504. IFNULL(a.serial, '') AS serial,
  1505. IFNULL(a.produc_date, '') AS produc_date,
  1506. IFNULL(a.produc_batch, '') AS produc_batch,
  1507. IFNULL(a.capacity, '') AS capacity,
  1508. IFNULL(a.process, '') AS process,
  1509. IFNULL(a.seq, '') AS seq,
  1510. IFNULL(a.type, '') AS type,
  1511. IFNULL(a.user_id, '') AS user_id,
  1512. a.department_id,
  1513. IFNULL(a.wllb_code, '') AS wllbCode,
  1514. a.storage_location_code,
  1515. IFNULL(a.wllb_code, '') AS wllbCode,
  1516. a.scrq,
  1517. IFNULL(a.wllb_code, '') AS wllbCode,
  1518. a.storage_code,
  1519. IFNULL(a.wllb_code, '') AS wllbCode,
  1520. a.wbs,
  1521. IFNULL(a.wllb_code, '') AS wllbCode,
  1522. IFNULL(a.order_code, '') AS orderCode,
  1523. a.account_sleeve,
  1524. IFNULL(a.wllb_code, '') AS wllbCode,
  1525. IFNULL(a.purchase_num, '') AS purchaseNum,
  1526. IFNULL(a.transmission_type, '') AS transmission_type
  1527. from tld_storage a
  1528. join tld_market_return b on a.wllb_code = b.material_code
  1529. where account_sleeve = '8130'
  1530. </select>
  1531. <!--入库错误信息回调-->
  1532. <select id="getStorageReturnError" resultType="com.tld.model.Error">
  1533. select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
  1534. where transmission_type = '1'
  1535. and type = '入库回传'
  1536. </select>
  1537. <!--移库错误信息回调-->
  1538. <select id="parkingReturnError" resultType="com.tld.model.Error">
  1539. select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
  1540. where transmission_type = '1'
  1541. and type = '移库'
  1542. </select>
  1543. <!--移库跑数据-->
  1544. <select id="shiftingParkingReturn" resultType="com.tld.model.WarehouseTransfer">
  1545. select id,warehouse_transfer_id,warehouse_transfer_code,ask_goods_warehouse_id,warehouse_transfer_type,scrq from tld_return_warehouse_transfer
  1546. </select>
  1547. <!--查询非生产领料-->
  1548. <select id="getAskGoodsMaterialNot" resultType="com.tld.model.AskGoods">
  1549. SELECT a.ask_goods_id,
  1550. a.material_id,
  1551. a.num,
  1552. IFNULL(a.out_num, 0) AS out_num,
  1553. e.NAME AS materialName,
  1554. e.CODE AS materialCode,
  1555. e.part_type as partType,
  1556. b.ask_goods_code,
  1557. b.company_number,
  1558. b.sqrq,
  1559. c.name,
  1560. c.code,
  1561. c.id AS departmentId,
  1562. a.production_code,
  1563. a.wbs,
  1564. a.entry_number,
  1565. e.wllb_class
  1566. FROM tld_invite a
  1567. JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
  1568. LEFT JOIN tld_department c ON b.department = c.code
  1569. JOIN tld_material e ON a.material_id = e.tld_id
  1570. WHERE (a.num + 0) <![CDATA[>]]> (
  1571. IFNULL(a.out_num, 0) + 0)
  1572. and e.part_type != '半成品' and e.part_type != '产成品'
  1573. and a.ask_goods_id = #{askGoodsId} and e.code in (select material_id from tld_user_material where user_id = #{userId})
  1574. </select>
  1575. <!--其它入库错误信息回调-->
  1576. <select id="otherWarehousingReturnError" resultType="com.tld.model.Error">
  1577. select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
  1578. where transmission_type = '1'
  1579. and type = '其它入库'
  1580. </select>
  1581. <select id="getJsonError" resultType="com.tld.model.Error">
  1582. select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
  1583. where transmission_type = '3'
  1584. and type = '出库回传'
  1585. </select>
  1586. <!-- 修改数据传输状态 -->
  1587. <update id="updateRemoval">
  1588. update tld_removal set transmission_type = "1" where storage_code = #{removalCode}
  1589. <if test="material != null and material != ''">
  1590. and wllb_code = #{material}
  1591. </if>
  1592. </update>
  1593. <!-- 修改数据传输状态 -->
  1594. <update id="updateRemovalHalfProduct">
  1595. update tld_removal_half_product set transmission_type = "1" where storage_code = #{removalCode}
  1596. </update>
  1597. <!-- 修改数据传输状态 -->
  1598. <update id="updateRemovalHalf">
  1599. update tld_removal_half set transmission_type = "1" where storage_code = #{removalCode}
  1600. </update>
  1601. <!-- 往单据上增加数量 -->
  1602. <update id="updateEnquiryOutNum">
  1603. update tld_enquiry set out_num = (out_num + 0) + #{num} where ask_goods_id = #{askGoodsId} and entry_number = #{entryNumber}
  1604. </update>
  1605. <!--产成品出库流水修改连翻号-->
  1606. <update id="UpdSerial">
  1607. update tld_removal_half set serial = #{serial} where id = #{id}
  1608. </update>
  1609. </mapper>