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.

506 lines
36 KiB

  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.xujie.modules.order.dao.PODetailMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.xujie.modules.order.entity.PODetail">
  6. <id column="order_no" property="orderNo" />
  7. <result column="site" property="site" />
  8. <result column="item_no" property="itemNo" />
  9. <result column="part_no" property="partNo" />
  10. <result column="status" property="status" />
  11. <result column="qty" property="qty" />
  12. <result column="umid" property="umid" />
  13. <result column="convert_factor" property="convertFactor" />
  14. <result column="price" property="price" />
  15. <result column="base_price" property="basePrice" />
  16. <result column="want_receive_date" property="wantReceiveDate" />
  17. <result column="tax_rate" property="taxRate" />
  18. <result column="tax" property="tax" />
  19. <result column="additional_cost" property="additionalCost" />
  20. <result column="freight" property="freight" />
  21. <result column="duty" property="duty" />
  22. <result column="arrive_qty" property="arriveQty" />
  23. <result column="receive_qty" property="receiveQty" />
  24. <result column="qty_returned" property="qtyReturned" />
  25. <result column="qty_replace" property="qtyReplace" />
  26. <result column="qty_scrapt" property="qtyScrapt" />
  27. <result column="invoice_qty" property="invoiceQty" />
  28. <result column="approve_result" property="approveResult" />
  29. <result column="need_inspect_flag" property="needInspectFlag" />
  30. <result column="remark" property="remark" />
  31. <result column="iqc_qty" property="iqcQty" />
  32. <result column="last_update_by" property="lastUpdateBy" />
  33. <result column="pr_convert_note" property="prConvertNote" />
  34. <result column="inspect_type_db" property="inspectTypeDb" />
  35. <result column="inspect_type" property="inspectType" />
  36. <result column="inspect_qty" property="inspectQty" />
  37. <result column="inspect_percent" property="inspectPercent" />
  38. <result column="inspection_level_no" property="inspectionLevelNo" />
  39. <result column="close_tolerance" property="closeTolerance" />
  40. <result column="over_receive_tolerance" property="overReceiveTolerance" />
  41. <result column="item" property="item" />
  42. <result column="c_value" property="value" />
  43. <result column="c_ship_qty" property="shipQty" />
  44. <result column="c_sum_price" property="sumPrice" />
  45. <result column="c_narrival" property="narrival" />
  46. <result column="c_crd" property="crd" />
  47. <result column="c_inspection" property="inspection" />
  48. <result column="c_real_crd" property="realCrd" />
  49. <result column="c_eta" property="eta" />
  50. <result column="c_flexid" property="flexid" />
  51. <result column="c_obd" property="obd" />
  52. <result column="c_doc_sent" property="docSent" />
  53. <result column="c_telex_release" property="telexRelease" />
  54. <result column="c_advance_payment" property="advancePayment" />
  55. <result column="c_advance_paid" property="advancePaid" />
  56. <result column="create_time" property="createTime" />
  57. <result column="c_planner" property="planner" />
  58. <result column="c_edit" property="edit" />
  59. <result column="c_end_planner" property="endPlanner" />
  60. <result column="c_remark_delay" property="remarkDelay" />
  61. <result column="qty_cancelled" property="qtyCancelled" />
  62. <result column="inspect_method_db" property="inspectMethodDb" />
  63. <result column="to_inv_nofity_qty" property="toInvNofityQty" />
  64. <result column="upload_date" property="uploadDate" />
  65. <result column="order_ref1" property="orderRef1" />
  66. <result column="order_ref5" property="orderRef5" />
  67. <result column="batch_no" property="batchNo" />
  68. <result column="order_ref4" property="orderRef4" />
  69. <result column="pre_pay_amount" property="prePayAmount" />
  70. <result column="upload_by" property="uploadBy" />
  71. <result column="pur_lead_time" property="purLeadTime" />
  72. <result column="order_ref_type" property="orderRefType" />
  73. <result column="order_ref3" property="orderRef3" />
  74. <result column="need_receive_flag" property="needReceiveFlag" />
  75. <result column="upload_flag" property="uploadFlag" />
  76. <result column="id" property="id" />
  77. <result column="pre_pay_reverse_amount" property="prePayReverseAmount" />
  78. <result column="out_work_order_flag" property="outWorkOrderFlag" />
  79. <result column="order_ref2" property="orderRef2" />
  80. <result column="qty_rbjs" property="qtyRbjs" />
  81. <result column="pre_pay_pay_amount" property="prePayPayAmount" />
  82. <result column="need_date" property="needDate" />
  83. <result column="inspect_method" property="inspectMethod" />
  84. <result column="inv_notify_qty" property="invNotifyQty" />
  85. <result column="po_header_id" property="poHeaderId" />
  86. </resultMap>
  87. <!-- 通用查询结果列 -->
  88. <sql id="BaseColumnList">
  89. po_header_id, order_no, site, item_no, part_no, status, qty, umid, convert_factor, price, base_price, want_receive_date, tax_rate, tax, additional_cost, freight, duty, arrive_qty, receive_qty, qty_returned, qty_replace, qty_scrapt, invoice_qty, approve_result, need_inspect_flag, remark, iqc_qty, last_update_by, pr_convert_note, inspect_type_db, inspect_type, inspect_qty, inspect_percent, inspection_level_no, close_tolerance, over_receive_tolerance, item, c_value, c_ship_qty, c_sum_price, c_narrival, c_crd, c_inspection, c_real_crd, c_eta, c_flexid, c_obd, c_doc_sent, c_telex_release, c_advance_payment, c_advance_paid, create_time, c_planner, c_edit, c_end_planner, c_remark_delay, qty_cancelled, inspect_method_db, to_inv_nofity_qty, upload_date, order_ref1, order_ref5, batch_no, order_ref4, pre_pay_amount, upload_by, pur_lead_time, order_ref_type, order_ref3, need_receive_flag, upload_flag, id, pre_pay_reverse_amount, out_work_order_flag, order_ref2, qty_rbjs, pre_pay_pay_amount, need_date, inspect_method, inv_notify_qty
  90. </sql>
  91. <select id="getListByModel" resultType="com.xujie.modules.order.vo.PODetailVo">
  92. select <include refid="BaseColumnList"/>
  93. from PODetail
  94. where site = #{site}
  95. <if test="poHeaderId != null and poHeaderId != '' "> and po_header_id = #{poHeaderId}</if>
  96. <if test="orderNo != null and orderNo != '' "> and order_no = #{orderNo}</if>
  97. <if test="itemNo != null "> and item_no = #{itemNo}</if>
  98. <if test="partNo != null and partNo != '' "> and part_no = #{partNo}</if>
  99. <if test="status != null and status != '' "> and status = #{status}</if>
  100. <if test="qty != null and qty != '' "> and qty = #{qty}</if>
  101. <if test="umid != null and umid != '' "> and umid = #{umid}</if>
  102. <if test="convertFactor != null and convertFactor != '' "> and convert_factor = #{convertFactor}</if>
  103. <if test="price != null and price != '' "> and price = #{price}</if>
  104. <if test="basePrice != null and basePrice != '' "> and base_price = #{basePrice}</if>
  105. <if test="wantReceiveDate != null and wantReceiveDate != '' "> and want_receive_date = #{wantReceiveDate}</if>
  106. <if test="taxRate != null and taxRate != '' "> and tax_rate = #{taxRate}</if>
  107. <if test="tax != null and tax != '' "> and tax = #{tax}</if>
  108. <if test="additionalCost != null and additionalCost != '' "> and additional_cost = #{additionalCost}</if>
  109. <if test="freight != null and freight != '' "> and freight = #{freight}</if>
  110. <if test="duty != null and duty != '' "> and duty = #{duty}</if>
  111. <if test="arriveQty != null and arriveQty != '' "> and arrive_qty = #{arriveQty}</if>
  112. <if test="receiveQty != null and receiveQty != '' "> and receive_qty = #{receiveQty}</if>
  113. <if test="qtyReturned != null and qtyReturned != '' "> and qty_returned = #{qtyReturned}</if>
  114. <if test="qtyReplace != null and qtyReplace != '' "> and qty_replace = #{qtyReplace}</if>
  115. <if test="qtyScrapt != null and qtyScrapt != '' "> and qty_scrapt = #{qtyScrapt}</if>
  116. <if test="invoiceQty != null and invoiceQty != '' "> and invoice_qty = #{invoiceQty}</if>
  117. <if test="approveResult != null and approveResult != '' "> and approve_result = #{approveResult}</if>
  118. <if test="needInspectFlag != null and needInspectFlag != '' "> and need_inspect_flag = #{needInspectFlag}</if>
  119. <if test="remark != null and remark != '' "> and remark = #{remark}</if>
  120. <if test="iqcQty != null and iqcQty != '' "> and iqc_qty = #{iqcQty}</if>
  121. <if test="lastUpdateBy != null and lastUpdateBy != '' "> and last_update_by = #{lastUpdateBy}</if>
  122. <if test="prConvertNote != null and prConvertNote != '' "> and pr_convert_note = #{prConvertNote}</if>
  123. <if test="inspectTypeDb != null and inspectTypeDb != '' "> and inspect_type_db = #{inspectTypeDb}</if>
  124. <if test="inspectType != null and inspectType != '' "> and inspect_type = #{inspectType}</if>
  125. <if test="inspectQty != null and inspectQty != '' "> and inspect_qty = #{inspectQty}</if>
  126. <if test="inspectPercent != null and inspectPercent != '' "> and inspect_percent = #{inspectPercent}</if>
  127. <if test="inspectionLevelNo != null and inspectionLevelNo != '' "> and inspection_level_no = #{inspectionLevelNo}</if>
  128. <if test="closeTolerance != null and closeTolerance != '' "> and close_tolerance = #{closeTolerance}</if>
  129. <if test="overReceiveTolerance != null and overReceiveTolerance != '' "> and over_receive_tolerance = #{overReceiveTolerance}</if>
  130. <if test="item != null and item != '' "> and item = #{item}</if>
  131. <if test="value != null and value != '' "> and c_value = #{value}</if>
  132. <if test="shipQty != null "> and c_ship_qty = #{shipQty}</if>
  133. <if test="sumPrice != null and sumPrice != '' "> and c_sum_price = #{sumPrice}</if>
  134. <if test="narrival != null and narrival != '' "> and c_narrival = #{narrival}</if>
  135. <if test="crd != null and crd != '' "> and c_crd = #{crd}</if>
  136. <if test="inspection != null and inspection != '' "> and c_inspection = #{inspection}</if>
  137. <if test="realCrd != null and realCrd != '' "> and c_real_crd = #{realCrd}</if>
  138. <if test="eta != null and eta != '' "> and c_eta = #{eta}</if>
  139. <if test="flexid != null and flexid != '' "> and c_flexid = #{flexid}</if>
  140. <if test="obd != null and obd != '' "> and c_obd = #{obd}</if>
  141. <if test="docSent != null and docSent != '' "> and c_doc_sent = #{docSent}</if>
  142. <if test="telexRelease != null and telexRelease != '' "> and c_telex_release = #{telexRelease}</if>
  143. <if test="advancePayment != null and advancePayment != '' "> and c_advance_payment = #{advancePayment}</if>
  144. <if test="advancePaid != null and advancePaid != '' "> and c_advance_paid = #{advancePaid}</if>
  145. <if test="createTime != null and createTime != '' "> and create_time = #{createTime}</if>
  146. <if test="planner != null and planner != '' "> and c_planner = #{planner}</if>
  147. <if test="edit != null and edit != '' "> and c_edit = #{edit}</if>
  148. <if test="endPlanner != null and endPlanner != '' "> and c_end_planner = #{endPlanner}</if>
  149. <if test="remarkDelay != null and remarkDelay != '' "> and c_remark_delay = #{remarkDelay}</if>
  150. <if test="qtyCancelled != null and qtyCancelled != '' "> and qty_cancelled = #{qtyCancelled}</if>
  151. <if test="inspectMethodDb != null and inspectMethodDb != '' "> and inspect_method_db = #{inspectMethodDb}</if>
  152. <if test="toInvNofityQty != null and toInvNofityQty != '' "> and to_inv_nofity_qty = #{toInvNofityQty}</if>
  153. <if test="uploadDate != null and uploadDate != '' "> and upload_date = #{uploadDate}</if>
  154. <if test="orderRef1 != null and orderRef1 != '' "> and order_ref1 = #{orderRef1}</if>
  155. <if test="orderRef5 != null and orderRef5 != '' "> and order_ref5 = #{orderRef5}</if>
  156. <if test="batchNo != null and batchNo != '' "> and batch_no = #{batchNo}</if>
  157. <if test="orderRef4 != null and orderRef4 != '' "> and order_ref4 = #{orderRef4}</if>
  158. <if test="prePayAmount != null and prePayAmount != '' "> and pre_pay_amount = #{prePayAmount}</if>
  159. <if test="uploadBy != null and uploadBy != '' "> and upload_by = #{uploadBy}</if>
  160. <if test="purLeadTime != null and purLeadTime != '' "> and pur_lead_time = #{purLeadTime}</if>
  161. <if test="orderRefType != null and orderRefType != '' "> and order_ref_type = #{orderRefType}</if>
  162. <if test="orderRef3 != null and orderRef3 != '' "> and order_ref3 = #{orderRef3}</if>
  163. <if test="needReceiveFlag != null and needReceiveFlag != '' "> and need_receive_flag = #{needReceiveFlag}</if>
  164. <if test="uploadFlag != null and uploadFlag != '' "> and upload_flag = #{uploadFlag}</if>
  165. <if test="id != null "> and id = #{id}</if>
  166. <if test="prePayReverseAmount != null and prePayReverseAmount != '' "> and pre_pay_reverse_amount = #{prePayReverseAmount}</if>
  167. <if test="outWorkOrderFlag != null and outWorkOrderFlag != '' "> and out_work_order_flag = #{outWorkOrderFlag}</if>
  168. <if test="orderRef2 != null and orderRef2 != '' "> and order_ref2 = #{orderRef2}</if>
  169. <if test="qtyRbjs != null and qtyRbjs != '' "> and qty_rbjs = #{qtyRbjs}</if>
  170. <if test="prePayPayAmount != null and prePayPayAmount != '' "> and pre_pay_pay_amount = #{prePayPayAmount}</if>
  171. <if test="needDate != null and needDate != '' "> and need_date = #{needDate}</if>
  172. <if test="inspectMethod != null and inspectMethod != '' "> and inspect_method = #{inspectMethod}</if>
  173. <if test="invNotifyQty != null and invNotifyQty != '' "> and inv_notify_qty = #{invNotifyQty}</if>
  174. order by id desc
  175. </select>
  176. <select id="myPage" resultType="com.xujie.modules.order.vo.PODetailVo">
  177. select pod.po_header_id, pod.order_no, pod.site, pod.item_no, pod.part_no, pod.status, pod.qty, pod.umid, pod.convert_factor, pod.price, pod.base_price, pod.want_receive_date, pod.tax_rate, pod.tax, pod.additional_cost, pod.freight, pod.duty, pod.arrive_qty, pod.receive_qty, pod.qty_returned, pod.qty_replace, pod.qty_scrapt, pod.invoice_qty, pod.approve_result, pod.need_inspect_flag, pod.remark, pod.iqc_qty, pod.last_update_by, pod.pr_convert_note, pod.inspect_type_db, pod.inspect_type, pod.inspect_qty, pod.inspect_percent, pod.inspection_level_no, pod.close_tolerance, pod.over_receive_tolerance
  178. ,pod.inspect_method_db, pod.to_inv_nofity_qty, pod.upload_date, pod.order_ref1, pod.order_ref5, pod.batch_no, pod.order_ref4, pod.pre_pay_amount, pod.upload_by, pod.pur_lead_time, pod.order_ref_type, pod.order_ref3, pod.need_receive_flag, pod.upload_flag, pod.id, pod.pre_pay_reverse_amount, pod.out_work_order_flag, pod.order_ref2, pod.qty_rbjs, pod.pre_pay_pay_amount, pod.need_date, pod.inspect_method, pod.inv_notify_qty
  179. ,pod.item as item
  180. ,pod.c_value as value
  181. ,pod.c_ship_qty as shipQty
  182. ,pod.c_sum_price as sumPrice
  183. ,pod.c_narrival as narrival
  184. ,pod.c_crd as crd
  185. ,pod.c_inspection as inspection
  186. ,pod.c_real_crd as realCrd
  187. ,pod.c_eta as eta
  188. ,pod.c_flexid as flexid
  189. ,pod.c_obd as obd
  190. ,pod.c_doc_sent as docSent
  191. ,pod.c_telex_release as telexRelease
  192. ,pod.c_advance_payment as advancePayment
  193. ,pod.c_advance_paid as advancePaid
  194. ,pod.create_time as createTime
  195. ,pod.c_planner as planner
  196. ,pod.c_edit as edit
  197. ,pod.c_end_planner as endPlanner
  198. ,pod.c_remark_delay as remarkDelay
  199. ,pod.qty_cancelled as qtyCancelled
  200. ,poh.c_customer as customer
  201. ,poh.buyer
  202. ,poh.supplier_no
  203. ,poh.po_no
  204. ,poh.c_departure as departure
  205. ,poh.c_destination as destination
  206. ,poh.ship_via
  207. ,poh.order_date
  208. ,poh.c_enquiry as enquiry
  209. ,poh.c_confirmed as confirmed
  210. ,poh.want_receive_date
  211. ,ss.supplier_name
  212. ,ss.c_short_office as shortOffice
  213. ,ss.c_short_npc as shortNpc
  214. ,p.category
  215. ,p.sku
  216. from PODetail pod
  217. left join POHeader poh on poh.id = pod.po_header_id
  218. left join srm_supplier ss on ss.supplier_no = poh.supplier_no and ss.site = pod.site
  219. left join part p on p.part_no = pod.part_no and p.site = pod.site
  220. where pod.site = '${query.site}'
  221. <if test="query.poHeaderId != null and query.poHeaderId != '' "> and pod.po_header_id like '%${query.poHeaderId}%'</if>
  222. <if test="query.orderNo != null and query.orderNo != '' "> and pod.order_no like '%${query.orderNo}%'</if>
  223. <if test="query.poNo != null and query.poNo != '' "> and poh.po_no like '%${query.poNo}%'</if>
  224. <if test="query.customer != null and query.customer != '' "> and poh.c_customer like '%${query.customer}%'</if>
  225. <if test="query.buyer != null and query.buyer != '' "> and poh.buyer like '%${query.buyer}%'</if>
  226. <if test="query.itemNo != null "> and pod.item_no = '${query.itemNo}'</if>
  227. <if test="query.partNo != null and query.partNo != '' "> and pod.part_no like '%${query.partNo}%'</if>
  228. <if test="query.status != null and query.status != '' "> and pod.status like '%${query.status}%'</if>
  229. <if test="query.qty != null and query.qty != '' "> and pod.qty like '%${query.qty}%'</if>
  230. <if test="query.umid != null and query.umid != '' "> and pod.umid like '%${query.umid}%'</if>
  231. <if test="query.convertFactor != null and query.convertFactor != '' "> and pod.convert_factor like '%${query.convertFactor}%'</if>
  232. <if test="query.price != null and query.price != '' "> and pod.price like '%${query.price}%'</if>
  233. <if test="query.basePrice != null and query.basePrice != '' "> and pod.base_price like '%${query.basePrice}%'</if>
  234. <if test="query.wantReceiveDate != null "> and pod.want_receive_date like '%${query.wantReceiveDate}%'</if>
  235. <if test="query.taxRate != null and query.taxRate != '' "> and pod.tax_rate like '%${query.taxRate}%'</if>
  236. <if test="query.tax != null and query.tax != '' "> and pod.tax like '%${query.tax}%'</if>
  237. <if test="query.additionalCost != null and query.additionalCost != '' "> and pod.additional_cost like '%${query.additionalCost}%'</if>
  238. <if test="query.freight != null and query.freight != '' "> and pod.freight like '%${query.freight}%'</if>
  239. <if test="query.duty != null and query.duty != '' "> and pod.duty like '%${query.duty}%'</if>
  240. <if test="query.arriveQty != null and query.arriveQty != '' "> and pod.arrive_qty like '%${query.arriveQty}%'</if>
  241. <if test="query.receiveQty != null and query.receiveQty != '' "> and pod.receive_qty like '%${query.receiveQty}%'</if>
  242. <if test="query.qtyReturned != null and query.qtyReturned != '' "> and pod.qty_returned like '%${query.qtyReturned}%'</if>
  243. <if test="query.qtyReplace != null and query.qtyReplace != '' "> and pod.qty_replace like '%${query.qtyReplace}%'</if>
  244. <if test="query.qtyScrapt != null and query.qtyScrapt != '' "> and pod.qty_scrapt like '%${query.qtyScrapt}%'</if>
  245. <if test="query.invoiceQty != null and query.invoiceQty != '' "> and pod.invoice_qty like '%${query.invoiceQty}%'</if>
  246. <if test="query.approveResult != null and query.approveResult != '' "> and pod.approve_result like '%${query.approveResult}%'</if>
  247. <if test="query.needInspectFlag != null and query.needInspectFlag != '' "> and pod.need_inspect_flag like '%${query.needInspectFlag}%'</if>
  248. <if test="query.remark != null and query.remark != '' "> and pod.remark like '%${query.remark}%'</if>
  249. <if test="query.iqcQty != null and query.iqcQty != '' "> and pod.iqc_qty like '%${query.iqcQty}%'</if>
  250. <if test="query.lastUpdateBy != null and query.lastUpdateBy != '' "> and pod.last_update_by like '%${query.lastUpdateBy}%'</if>
  251. <if test="query.prConvertNote != null and query.prConvertNote != '' "> and pod.pr_convert_note like '%${query.prConvertNote}%'</if>
  252. <if test="query.inspectTypeDb != null and query.inspectTypeDb != '' "> and pod.inspect_type_db like '%${query.inspectTypeDb}%'</if>
  253. <if test="query.inspectType != null and query.inspectType != '' "> and pod.inspect_type like '%${query.inspectType}%'</if>
  254. <if test="query.inspectQty != null and query.inspectQty != '' "> and pod.inspect_qty like '%${query.inspectQty}%'</if>
  255. <if test="query.inspectPercent != null and query.inspectPercent != '' "> and pod.inspect_percent like '%${query.inspectPercent}%'</if>
  256. <if test="query.inspectionLevelNo != null and query.inspectionLevelNo != '' "> and pod.inspection_level_no like '%${query.inspectionLevelNo}%'</if>
  257. <if test="query.closeTolerance != null and query.closeTolerance != '' "> and pod.close_tolerance like '%${query.closeTolerance}%'</if>
  258. <if test="query.overReceiveTolerance != null and query.overReceiveTolerance != '' "> and pod.over_receive_tolerance like '%${query.overReceiveTolerance}%'</if>
  259. <if test="query.item != null and query.item != '' "> and pod.item like '%${query.item}%'</if>
  260. <if test="query.value != null and query.value != '' "> and pod.c_value like '%${query.value}%'</if>
  261. <if test="query.shipQty != null "> and pod.c_ship_qty = '${query.shipQty}'</if>
  262. <if test="query.sumPrice != null and query.sumPrice != '' "> and pod.c_sum_price like '%${query.sumPrice}%'</if>
  263. <if test="query.narrival != null and query.narrival != '' "> and pod.c_narrival like '%${query.narrival}%'</if>
  264. <if test="query.crd != null and query.crd != '' "> and pod.c_crd like '%${query.crd}%'</if>
  265. <if test="query.inspection != null and query.inspection != '' "> and pod.c_inspection like '%${query.inspection}%'</if>
  266. <if test="query.realCrd != null and query.realCrd != '' "> and pod.c_real_crd like '%${query.realCrd}%'</if>
  267. <if test="query.eta != null and query.eta != '' "> and pod.c_eta like '%${query.eta}%'</if>
  268. <if test="query.flexid != null and query.flexid != '' "> and pod.c_flexid like '%${query.flexid}%'</if>
  269. <if test="query.obd != null and query.obd != '' "> and pod.c_obd like '%${query.obd}%'</if>
  270. <if test="query.docSent != null and query.docSent != '' "> and pod.c_doc_sent like '%${query.docSent}%'</if>
  271. <if test="query.telexRelease != null and query.telexRelease != '' "> and pod.c_telex_release like '%${query.telexRelease}%'</if>
  272. <if test="query.advancePayment != null and query.advancePayment != '' "> and pod.c_advance_payment like '%${query.advancePayment}%'</if>
  273. <if test="query.advancePaid != null and query.advancePaid != '' "> and pod.c_advance_paid like '%${query.advancePaid}%'</if>
  274. <if test="query.createTime != null and query.createTime != '' "> and pod.create_time like '%${query.createTime}%'</if>
  275. <if test="query.planner != null and query.planner != '' "> and pod.c_planner like '%${query.planner}%'</if>
  276. <if test="query.edit != null and query.edit != '' "> and pod.c_edit like '%${query.edit}%'</if>
  277. <if test="query.endPlanner != null and query.endPlanner != '' "> and pod.c_end_planner like '%${query.endPlanner}%'</if>
  278. <if test="query.remarkDelay != null and query.remarkDelay != '' "> and pod.c_remark_delay like '%${query.remarkDelay}%'</if>
  279. <if test="query.qtyCancelled != null and query.qtyCancelled != '' "> and pod.qty_cancelled like '%${query.qtyCancelled}%'</if>
  280. <if test="query.inspectMethodDb != null and query.inspectMethodDb != '' "> and pod.inspect_method_db like '%${query.inspectMethodDb}%'</if>
  281. <if test="query.toInvNofityQty != null and query.toInvNofityQty != '' "> and pod.to_inv_nofity_qty like '%${query.toInvNofityQty}%'</if>
  282. <if test="query.uploadDate != null and query.uploadDate != '' "> and pod.upload_date like '%${query.uploadDate}%'</if>
  283. <if test="query.orderRef1 != null and query.orderRef1 != '' "> and pod.order_ref1 like '%${query.orderRef1}%'</if>
  284. <if test="query.orderRef5 != null and query.orderRef5 != '' "> and pod.order_ref5 like '%${query.orderRef5}%'</if>
  285. <if test="query.batchNo != null and query.batchNo != '' "> and pod.batch_no like '%${query.batchNo}%'</if>
  286. <if test="query.orderRef4 != null and query.orderRef4 != '' "> and pod.order_ref4 like '%${query.orderRef4}%'</if>
  287. <if test="query.prePayAmount != null and query.prePayAmount != '' "> and pod.pre_pay_amount like '%${query.prePayAmount}%'</if>
  288. <if test="query.uploadBy != null and query.uploadBy != '' "> and pod.upload_by like '%${query.uploadBy}%'</if>
  289. <if test="query.purLeadTime != null and query.purLeadTime != '' "> and pod.pur_lead_time like '%${query.purLeadTime}%'</if>
  290. <if test="query.orderRefType != null and query.orderRefType != '' "> and pod.order_ref_type like '%${query.orderRefType}%'</if>
  291. <if test="query.orderRef3 != null and query.orderRef3 != '' "> and pod.order_ref3 like '%${query.orderRef3}%'</if>
  292. <if test="query.needReceiveFlag != null and query.needReceiveFlag != '' "> and pod.need_receive_flag like '%${query.needReceiveFlag}%'</if>
  293. <if test="query.uploadFlag != null and query.uploadFlag != '' "> and pod.upload_flag like '%${query.uploadFlag}%'</if>
  294. <if test="query.id != null "> and pod.id = '${query.id}'</if>
  295. <if test="query.prePayReverseAmount != null and query.prePayReverseAmount != '' "> and pod.pre_pay_reverse_amount like '%${query.prePayReverseAmount}%'</if>
  296. <if test="query.outWorkOrderFlag != null and query.outWorkOrderFlag != '' "> and pod.out_work_order_flag like '%${query.outWorkOrderFlag}%'</if>
  297. <if test="query.orderRef2 != null and query.orderRef2 != '' "> and pod.order_ref2 like '%${query.orderRef2}%'</if>
  298. <if test="query.qtyRbjs != null and query.qtyRbjs != '' "> and pod.qty_rbjs like '%${query.qtyRbjs}%'</if>
  299. <if test="query.prePayPayAmount != null and query.prePayPayAmount != '' "> and pod.pre_pay_pay_amount like '%${query.prePayPayAmount}%'</if>
  300. <if test="query.needDate != null and query.needDate != '' "> and pod.need_date like '%${query.needDate}%'</if>
  301. <if test="query.inspectMethod != null and query.inspectMethod != '' "> and pod.inspect_method like '%${query.inspectMethod}%'</if>
  302. <if test="query.invNotifyQty != null and query.invNotifyQty != '' "> and pod.inv_notify_qty like '%${query.invNotifyQty}%'</if>
  303. <if test="query.sku != null and query.sku != '' "> and p.sku like '%${query.sku}%'</if>
  304. order by pod.id desc
  305. </select>
  306. <update id="batchUpdatePoDetail">
  307. UPDATE pd
  308. SET
  309. order_no = t.order_no,
  310. site = t.site,
  311. item_no = t.item_no,
  312. part_no = t.part_no,
  313. status = t.status,
  314. qty = t.qty,
  315. umid = t.umid,
  316. convert_factor = t.convert_factor,
  317. price = t.price,
  318. base_price = t.base_price,
  319. want_receive_date = t.want_receive_date,
  320. tax_rate = t.tax_rate,
  321. tax = t.tax,
  322. additional_cost = t.additional_cost,
  323. freight = t.freight,
  324. duty = t.duty,
  325. arrive_qty = t.arrive_qty,
  326. receive_qty = t.receive_qty,
  327. qty_returned = t.qty_returned,
  328. qty_replace = t.qty_replace,
  329. qty_scrapt = t.qty_scrapt,
  330. invoice_qty = t.invoice_qty,
  331. approve_result = t.approve_result,
  332. need_inspect_flag = t.need_inspect_flag,
  333. remark = t.remark,
  334. iqc_qty = t.iqc_qty,
  335. last_update_by = t.last_update_by,
  336. pr_convert_note = t.pr_convert_note,
  337. inspect_type_db = t.inspect_type_db,
  338. inspect_type = t.inspect_type,
  339. inspect_qty = t.inspect_qty,
  340. inspect_percent = t.inspect_percent,
  341. inspection_level_no = t.inspection_level_no,
  342. close_tolerance = t.close_tolerance,
  343. over_receive_tolerance = t.over_receive_tolerance,
  344. item = t.item,
  345. c_value = t.c_value,
  346. c_ship_qty = t.c_ship_qty,
  347. c_sum_price = t.c_sum_price,
  348. c_narrival = t.c_narrival,
  349. c_crd = t.c_crd,
  350. c_inspection = t.c_inspection,
  351. c_real_crd = t.c_real_crd,
  352. c_eta = t.c_eta,
  353. c_flexid = t.c_flexid,
  354. c_obd = t.c_obd,
  355. c_doc_sent = t.c_doc_sent,
  356. c_telex_release = t.c_telex_release,
  357. c_advance_payment = t.c_advance_payment,
  358. c_advance_paid = t.c_advance_paid,
  359. create_time = t.create_time,
  360. c_planner = t.c_planner,
  361. c_edit = t.c_edit,
  362. c_end_planner = t.c_end_planner,
  363. c_remark_delay = t.c_remark_delay,
  364. qty_cancelled = t.qty_cancelled,
  365. inspect_method_db = t.inspect_method_db,
  366. to_inv_nofity_qty = t.to_inv_nofity_qty,
  367. upload_date = t.upload_date,
  368. order_ref1 = t.order_ref1,
  369. order_ref5 = t.order_ref5,
  370. batch_no = t.batch_no,
  371. order_ref4 = t.order_ref4,
  372. pre_pay_amount = t.pre_pay_amount,
  373. upload_by = t.upload_by,
  374. pur_lead_time = t.pur_lead_time,
  375. order_ref_type = t.order_ref_type,
  376. order_ref3 = t.order_ref3,
  377. need_receive_flag = t.need_receive_flag,
  378. upload_flag = t.upload_flag,
  379. pre_pay_reverse_amount = t.pre_pay_reverse_amount,
  380. out_work_order_flag = t.out_work_order_flag,
  381. order_ref2 = t.order_ref2,
  382. qty_rbjs = t.qty_rbjs,
  383. pre_pay_pay_amount = t.pre_pay_pay_amount,
  384. need_date = t.need_date,
  385. inspect_method = t.inspect_method,
  386. inv_notify_qty = t.inv_notify_qty
  387. FROM PODetail pd
  388. INNER JOIN (
  389. <foreach collection="list" item="item" separator="UNION ALL">
  390. SELECT
  391. CAST(#{item.id} AS INT) AS id,
  392. CAST(#{item.orderNo} AS VARCHAR(15)) AS order_no,
  393. CAST(#{item.site} AS VARCHAR(4)) AS site,
  394. CAST(#{item.itemNo} AS INT) AS item_no,
  395. CAST(#{item.partNo} AS VARCHAR(30)) AS part_no,
  396. CAST(#{item.status} AS VARCHAR(10)) AS status,
  397. CAST(#{item.qty} AS DECIMAL(20,6)) AS qty,
  398. CAST(#{item.umid} AS VARCHAR(8)) AS umid,
  399. CAST(#{item.convertFactor} AS DECIMAL(20,6)) AS convert_factor,
  400. CAST(#{item.price} AS DECIMAL(20,6)) AS price,
  401. CAST(#{item.basePrice} AS DECIMAL(20,6)) AS base_price,
  402. CAST(#{item.wantReceiveDate} AS DATETIME) AS want_receive_date,
  403. CAST(#{item.taxRate} AS DECIMAL(20,6)) AS tax_rate,
  404. CAST(#{item.tax} AS DECIMAL(20,6)) AS tax,
  405. CAST(#{item.additionalCost} AS DECIMAL(20,6)) AS additional_cost,
  406. CAST(#{item.freight} AS DECIMAL(20,6)) AS freight,
  407. CAST(#{item.duty} AS DECIMAL(20,6)) AS duty,
  408. CAST(#{item.arriveQty} AS DECIMAL(20,6)) AS arrive_qty,
  409. CAST(#{item.receiveQty} AS DECIMAL(20,6)) AS receive_qty,
  410. CAST(#{item.qtyReturned} AS DECIMAL(20,6)) AS qty_returned,
  411. CAST(#{item.qtyReplace} AS DECIMAL(20,6)) AS qty_replace,
  412. CAST(#{item.qtyScrapt} AS DECIMAL(20,6)) AS qty_scrapt,
  413. CAST(#{item.invoiceQty} AS DECIMAL(20,6)) AS invoice_qty,
  414. CAST(#{item.approveResult} AS CHAR(1)) AS approve_result,
  415. CAST(#{item.needInspectFlag} AS CHAR(1)) AS need_inspect_flag,
  416. CAST(#{item.remark} AS VARCHAR(400)) AS remark,
  417. CAST(#{item.iqcQty} AS DECIMAL(20,6)) AS iqc_qty,
  418. CAST(#{item.lastUpdateBy} AS VARCHAR(20)) AS last_update_by,
  419. CAST(#{item.prConvertNote} AS VARCHAR(200)) AS pr_convert_note,
  420. CAST(#{item.inspectTypeDb} AS CHAR(1)) AS inspect_type_db,
  421. CAST(#{item.inspectType} AS VARCHAR(40)) AS inspect_type,
  422. CAST(#{item.inspectQty} AS DECIMAL(20,6)) AS inspect_qty,
  423. CAST(#{item.inspectPercent} AS DECIMAL(20,6)) AS inspect_percent,
  424. CAST(#{item.inspectionLevelNo} AS VARCHAR(20)) AS inspection_level_no,
  425. CAST(#{item.closeTolerance} AS DECIMAL(20,6)) AS close_tolerance,
  426. CAST(#{item.overReceiveTolerance} AS DECIMAL(20,6)) AS over_receive_tolerance,
  427. CAST(#{item.item} AS VARCHAR(64)) AS item,
  428. CAST(#{item.value} AS VARCHAR(50)) AS c_value,
  429. CAST(#{item.shipQty} AS INT) AS c_ship_qty,
  430. CAST(#{item.sumPrice} AS DECIMAL(20,6)) AS c_sum_price,
  431. CAST(#{item.narrival} AS DATETIME) AS c_narrival,
  432. CAST(#{item.crd} AS DATETIME) AS c_crd,
  433. CAST(#{item.inspection} AS DATETIME) AS c_inspection,
  434. CAST(#{item.realCrd} AS DATETIME) AS c_real_crd,
  435. CAST(#{item.eta} AS DATETIME) AS c_eta,
  436. CAST(#{item.flexid} AS VARCHAR(50)) AS c_flexid,
  437. CAST(#{item.obd} AS DATETIME) AS c_obd,
  438. CAST(#{item.docSent} AS CHAR(1)) AS c_doc_sent,
  439. CAST(#{item.telexRelease} AS CHAR(1)) AS c_telex_release,
  440. CAST(#{item.advancePayment} AS CHAR(1)) AS c_advance_payment,
  441. CAST(#{item.advancePaid} AS CHAR(1)) AS c_advance_paid,
  442. CAST(#{item.createTime} AS DATETIME) AS create_time,
  443. CAST(#{item.planner} AS VARCHAR(50)) AS c_planner,
  444. CAST(#{item.edit} AS DATETIME) AS c_edit,
  445. CAST(#{item.endPlanner} AS VARCHAR(50)) AS c_end_planner,
  446. CAST(#{item.remarkDelay} AS VARCHAR(255)) AS c_remark_delay,
  447. CAST(#{item.qtyCancelled} AS DECIMAL(20,6)) AS qty_cancelled,
  448. CAST(#{item.inspectMethodDb} AS CHAR(1)) AS inspect_method_db,
  449. CAST(#{item.toInvNofityQty} AS DECIMAL(20,6)) AS to_inv_nofity_qty,
  450. CAST(#{item.uploadDate} AS DATETIME) AS upload_date,
  451. CAST(#{item.orderRef1} AS VARCHAR(20)) AS order_ref1,
  452. CAST(#{item.orderRef5} AS VARCHAR(20)) AS order_ref5,
  453. CAST(#{item.batchNo} AS VARCHAR(18)) AS batch_no,
  454. CAST(#{item.orderRef4} AS VARCHAR(20)) AS order_ref4,
  455. CAST(#{item.prePayAmount} AS DECIMAL(20,6)) AS pre_pay_amount,
  456. CAST(#{item.uploadBy} AS VARCHAR(50)) AS upload_by,
  457. CAST(#{item.purLeadTime} AS DECIMAL(20,6)) AS pur_lead_time,
  458. CAST(#{item.orderRefType} AS VARCHAR(20)) AS order_ref_type,
  459. CAST(#{item.orderRef3} AS VARCHAR(20)) AS order_ref3,
  460. CAST(#{item.needReceiveFlag} AS CHAR(1)) AS need_receive_flag,
  461. CAST(#{item.uploadFlag} AS CHAR(1)) AS upload_flag,
  462. CAST(#{item.prePayReverseAmount} AS DECIMAL(20,6)) AS pre_pay_reverse_amount,
  463. CAST(#{item.outWorkOrderFlag} AS CHAR(1)) AS out_work_order_flag,
  464. CAST(#{item.orderRef2} AS VARCHAR(20)) AS order_ref2,
  465. CAST(#{item.qtyRbjs} AS DECIMAL(20,6)) AS qty_rbjs,
  466. CAST(#{item.prePayPayAmount} AS DECIMAL(20,6)) AS pre_pay_pay_amount,
  467. CAST(#{item.needDate} AS DATETIME) AS need_date,
  468. CAST(#{item.inspectMethod} AS VARCHAR(20)) AS inspect_method,
  469. CAST(#{item.invNotifyQty} AS DECIMAL(20,6)) AS inv_notify_qty
  470. </foreach>
  471. ) t ON pd.id = t.id
  472. </update>
  473. <select id="selectByPK" resultType="com.xujie.modules.order.entity.PODetail">
  474. SELECT TOP 1 *
  475. FROM PODetail
  476. WHERE order_no = #{orderNo}
  477. AND site = #{site}
  478. AND item_no = #{itemNo}
  479. </select>
  480. <select id="getMaxItemNo" resultType="int">
  481. SELECT MAX(item_no)
  482. FROM PODetail
  483. WHERE order_no = #{poNo}
  484. AND site = #{site}
  485. </select>
  486. <select id="countByOrderAndItem" resultType="java.lang.Integer">
  487. SELECT COUNT(1)
  488. FROM PODetail
  489. WHERE order_no = #{orderNo}
  490. AND site = #{site}
  491. </select>
  492. </mapper>