ccl冷凝胶后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

309 lines
13 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.spring.modules.shipment.mapper.ShipmentMapper">
  4. <sql id="columns">
  5. ifs.shipment_id,ifs.site,ifs.customer_no,ifs.customer_name,ifs.ship_date,sh.create_date
  6. </sql>
  7. <select id="selectShipmentList" resultType="com.spring.modules.shipment.entity.Shipment">
  8. select <include refid="columns" /> from v_ifs_shipment ifs
  9. inner join customer c on ifs.customer_no = c.customer_no and ifs.site = c.site
  10. left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
  11. <where>
  12. <!-- and sh.create_date is null-->
  13. <if test="site != null and site != ''">
  14. and ifs.site = #{site}
  15. </if>
  16. <if test="shipmentId != null and shipmentId != ''">
  17. and ifs.shipment_id like #{shipmentId}
  18. </if>
  19. <if test="startDate != null">
  20. and ifs.ship_date >= #{startDate}
  21. </if>
  22. <if test="endDate != null">
  23. and #{endDate} >= ifs.ship_date
  24. </if>
  25. <if test="status == '未装箱'">
  26. and sh.create_date is null
  27. </if>
  28. <if test="status == '已出货'">
  29. and sh.create_date is not null
  30. </if>
  31. <if test="status == '装箱中'">
  32. and sh.create_date is null and EXISTS (
  33. SELECT 1
  34. FROM shipment_scan_box_catch ssbc
  35. WHERE ssbc.site = ifs.site
  36. AND ssbc.shipment_id = ifs.shipment_id
  37. )
  38. </if>
  39. </where>
  40. order by ifs.ship_date desc
  41. </select>
  42. <select id="selectShipmentPage" resultType="com.spring.modules.shipment.entity.Shipment">
  43. select <include refid="columns" /> from v_ifs_shipment ifs
  44. inner join customer c on ifs.customer_no = c.customer_no and ifs.site = c.site
  45. left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
  46. <where>
  47. <!-- and sh.create_date is null-->
  48. <if test="params.site != null and params.site != ''">
  49. and ifs.site = #{params.site}
  50. </if>
  51. <if test="params.shipmentId != null and params.shipmentId != ''">
  52. and ifs.shipment_id like #{params.shipmentId}
  53. </if>
  54. <if test="params.startDate != null">
  55. and ifs.ship_date >= #{params.startDate}
  56. </if>
  57. <if test="params.endDate != null">
  58. and #{params.endDate} >= ifs.ship_date
  59. </if>
  60. <if test="params.status == '未装箱'">
  61. and sh.create_date is null
  62. </if>
  63. <if test="params.status == '已出货'">
  64. and sh.create_date is not null
  65. </if>
  66. <if test="params.status == '装箱中'">
  67. and sh.create_date is null and EXISTS (
  68. SELECT 1
  69. FROM shipment_scan_box_catch ssbc
  70. WHERE ssbc.site = ifs.site
  71. AND ssbc.shipment_id = ifs.shipment_id
  72. )
  73. </if>
  74. </where>
  75. order by ifs.ship_date desc
  76. </select>
  77. <select id="searchTransDetailsubCachData" resultType="com.spring.modules.material.data.TransDetailsubCachData">
  78. select ssrc.site as Site,
  79. ssrc.part_no as PartNo,
  80. ssrc.roll_no as RollNo,
  81. ssrc.location_id as LocationID,
  82. ssrc.roll_qty as RollQty,
  83. ssrc.batch_no as BatchNo,
  84. ssrc.ref as wdrNo,
  85. ssrc.location_id as LocationID,
  86. ssrc.manufacturer_time as ManufactureDate,
  87. ssrc.expiration_date as ExpiredDate,
  88. ssrc.create_by as enterBy,
  89. ssrc.create_time as enterDate,
  90. ssbc.box_no_str as BoxNo,
  91. dbo.get_part_desc(ssrc.site, ssrc.part_no) partDesc,
  92. dbo.get_user_display(ssrc.create_by) enterByName
  93. from shipment_scan_roll_catch ssrc
  94. left join shipment_scan_box_catch ssbc on ssrc.site = ssbc.site and ssrc.shipment_id = ssbc.shipment_id and ssrc.box_no = ssbc.box_no
  95. where ssrc.site = #{site}
  96. and ssrc.shipment_id = #{shipmentId}
  97. </select>
  98. <select id="getDetailDataByCach" resultType="com.spring.modules.material.data.TransDetailData">
  99. select a.site as Site,
  100. #{trans.transNo} as TransNo,
  101. a.part_no as PartNo,
  102. a.location_id as LocationID,
  103. sum(a.roll_qty) as TransQty,
  104. '-' as Direction,
  105. a.batch_no as BatchNo,
  106. 'N' as VitualPartFlag,
  107. a.manufacturer_time as ManufactureDate,
  108. a.expiration_date as ExpiredDate,
  109. 0 as StandCost,
  110. 0 as ActualCost,
  111. 0 as Price,
  112. 0 as Freight,
  113. 0 as Duty,
  114. sum(a.roll_qty) as TransQty2,
  115. a.create_by as enterBy,
  116. a.ref as wdrNo
  117. from shipment_scan_roll_catch a
  118. where a.site = #{ship.site} and a.shipment_id = #{ship.shipmentId}
  119. GROUP BY a.site,a.shipment_id,a.part_no,a.location_id,a.batch_no,a.manufacturer_time,a.expiration_date,A.create_by,a.ref
  120. </select>
  121. <insert id="saveShipmentHandle">
  122. insert into shipment_handle(shipment_id, site, create_by, create_date)
  123. values (#{shipmentId}, #{site}, #{createBy}, #{createDate})
  124. </insert>
  125. <select id="queryShipment" resultType="com.spring.modules.shipment.vo.ShipmentVo">
  126. select <include refid="columns" /> from v_ifs_shipment ifs
  127. left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
  128. <where>
  129. <!-- and sh.create_date is null-->
  130. <if test="site != null and site != ''">
  131. and ifs.site = #{site}
  132. </if>
  133. <if test="shipmentId != null and shipmentId != ''">
  134. and ifs.shipment_id like #{shipmentId}
  135. </if>
  136. </where>
  137. </select>
  138. <select id="querySofinalRoll" resultType="com.spring.modules.schedule.data.SoFinalRollData">
  139. select top 1
  140. sf.id, sf.site,
  141. sf.order_no,
  142. sf.part_no,
  143. sf.seq_no,
  144. sf.final_roll_no,
  145. sf.roll_qty,
  146. sf.status_code,
  147. sf.status,
  148. sf.created_by,
  149. sf.created_date,
  150. sf.label_date,
  151. sf.fqc_date,
  152. sf.fqc_by,
  153. sf.manufacture_date,
  154. sf.rm_roll_no,
  155. sf.expired_date,
  156. sf.system_batch_no,
  157. sf.raw_material_batch_no
  158. from TransDetailsub td
  159. left join so_final_roll sf on td.Site = sf.site and sf.final_roll_no = td.RollNo
  160. <where>
  161. <if test="shipmentId != null and shipmentId != ''">
  162. and td.orderRef1 = #{shipmentId}
  163. </if>
  164. <if test="site != null and site != ''">
  165. and td.Site = #{site}
  166. </if>
  167. <if test="partNo != null and partNo != ''">
  168. and sf.part_no = #{partNo}
  169. </if>
  170. </where>
  171. </select>
  172. <select id="queryTransHeader" resultType="com.spring.modules.material.entity.TransHeader">
  173. select top 1 TransNo,
  174. Site,
  175. WarehouseID,
  176. TransDate,
  177. TransType_DB,
  178. TransType,
  179. UserName,
  180. Receiver,
  181. TransYear,
  182. TransMonth,
  183. PartnerID,
  184. PartnerName,
  185. PartnerType,
  186. AuthorizeFlag,
  187. AuthorizeDate,
  188. Authorizor,
  189. TransferFlag,
  190. TransferDate,
  191. TransferGuys,
  192. VoucherDate,
  193. ProjectID,
  194. ProjectName,
  195. EnterDate,
  196. Remark,
  197. UseLocation,
  198. OrderRef1,
  199. LinkOrderFlag,
  200. DelAddID,
  201. Status
  202. from TransHeader
  203. where Site = #{site}
  204. and OrderRef1 = #{shipmentId} and Status = '已录入' and TransType_DB = 'SP' and LinkOrderFlag = 'Y'
  205. order by TransDate desc
  206. </select>
  207. <select id="queryTransDetail" resultType="com.spring.modules.material.entity.TransDetail">
  208. select transno,
  209. site,
  210. itemno,
  211. partno,
  212. locationid,
  213. transqty,
  214. direction,
  215. batchno,
  216. standcost,
  217. actualcost,
  218. price,
  219. freight,
  220. duty,
  221. orderref1,
  222. orderref2,
  223. orderref3,
  224. orderref4,
  225. orderref5,
  226. remark,
  227. vitualpartflag,
  228. manufacturedate,
  229. expireddate,
  230. transqty2,
  231. costgroupid,
  232. orderreftype_db,
  233. orderreftype,
  234. wdr_no,
  235. enterdate,
  236. enterby
  237. from TransDetail
  238. where Site = #{site}
  239. and TransNo = #{transNo}
  240. </select>
  241. <insert id="saveTransDetails">
  242. insert into TransDetail(transno, site, itemno, partno, locationid, transqty, direction, batchno, standcost, actualcost, price, freight, duty, orderref1, orderref2, orderref3, orderref4, orderref5, remark, vitualpartflag, manufacturedate, expireddate, transqty2, costgroupid, orderreftype_db, orderreftype, wdr_no, enterdate, enterby)
  243. values
  244. <foreach collection="list" item="item" separator=",">
  245. (#{item.transNo}, #{item.site}, #{item.itemNo}, #{item.partNo}, #{item.locationID}, #{item.transQty}, #{item.direction}, #{item.batchNo}, #{item.standCost}, #{item.actualCost}, #{item.price}, #{item.freight}, #{item.duty}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4}, #{item.orderRef5}, #{item.remark}, #{item.vitualPartFlag}, #{item.manufactureDate}, #{item.expiredDate}, #{item.transQty2}, #{item.costGroupID}, #{item.orderRefTypeDb}, #{item.orderRefType}, #{item.wdrNo}, #{item.enterDate}, #{item.enterBy})
  246. </foreach>
  247. </insert>
  248. <select id="queryTransDetailSub" resultType="com.spring.modules.material.entity.TransDetailsub">
  249. select transno,
  250. site,
  251. seqno,
  252. itemno,
  253. locationid,
  254. batchno,
  255. boxno,
  256. rollno,
  257. rollqty,
  258. orderref1,
  259. orderref2,
  260. orderref3,
  261. orderref4,
  262. orderref5,
  263. remark
  264. from TransDetailsub
  265. where TransNo = #{transNo}
  266. and Site = #{site}
  267. </select>
  268. <insert id="saveTransDetailSubs">
  269. insert into TransDetailsub(transno, site, seqno, itemno, locationid, batchno, boxno, rollno, rollqty, orderref1, orderref2, orderref3, orderref4, orderref5, remark)
  270. values
  271. <foreach collection="list" item="item" separator=",">
  272. (#{item.transNo}, #{item.site}, #{item.seqNo}, #{item.itemNo}, #{item.locationID}, #{item.batchNo}, #{item.boxNo}, #{item.rollNo}, #{item.rollQty}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4}, #{item.orderRef5}, #{item.remark})
  273. </foreach>
  274. </insert>
  275. <delete id="removeShipmentHandle">
  276. delete from shipment_handle
  277. where shipment_id = #{shipmentId} and site = #{site}
  278. </delete>
  279. <update id="updateTransHeader">
  280. update TransHeader set Status = #{status},LinkOrderFlag = #{linkOrderFlag},Remark = #{remark} where Site = #{site} and TransNo = #{transNo}
  281. </update>
  282. <select id="getTransNo" resultType="java.lang.String">
  283. select dbo.Get_TransNo(#{site},#{spr})
  284. </select>
  285. <update id="updateTransNo">
  286. exec dbo.UpdateTransNo #{site},#{spr}
  287. </update>
  288. <insert id="saveTransHeader">
  289. insert into TransHeader(transno, site, warehouseid, transdate, transtype_db, transtype, username, receiver, transyear, transmonth, partnerid, partnername, partnertype, authorizeflag, authorizedate, authorizor, transferflag, transferdate, transferguys, voucherdate, projectid, projectname, enterdate, remark, uselocation, orderref1, linkorderflag, deladdid, status)
  290. values (#{transNo}, #{site}, #{warehouseID}, #{transDate}, #{transTypeDb}, #{transType}, #{userName}, #{receiver}, #{transYear,jdbcType=FLOAT}, #{transMonth,jdbcType=FLOAT}, #{partnerID}, #{partnerName}, #{partnerType}, #{authorizeFlag}, #{authorizeDate}, #{authorizor}, #{transferFlag}, #{transferDate}, #{transferGuys}, #{voucherDate}, #{projectID}, #{projectName}, #{enterDate}, #{remark}, #{useLocation}, #{orderRef1}, #{linkOrderFlag}, #{delAddID}, #{status})
  291. </insert>
  292. </mapper>