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.

1259 lines
63 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
7 months ago
11 months ago
11 months ago
11 months ago
11 months ago
4 months ago
11 months ago
11 months ago
7 months ago
11 months ago
11 months ago
7 months ago
11 months ago
11 months ago
5 months ago
11 months ago
11 months ago
11 months ago
11 months ago
5 months ago
3 months ago
3 months ago
11 months ago
5 months ago
11 months ago
11 months ago
11 months ago
3 months ago
11 months ago
5 months ago
11 months ago
11 months ago
11 months ago
3 months ago
11 months ago
3 months ago
11 months ago
11 months ago
9 months ago
11 months ago
3 months ago
11 months ago
11 months ago
11 months ago
3 months ago
11 months ago
11 months ago
4 months ago
3 months ago
3 months ago
11 months ago
11 months ago
11 months ago
11 months ago
9 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
8 months ago
11 months ago
11 months ago
11 months ago
11 months ago
8 months ago
11 months ago
8 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
3 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
5 months ago
11 months ago
11 months ago
11 months ago
5 months ago
11 months ago
11 months ago
5 months ago
11 months ago
11 months ago
9 months ago
4 months ago
11 months ago
11 months ago
11 months ago
11 months ago
7 months ago
11 months ago
11 months ago
11 months ago
11 months ago
3 months ago
3 months ago
3 months ago
7 months ago
5 months ago
5 months ago
11 months ago
7 months ago
11 months ago
7 months ago
11 months ago
11 months ago
3 months ago
11 months ago
11 months ago
7 months ago
11 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
5 months ago
3 months ago
5 months ago
5 months ago
8 months ago
8 months ago
9 months ago
9 months ago
5 months ago
3 months ago
5 months ago
4 months ago
4 months ago
4 months ago
3 months ago
5 months ago
8 months ago
7 months ago
3 months ago
9 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
4 months 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.xujie.sys.modules.ecss.mapper.CoDelMapper">
  4. <select id="searchEcssCoDelNotifyHeader" resultType="EcssCoDelNotifyHeaderData">
  5. select a.site,a.bu_no,a.delNo,a.erp_delNo,a.ready_date,a.notifyDate,a.customer_name,a.Destination,a.shipping_mode,a.erp_flag,
  6. a.notify_status,a.remark,a.createDate,a.createBy,a.cmc_invoice,a.updateDate,a.updateBy,dbo.get_bu_desc(a.site,a.bu_no) as buDesc,
  7. a.modifyFlag,a.overseasShipper,a.overseasAddress,a.cnative,a.localShipAddress,a.walMartOrderFlag
  8. from ecss_CoDelNotifyHeader a
  9. left join accessBu D on A.site=D.site and A.bu_no=d.bu_no and D.username=#{query.username}
  10. <where>
  11. and D.site is not null
  12. <if test="query.buNo != null and query.buNo != ''">
  13. AND a.bu_no = #{query.buNo}
  14. </if>
  15. <if test="query.delNo != null and query.delNo != ''">
  16. AND a.delNo like #{query.delNo}
  17. </if>
  18. <if test="query.cmcInvoice != null and query.cmcInvoice != ''">
  19. AND a.cmc_invoice like #{query.cmcInvoice}
  20. </if>
  21. <if test="query.notifyStatus != null and query.notifyStatus != ''">
  22. AND a.notify_status = #{query.notifyStatus}
  23. </if>
  24. <if test = "query.startDate!= null">
  25. AND a.ready_date>= #{query.startDate}
  26. </if>
  27. <if test = "query.endDate!= null">
  28. AND #{query.endDate} >=a.ready_date
  29. </if>
  30. <if test="query.modifyData == 'true'">
  31. and a.modifyFlag=1
  32. </if>
  33. </where>
  34. order by a.createDate desc ,a.delNo desc
  35. </select>
  36. <select id="searchEcssCoDelNotifyHeaderForCK" resultType="EcssCoDelNotifyHeaderData">
  37. select a.site,a.bu_no,a.delNo,a.erp_delNo,a.ready_date,a.notifyDate,a.customer_name,a.Destination,a.shipping_mode,a.erp_flag,
  38. a.notify_status,a.remark,a.createDate,a.createBy,a.cmc_invoice,a.updateDate,a.updateBy,dbo.get_bu_desc(a.site,a.bu_no) as buDesc,a.walMartOrderFlag,
  39. a.modifyFlag,ISNULL(a.export_flag,'N') as exportFlag
  40. from ecss_CoDelNotifyHeader a
  41. left join accessBu D on A.site=D.site and A.bu_no=d.bu_no and D.username=#{query.username}
  42. <where>
  43. and D.site is not null
  44. <if test="query.buNo != null and query.buNo != ''">
  45. AND a.bu_no = #{query.buNo}
  46. </if>
  47. <if test="query.delNo != null and query.delNo != ''">
  48. AND a.delNo like #{query.delNo}
  49. </if>
  50. <if test="query.cmcInvoice != null and query.cmcInvoice != ''">
  51. AND a.cmc_invoice like #{query.cmcInvoice}
  52. </if>
  53. <if test="query.notifyStatus != null and query.notifyStatus != ''">
  54. AND a.notify_status = #{query.notifyStatus}
  55. </if>
  56. AND a.notify_status != '已计划'
  57. <if test = "query.startDate!= null">
  58. AND a.ready_date>= #{query.startDate}
  59. </if>
  60. <if test = "query.endDate!= null">
  61. AND #{query.endDate} >=a.ready_date
  62. </if>
  63. <if test="query.modifyData == 'true'">
  64. and a.modifyFlag=1
  65. </if>
  66. <if test="query.exportFlag != null and query.exportFlag != ''">
  67. and ISNULL(a.export_flag,'N') = #{query.exportFlag}
  68. </if>
  69. </where>
  70. order by a.createDate desc ,a.delNo desc
  71. </select>
  72. <select id="searchEcssCoDelNotifyHeaderForDanZheng" resultType="EcssCoDelNotifyHeaderData">
  73. select a.site,a.bu_no,a.delNo,a.erp_delNo,a.ready_date,a.notifyDate,a.customer_name,a.Destination,a.shipping_mode,a.erp_flag,
  74. a.notify_status,a.remark,a.createDate,a.createBy,a.cmc_invoice,a.updateDate,a.updateBy,dbo.get_bu_desc(a.site,a.bu_no) as buDesc
  75. from ecss_CoDelNotifyHeader a
  76. left join accessBu D on A.site=D.site and A.bu_no=d.bu_no and D.username=#{query.username}
  77. <where>
  78. and D.site is not null
  79. <if test="query.buNo != null and query.buNo != ''">
  80. AND a.bu_no = #{query.buNo}
  81. </if>
  82. <if test="query.delNo != null and query.delNo != ''">
  83. AND a.delNo like #{query.delNo}
  84. </if>
  85. <if test="query.cmcInvoice != null and query.cmcInvoice != ''">
  86. AND a.cmc_invoice like #{query.cmcInvoice}
  87. </if>
  88. <if test="query.notifyStatus != null and query.notifyStatus != ''">
  89. AND a.notify_status = #{query.notifyStatus}
  90. </if>
  91. AND a.notify_status = '仓库已确认'
  92. <if test = "query.startDate!= null">
  93. AND a.ready_date>= #{query.startDate}
  94. </if>
  95. <if test = "query.endDate!= null">
  96. AND #{query.endDate} >=a.ready_date
  97. </if>
  98. </where>
  99. order by a.createDate desc ,a.delNo desc
  100. </select>
  101. <select id="checkEcssCoDelNotifyHeaderByDelNo" resultType="EcssCoDelNotifyHeaderData">
  102. select a.site,a.bu_no,a.delNo,a.erp_delNo,a.ready_date,a.notifyDate,a.customer_name,a.Destination,a.shipping_mode,a.erp_flag,
  103. a.notify_status,a.remark,a.createDate,a.createBy,a.cmc_invoice,a.updateDate,a.updateBy,dbo.get_bu_desc(a.site,a.bu_no) as buDesc
  104. ,a.overseasShipper,a.overseasAddress,a.cnative,a.localShipAddress,a.salesArea
  105. from ecss_CoDelNotifyHeader a
  106. where a.site = #{site}
  107. AND a.delNo = #{delNo}
  108. </select>
  109. <select id="searchEcssCoDelNotifyDetail" resultType="EcssCoDelNotifyDetailData">
  110. select a.site,a.bu_no,a.delNo,a.item_no,a.salesOrder,a.salesOrder_item_no,a.customerPO,a.line,a.version,a.status,a.family,
  111. a.part_no,a.part_description,a.qty,a.lt,a.cmc_comment,a.saleType,a.awb_bl,a.shipping_number,a.forwarder_info,isnull(a.surplus_qty,0) surplusQty,
  112. a.currency,a.tp,a.ttl_amount,a.sum_price,a.so,a.upc,a.remark,a.erp_delItemNo,a.pn,CONVERT(DECIMAL(20, 0),a.nocartons) as nocartons,
  113. c.num_value as boxrolls,d.num_value as rollqty,w.num_value as boxweight,#{cmcInvoice} as cmcInvoice,a.modifyFlag,a.modifyQtyFlag,
  114. b.hsCodeDesc,a.vat,a.roll,a.carton,b.packageNo
  115. from ecss_CoDelNotifydetail a
  116. left join part b on a.site=b.site and a.part_no=b.part_no
  117. left join part_sub_properties_value c on a.part_no=c.part_no and c.site=a.site and c.bu_no=a.bu_no
  118. and c.record_type='ECSSPART' and c.code_no='BG001' and c.properties_item_no='BOXROLLS'
  119. left join part_sub_properties_value d on a.part_no=d.part_no and d.site=a.site and d.bu_no=a.bu_no
  120. and d.record_type='ECSSPART' and d.code_no='BG001' and d.properties_item_no='ROLLQTY'
  121. left join part_sub_properties_value w on a.part_no=w.part_no and w.site=a.site and w.bu_no=a.bu_no
  122. and w.record_type='ECSSPART' and w.code_no='BG001' and w.properties_item_no='BOXWEIGHT'
  123. <where>
  124. And a.site = #{site}
  125. AND a.delNo = #{delNo}
  126. </where>
  127. order by a.item_no
  128. </select>
  129. <select id="getEcssCoDelNotifyDetail" resultType="EcssCoDelNotifyDetailData">
  130. select a.site,a.bu_no,a.delNo,a.item_no,a.salesOrder,a.salesOrder_item_no,a.customerPO,a.line,a.version,a.status,a.family,
  131. a.part_no,a.part_description,a.qty,a.lt,a.cmc_comment,a.saleType,a.awb_bl,a.shipping_number,a.forwarder_info,
  132. a.currency,a.tp,a.ttl_amount,a.sum_price,a.so,a.upc,a.remark,a.erp_delItemNo,a.pn,CONVERT(DECIMAL(20, 0),a.nocartons) as nocartons,
  133. a.modifyFlag,a.modifyQtyFlag
  134. from ecss_CoDelNotifydetail a
  135. <where>
  136. And a.site = #{site}
  137. AND a.delNo = #{delNo}
  138. AND a.item_no = #{itemNo} and a.qty>0
  139. </where>
  140. </select>
  141. <select id="getSiteByBu" resultType="String">
  142. select top 1 site from BU where bu_no=#{buNo}
  143. </select>
  144. <select id="checkIfHasHeader" resultType="EcssCoDelNotifyHeaderData">
  145. select top 1 * from ecss_CoDelNotifyHeader where cmc_invoice=#{inVoice}
  146. </select>
  147. <update id="updateTransNo" >
  148. EXEC UpdateTransNo #{site}, #{transType}
  149. </update>
  150. <select id="getTransNo" resultType="String">
  151. SELECT
  152. dbo.Get_TransNo(#{site},#{transType}) as transNo
  153. </select>
  154. <insert id="saveEcssCoDelNotifyHeader" >
  155. insert into ecss_CoDelNotifyHeader(site,bu_no,delNo,ready_date,customer_name,Destination,shipping_mode,erp_flag,notify_status,
  156. remark,createDate,createBy,cmc_invoice,overseasShipper,overseasAddress,cnative,localShipAddress,salesArea)
  157. values(#{site},#{buNo},#{delNo},#{readyDate},#{customerName,jdbcType=NVARCHAR},#{destination,jdbcType=NVARCHAR},#{shippingMode},'N',#{notifyStatus},#{remark,jdbcType=NVARCHAR},GetDate(),
  158. #{createBy},#{cmcInvoice},#{overseasShipper,jdbcType=NVARCHAR},#{overseasAddress,jdbcType=NVARCHAR},#{cnative,jdbcType=NVARCHAR},#{localShipAddress,jdbcType=NVARCHAR}, #{salesArea,jdbcType=NVARCHAR})
  159. </insert>
  160. <insert id="batchSaveEcssCoDelNotifyDetail">
  161. insert into ecss_CoDelNotifyDetail (site,bu_no,delNo,item_no,salesOrder,salesOrder_item_no,customerPO,line,version,
  162. status,family,part_no,part_description,qty,lt,cmc_comment,saleType,
  163. awb_bl,shipping_number,forwarder_info,currency,tp,ttl_amount,sum_price,
  164. so,upc,remark,pn,surplus_qty,vat,roll,carton,saleslt,manufacturer_name,modifyFlag,modifyQtyFlag)
  165. values
  166. <foreach collection="list" separator="," item="item">
  167. (#{item.site},#{item.buNo},#{item.delNo},#{item.itemNo,jdbcType=INTEGER},#{item.salesOrder,jdbcType=NVARCHAR},#{item.salesOrderItemNo},#{item.customerPO,jdbcType=NVARCHAR},#{item.line,jdbcType=NVARCHAR},#{item.version,jdbcType=NVARCHAR},
  168. #{item.status,jdbcType=NVARCHAR},#{item.family,jdbcType=NVARCHAR},#{item.partNo},#{item.partDescription,jdbcType=NVARCHAR},#{item.qty,jdbcType=DECIMAL},#{item.lt,jdbcType=DECIMAL},#{item.cmcComment,jdbcType=NVARCHAR},#{item.saleType,jdbcType=NVARCHAR},
  169. #{item.awbBl,jdbcType=NVARCHAR},#{item.shippingNumber,jdbcType=NVARCHAR},#{item.forwarderInfo,jdbcType=NVARCHAR},#{item.currency,jdbcType=NVARCHAR},#{item.tp,jdbcType=DECIMAL},#{item.ttlAmount,jdbcType=DECIMAL},#{item.sumPrice,jdbcType=DECIMAL},
  170. #{item.so,jdbcType=NVARCHAR},#{item.upc,jdbcType=NVARCHAR},#{item.remark,jdbcType=NVARCHAR},#{item.pn,jdbcType=NVARCHAR},#{item.qty},#{item.vat},#{item.roll},#{item.carton},#{item.saleslt,jdbcType=NVARCHAR},#{item.manufacturerName,jdbcType=NVARCHAR},#{item.modifyFlag},#{item.modifyQtyFlag})
  171. </foreach>
  172. </insert>
  173. <select id="checkPart" resultType="PartData">
  174. select site,part_no from Part where site=#{site,jdbcType=VARCHAR} and part_no=#{partNo}
  175. </select>
  176. <select id="getPartNo" resultType="PartData">
  177. select top 1 site,part_no from Part where site=#{site,jdbcType=VARCHAR} and sku=#{partNo} and sourceBu=#{buNo} and
  178. site in (select site from eam_access_site where username = #{userName})
  179. and (site + '-' + sourceBu) in (select * from dbo.query_bu(#{userName}))
  180. </select>
  181. <select id="getPartInfo" resultType="PartData">
  182. select * from Part where site=#{site,jdbcType=VARCHAR} and part_no=#{partNo}
  183. </select>
  184. <update id="updateEcssDelHeader" >
  185. update ecss_CoDelNotifyHeader set ready_date=#{readyDate,jdbcType=TIMESTAMP} ,customer_name=#{customerName,jdbcType=NVARCHAR},
  186. Destination=#{destination,jdbcType=NVARCHAR},shipping_mode=#{shippingMode},modifyFlag=#{modifyFlag},export_flag='N',
  187. remark=#{remark,jdbcType=NVARCHAR} ,cmc_invoice=#{cmcInvoice},overseasShipper=#{overseasShipper,jdbcType=NVARCHAR} ,overseasAddress=#{overseasAddress,jdbcType=NVARCHAR}
  188. where site=#{site} and delNo=#{delNo}
  189. </update>
  190. <delete id="deleteEcssDelHeader">
  191. delete from ecss_CoDelNotifyHeader where site=#{site} and delNo=#{delNo}
  192. </delete>
  193. <update id="updateEcssDelHeaderForBaoGuan" >
  194. update ecss_CoDelNotifyHeader set declaration_no=#{declarationNo} ,notify_status=#{status} where site=#{site} and delNo=#{delNo}
  195. </update>
  196. <update id="updateEcssDelHeaderForModify" >
  197. update ecss_CoDelNotifyHeader set modifyFlag=#{modifyFlag} where site=#{site} and delNo=#{delNo}
  198. </update>
  199. <update id="updateEcssDelDetailForModify" >
  200. update ecss_CoDelNotifyDetail set modifyFlag=#{modifyFlag},modifyQtyFlag=#{modifyFlag},surplus_qty=0 where site=#{site} and delNo=#{delNo}
  201. </update>
  202. <update id="changeEcssDelStatus">
  203. update ecss_CoDelNotifyHeader set notify_status=#{notifyStatus},walMartOrderFlag=#{walMartOrderFlag} where site=#{site} and delNo=#{delNo}
  204. </update>
  205. <update id="updateEcssDelDetailStatus">
  206. update ecss_CoDelNotifyDetail
  207. set status=#{notifyStatus}
  208. where site=#{site} and delNo=#{delNo}
  209. </update>
  210. <update id="recoverEcssDelDetailStatus">
  211. update ecss_CoDelNotifyDetail
  212. set status='正常'
  213. where site=#{site} and delNo=#{delNo}
  214. </update>
  215. <select id="getEcssDelDetailItemNo" resultType="int">
  216. select isnull(max(item_no),0)+1 as itemNo from ecss_CoDelNotifyDetail
  217. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  218. </select>
  219. <insert id="insertEcssDelDetail" >
  220. insert into ecss_CoDelNotifyDetail(site,bu_no,delNo,item_no,salesOrder,salesOrder_item_no,customerPO,line,version,
  221. status,family,part_no,part_description,qty,lt,cmc_comment,saleType,
  222. awb_bl,shipping_number,forwarder_info,currency,tp,ttl_amount,sum_price,
  223. so,upc,remark,pn,modifyFlag,modifyQtyFlag,surplus_qty,vat,roll,carton)
  224. values(#{site},#{buNo},#{delNo},#{itemNo,jdbcType=INTEGER},#{salesOrder},#{salesOrderItemNo},#{customerPO},#{line},#{version},
  225. #{status},#{family},#{partNo},#{partDescription},#{qty,jdbcType=DECIMAL},#{lt,jdbcType=DECIMAL},#{cmcComment},#{saleType},
  226. #{awbBl},#{shippingNumber},#{forwarderInfo},#{currency},#{tp,jdbcType=DECIMAL},#{ttlAmount,jdbcType=DECIMAL},#{sumPrice,jdbcType=DECIMAL},
  227. #{so},#{upc},#{remark},#{pn},#{modifyFlag},#{modifyQtyFlag},#{qty},#{vat},#{roll},#{carton})
  228. </insert>
  229. <update id="updateEcssDelDetail">
  230. update ecss_CoDelNotifyDetail
  231. set salesOrder=#{salesOrder},customerPO=#{customerPO},line=#{line},version=#{version},
  232. status=#{status},family=#{family},part_no=#{partNo},part_description=#{partDescription},qty=#{qty,jdbcType=DECIMAL},
  233. lt=#{lt,jdbcType=DECIMAL},cmc_comment=#{cmcComment},saleType=#{saleType},pn=#{pn},
  234. awb_bl=#{awbBl},shipping_number=#{shippingNumber},forwarder_info=#{forwarderInfo},currency=#{currency},
  235. tp=#{tp,jdbcType=DECIMAL},ttl_amount=#{ttlAmount,jdbcType=DECIMAL},sum_price=#{sumPrice,jdbcType=DECIMAL},
  236. so=#{so},upc=#{upc},remark=#{remark},modifyFlag=#{modifyFlag},modifyQtyFlag=#{modifyQtyFlag},surplus_qty=#{qty,jdbcType=DECIMAL},vat=#{vat},roll=#{roll},carton=#{carton}
  237. where
  238. site=#{site} and delNo=#{delNo} and item_no=#{itemNo}
  239. </update>
  240. <delete id="deleteEcssDelDetail">
  241. delete from ecss_CoDelNotifyDetail where site=#{site} and delNo=#{delNo} and item_no=#{itemNo}
  242. </delete>
  243. <delete id="deleteAllEcssDelDetail">
  244. delete from ecss_CoDelNotifyDetail where site=#{site} and delNo=#{delNo}
  245. </delete>
  246. <update id="confirmEcssDel">
  247. update ecss_CoDelNotifyHeader set notify_status=#{notifyStatus} ,notifyDate=#{notifyDate,jdbcType=TIMESTAMP} where site=#{site} and delNo=#{delNo}
  248. </update>
  249. <update id="updateEcssDel">
  250. update ecss_CoDelNotifyHeader set ready_date=#{readyDate,jdbcType=TIMESTAMP},notifyDate=#{notifyDate,jdbcType=TIMESTAMP},
  251. modifyFlag=1,export_flag='N',updateBy=#{updateBy},updateDate=GetDate()
  252. where site=#{site} and delNo=#{delNo}
  253. </update>
  254. <select id="searchHsCodeData" resultType="EcssHsCodeData">
  255. select a.Site,a.BuNo,a.HsCode,a.Remark,a.CreateBy,a.CreateDate,a.UpdateBy,a.UpdateDate,a.codeNo
  256. ,dbo.get_bu_desc(a.site,a.BuNo) as BuDesc,a.hsCodeDesc,a.hsCodeDescEn,a.unit
  257. from ecss_hsCode a
  258. left join accessBu D on A.site=D.site and A.BuNo=d.bu_no and D.username=#{query.username}
  259. <where>
  260. and D.site is not null
  261. <if test="query.buNo != null and query.buNo != ''">
  262. AND a.BuNo = #{query.buNo}
  263. </if>
  264. <if test="query.hsCode != null and query.hsCode != ''">
  265. AND a.HsCode like #{query.hsCode}
  266. </if>
  267. </where>
  268. order by a.CreateDate ,a.HsCode
  269. </select>
  270. <select id="checkHsCodeDescData" resultType="EcssHsCodeData">
  271. select a.Site,a.BuNo,a.HsCode,a.hsCodeDesc
  272. from ecss_hsCode a where a.site=#{site} and a.buNo=#{buNo} and a.HsCodeDesc=#{hsCodeDesc}
  273. </select>
  274. <select id="checkPropertiesModel" resultType="com.xujie.sys.modules.attrbute.entity.PropertyModelHeader">
  275. select site,bu_no,function_type ,code_no from plm_properties_model_header
  276. where site=#{site} and bu_no=#{buNo} and function_type=#{functionType} and code_no=#{codeNo}
  277. </select>
  278. <insert id="insertHsCodeData" >
  279. insert into ecss_hsCode (Site,BuNo,HsCode,Remark,CreateBy,CreateDate,codeNo,hsCodeDesc,hsCodeDescEn,unit)
  280. values(#{site},#{buNo},#{hsCode},#{remark},#{createBy},GetDate(),#{codeNo},#{hsCodeDesc},#{hsCodeDescEn},#{unit})
  281. </insert>
  282. <update id="updateHsCodeData">
  283. update ecss_hsCode set Remark=#{remark} ,codeNo=#{codeNo},HsCode=#{hsCode},unit=#{unit} ,UpdateDate=GetDate(),UpdateBy=#{updateBy},hsCodeDescEn=#{hsCodeDescEn}
  284. where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc}
  285. </update>
  286. <select id="deleteHsCode" >
  287. delete from ecss_hsCode where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc}
  288. </select>
  289. <select id="searchPropertiesItemList" resultType="com.xujie.sys.modules.attrbute.entity.PropertyItem">
  290. select
  291. id,site,bu_no,item_no,item_type,item_desc,default_value,value_type,value_type_db,value_choose_flag,min_value,max_value,
  292. create_by,create_date,update_by,update_date
  293. from dbo.plm_properties_item
  294. <where>
  295. and site = #{site} and bu_no=#{buNo}
  296. <if test="itemNo != null and itemNo != ''">
  297. and item_no like #{itemNo}
  298. </if>
  299. <if test="itemDesc != null and itemDesc != ''">
  300. and item_desc like #{itemDesc}
  301. </if>
  302. <if test="itemType != null and itemType != ''">
  303. and item_type = #{itemType}
  304. </if>
  305. order by item_type ,item_no
  306. </where>
  307. </select>
  308. <select id="getPropertiesListByPartAndCodeNo" resultType="com.xujie.sys.modules.part.entity.PartSubPropertiesValueData">
  309. SELECT a.part_no
  310. , a.Site
  311. , a.code_no
  312. , a.sub_code_seq_no
  313. , a.sub_code_desc
  314. ,a.bu_no
  315. ,a.item_no
  316. , a.properties_item_no
  317. , a.text_value
  318. , a.num_value
  319. , a.record_type
  320. , b.item_desc ItemDesc
  321. , b.value_type
  322. , b.value_type_db
  323. , b.value_choose_flag
  324. FROM part_sub_properties_value a
  325. left join plm_properties_item b
  326. on a.properties_item_no = b.Item_No and a.site = b.site and a.record_type = b.Item_Type and a.bu_no=b.bu_no
  327. <where>
  328. AND a.site = #{site}
  329. and a.record_type = #{recordType}
  330. and a.bu_no=#{buNo}
  331. and a.code_no = #{codeNo}
  332. AND a.part_no = #{partNo,jdbcType=VARCHAR}
  333. </where>
  334. order by a.item_no
  335. </select>
  336. <update id="updatePropertiesList">
  337. update part_sub_properties_value
  338. set text_value=#{textValue},
  339. num_value=#{numValue,jdbcType=DOUBLE}
  340. where Site = #{site}
  341. and code_no = #{codeNo}
  342. and part_no = #{partNo}
  343. and sub_code_seq_no = #{subCodeSeqNo}
  344. and item_no = #{itemNo}
  345. and bu_no=#{buNo}
  346. </update>
  347. <insert id="saveSubPropertiesValueForAlone">
  348. insert into part_sub_properties_value ( part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc,
  349. item_no, properties_item_no, text_value, num_value, record_type)
  350. select
  351. #{partNo},
  352. #{site},
  353. #{buNo},
  354. #{codeNo},
  355. 1,
  356. d.code_desc,
  357. #{itemNo,jdbcType=DOUBLE},
  358. c.item_no,
  359. case when c.value_type_db = 'T' then c.default_value else null end,
  360. case when c.value_type_db = 'N' and c.default_value != '' then c.default_value else null end,
  361. #{recordType}
  362. from plm_properties_item c
  363. left join plm_properties_model_header d on c.site=d.site and d.code_no=#{codeNo}
  364. where c.Item_No = #{propertiesItemNo}
  365. and c.site = #{site}
  366. and c.bu_no=#{buNo}
  367. and c.item_Type = #{recordType}
  368. </insert>
  369. <delete id="deleteSubPropertiesValueForAlone">
  370. delete
  371. from part_sub_properties_value
  372. where site = #{site}
  373. and record_type = #{recordType}
  374. and bu_no=#{buNo}
  375. and code_no = #{codeNo}
  376. AND part_no = #{partNo,jdbcType=VARCHAR}
  377. and properties_item_no = #{propertiesItemNo}
  378. </delete>
  379. <select id="getNewSeqNoForAlone" resultType="Double">
  380. select isnull(Max(item_No) + 1, 1)
  381. from part_sub_properties_value a
  382. where a.site = #{site}
  383. and a.record_type = #{recordType}
  384. and a.bu_no=#{buNo}
  385. and a.code_no = #{codeNo}
  386. AND a.part_no = #{partNo,jdbcType=VARCHAR}
  387. </select>
  388. <select id="searchPropertiesUnChoose" resultType="com.xujie.sys.modules.ecss.entity.PropertyItemData">
  389. SELECT
  390. b.id,b.site,b.bu_no,b.item_no,b.item_type as functionType,b.item_desc,b.default_value,b.value_type,b.value_type_db,b.value_choose_flag,
  391. b.min_value,b.max_value,b.create_by,b.create_date,b.update_by,b.update_date
  392. FROM plm_properties_item b
  393. where b.item_type = #{codeType}
  394. and b.site = #{site} and b.bu_no=#{buNo}
  395. <if test="list != null and list.size() != 0">
  396. and b.item_no not in (
  397. <foreach collection="list" item="item" separator=",">
  398. #{item}
  399. </foreach>
  400. )
  401. </if>
  402. </select>
  403. <insert id="saveCodelPalletHeader">
  404. insert into ecss_CoDelPalletHeader (site,bu_no,delNo,seq_no,pallet_no,pallet_qty,[length],width,height,volume,gross_weight,net_weight,pallet_remark,create_by,
  405. create_date,pallet)
  406. values(#{site},#{buNo},#{delNo},#{seqNo},#{palletNo},#{palletQty},#{length},#{width},#{height},#{volume},#{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{palletRemark},#{createBy},
  407. GETDATE(),#{pallet})
  408. </insert>
  409. <insert id="saveCodelBoxList">
  410. insert into ecss_CoDelBoxList(site,bu_no,delNo,seq_no,item_no,gross_weight,net_weight,box_qty,create_by,create_date)
  411. values (#{site},#{buNo},#{delNo},#{seqNo},#{itemNo},#{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{boxQty},#{createBy},GETDATE())
  412. </insert>
  413. <insert id="saveCodelPalletDetail">
  414. insert into ecss_CoDelPalletDetail(site,bu_no,delNo,seq_no,item_no,part_no,qty,po_no,box_qty,create_by,create_date,rolls,pn,notify_detail_item_no)
  415. values (#{site},#{buNo},#{delNo},#{seqNo},#{itemNo},#{partNo},#{qty,jdbcType=DECIMAL},#{poNo},#{boxQty},#{createBy},GETDATE(),#{rolls,jdbcType=DECIMAL},#{pn},#{notifyDetailItemNo})
  416. </insert>
  417. <select id="searchEcssCoDelPalletHeaderData" resultType="EcssCoDelPalletHeaderData">
  418. select site,bu_no,delNo,seq_no,pallet_no,pallet_qty,[length],width,height,volume,gross_weight,net_weight,pallet_remark,create_by,
  419. create_date,update_by,update_date,pallet from ecss_CoDelPalletHeader
  420. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  421. </select>
  422. <select id="searchEcssCoDelPalletDetailData" resultType="EcssCoDelPalletDetailData">
  423. select site,bu_no,delNo,seq_no,item_no,part_no,qty,po_no,box_qty,create_by,create_date,update_by,update_date,rolls,pn,notify_detail_item_no as notifyDetailItemNo
  424. from ecss_CoDelPalletDetail
  425. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  426. <if test="seqNo != null and seqNo != ''">
  427. and seq_no=#{seqNo}
  428. </if>
  429. </select>
  430. <select id="getCoDelPalletHeaderSeqNo" resultType="int">
  431. select isnull(max(seq_no),0)+1 as seqNo from ecss_CoDelPalletHeader
  432. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  433. </select>
  434. <select id="getCoDelBoxListItemNo" resultType="int">
  435. select isnull(max(item_no),0)+1 as seqNo from ecss_CoDelBoxList
  436. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  437. </select>
  438. <select id="getCoDelPalletDetailItem" resultType="int">
  439. select isnull(max(item_no),0)+1 as item_no from ecss_CoDelPalletDetail
  440. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo}
  441. </select>
  442. <update id="updateCodelPalletHeader">
  443. update ecss_CoDelPalletHeader set pallet_qty=#{palletQty,jdbcType=INTEGER},[length]=#{length,jdbcType=DECIMAL},width=#{width,jdbcType=DECIMAL},height=#{height,jdbcType=DECIMAL},
  444. volume=#{volume,jdbcType=DECIMAL},gross_weight=#{grossWeight,jdbcType=DECIMAL},net_weight=#{netWeight,jdbcType=DECIMAL},pallet_remark=#{palletRemark},
  445. update_by=#{updateBy},update_date=GetDate(),pallet=#{pallet}
  446. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo}
  447. </update>
  448. <update id="updateCodelPalletHeader2">
  449. update ecss_CoDelPalletHeader set gross_weight=#{grossWeight,jdbcType=DECIMAL},net_weight=#{netWeight,jdbcType=DECIMAL},
  450. update_by=#{updateBy},update_date=GetDate()
  451. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo}
  452. </update>
  453. <update id="updateCodelPalletHeaderPalletQty">
  454. update ecss_CoDelPalletHeader set pallet_qty=#{palletQty,jdbcType=INTEGER},height=#{height,jdbcType=DECIMAL},
  455. update_by=#{updateBy},update_date=GetDate()
  456. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo}
  457. </update>
  458. <update id="updateCodelPalletDetail">
  459. update ecss_CoDelPalletDetail set part_no=#{partNo},qty=#{qty,jdbcType=DECIMAL},po_no=#{poNo},
  460. box_qty=#{boxQty,jdbcType=DECIMAL},update_by=#{updateBy},update_date=GetDate(),rolls=#{rolls},pn=#{pn}
  461. where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} and item_no=#{itemNo}
  462. </update>
  463. <delete id="deletePalletHeader">
  464. delete from ecss_CoDelPalletHeader where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  465. <if test="seqNo != null and seqNo != ''">
  466. and seq_no=#{seqNo}
  467. </if>
  468. </delete>
  469. <delete id="deleteBoxList">
  470. delete from ecss_CoDelBoxList where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  471. <if test="seqNo != null and seqNo != ''">
  472. and seq_no=#{seqNo}
  473. </if>
  474. </delete>
  475. <delete id="deletePalletDetail">
  476. delete from ecss_CoDelPalletDetail where site =#{site} and bu_no=#{buNo} and delNo=#{delNo}
  477. <if test="seqNo != null and seqNo != ''">
  478. and seq_no=#{seqNo}
  479. </if>
  480. <if test="itemNo != null and itemNo != ''">
  481. and item_no=#{itemNo}
  482. </if>
  483. </delete>
  484. <select id="getAllWeight" resultType="com.xujie.sys.modules.ecss.entity.EcssCoDelPalletHeader">
  485. select sum(gross_weight) as gross_weight ,sum(net_weight) as net_weight from ecss_CoDelBoxList
  486. where site =#{site} and delNo=#{delNo} and bu_no=#{buNo}
  487. </select>
  488. <select id="getDefaultEcssDeclarationDetailData" resultType="EcssDeclarationDetailData">
  489. -- 修复净重计算问题:按数量比例分配箱子净重,避免重复计算
  490. -- 一个箱子(BoxList)可能包含多个零件(PalletDetail),这些零件可能有相同的hsCode
  491. -- 需要按每个零件的数量占该箱子总数量的比例来分配净重
  492. WITH BoxDetail AS (
  493. -- 计算每个箱子中每个零件的数量及其占比
  494. SELECT
  495. d.site,
  496. d.bu_no,
  497. d.delNo,
  498. d.seq_no,
  499. p.hsCode,
  500. p.hsCodeDesc,
  501. d.qty,
  502. b.net_weight,
  503. -- 计算该零件数量占该箱子总数量的比例
  504. CASE
  505. WHEN SUM(d.qty) OVER (PARTITION BY d.site, d.bu_no, d.delNo, d.seq_no) > 0
  506. THEN d.qty * 1.0 / SUM(d.qty) OVER (PARTITION BY d.site, d.bu_no, d.delNo, d.seq_no)
  507. ELSE 0
  508. END as qtyRatio
  509. FROM ecss_CoDelPalletDetail d
  510. LEFT JOIN part p ON d.site=p.site AND d.part_no=p.part_no
  511. LEFT JOIN ecss_CoDelBoxList b ON d.site=b.site AND d.bu_no=b.bu_no AND d.delNo=b.delNo AND d.seq_no=b.item_no
  512. WHERE d.site=#{site} AND d.delNo=#{delNo} AND d.bu_no=#{buNo}
  513. )
  514. SELECT
  515. #{site} as site,
  516. hsCode,
  517. hsCodeDesc,
  518. SUM(qty) as qty,
  519. -- 按数量比例分配净重后汇总
  520. CONVERT(DECIMAL(20,2), SUM(ISNULL(net_weight, 0) * qtyRatio)) as NetWeight,
  521. 'CNY' as currency,
  522. '中国' as madeArea,
  523. #{destination} as destination,
  524. '南通其他' as sourceArea,
  525. '照章征免' as levy
  526. FROM BoxDetail
  527. GROUP BY hsCode, hsCodeDesc
  528. </select>
  529. <select id="getDefaultEcssDeclarationDetailData2" resultType="EcssDeclarationDetailData">
  530. select #{site} as site, b.hsCode,b.hsCodeDesc as hsCodeDesc,sum( a.qty) as qty ,sum(a.ttl_amount) as totalPrice,
  531. CONVERT(DECIMAL(20, 6),sum(a.ttl_amount)/sum( a.qty)) as unitPrice,
  532. a.currency as currency,'中国' as madeArea,#{destination} as destination,'南通其他' as sourceArea ,'照章征免' as levy from
  533. ecss_CoDelNotifyDetail a left join part b on a.site=b.site and a.part_no=b.part_no
  534. where a.site =#{site} and a.delNo=#{delNo} and a.qty>0 and a.bu_no=#{buNo}
  535. GROUP BY b.hsCodeDesc,b.hsCode,a.currency
  536. </select>
  537. <insert id="saveEcssDeclarationHeader">
  538. insert into ecss_declaration_header (site,declaration_no,customs_office_code,input_code,local_shipper,local_ship_address,ship_type,ship_date,submit_date,
  539. filing_no,overseas_shipper,shipping_mode,shipping_data,deliver_no,sales_partner,regulatory_method,duty_status,
  540. permit_number,cmc_invoice,sales_area,receive_area,shipping_port,exit_port,documents,remark,package_type,package_qty,
  541. gross_weight,net_weight,payment_type,ship_price,premium,other_price,special_relationship_comfirm,price_influence_confirm,
  542. royalty_payments_confirm,create_by,create_date,delNo,overseas_address,box_qty)
  543. values(#{site},#{declarationNo},#{customsOfficeCode},#{inputCode},#{localShipper,jdbcType=NVARCHAR},#{localShipAddress,jdbcType=NVARCHAR},#{shipType},#{shipDate},#{submitDate},
  544. #{filingNo},#{overseasShipper,jdbcType=NVARCHAR},#{shippingMode,jdbcType=NVARCHAR},#{shippingData},#{deliverNo},#{salesPartner,jdbcType=NVARCHAR},#{regulatoryMethod,jdbcType=NVARCHAR},#{dutyStatus,jdbcType=NVARCHAR},
  545. #{permitNumber},#{cmcInvoice},#{salesArea,jdbcType=NVARCHAR},#{receiveArea,jdbcType=NVARCHAR},#{shippingPort,jdbcType=NVARCHAR},#{exitPort,jdbcType=NVARCHAR},#{documents,jdbcType=NVARCHAR},#{remark,jdbcType=NVARCHAR},#{packageType,jdbcType=NVARCHAR},#{packageQty,jdbcType=INTEGER},
  546. #{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{paymentType,jdbcType=NVARCHAR},#{shipPrice,jdbcType=DECIMAL},#{premium,jdbcType=DECIMAL},#{otherPrice,jdbcType=DECIMAL},#{specialRelationshipComfirm,jdbcType=NVARCHAR},#{priceInfluenceConfirm,jdbcType=NVARCHAR},
  547. #{royaltyPaymentsConfirm,jdbcType=NVARCHAR},#{createBy},GETDATE(),#{delNo},#{overseasAddress,jdbcType=NVARCHAR},#{boxQty})
  548. </insert>
  549. <insert id="saveEcssDeclarationDetail">
  550. insert into ecss_declaration_detail(site,declaration_no,item_no,hs_code,hs_code_desc,qty,net_weight,unit_price,total_price,currency,made_area,destination,
  551. source_area,levy)
  552. values(#{site},#{declarationNo},#{itemNo,jdbcType=INTEGER},#{hsCode},#{hsCodeDesc},#{qty,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{unitPrice,jdbcType=DECIMAL},#{totalPrice,jdbcType=DECIMAL},#{currency},#{madeArea},#{destination},
  553. #{sourceArea},#{levy})
  554. </insert>
  555. <select id="searchDeclarationHeader" resultType="EcssDeclarationHeaderData">
  556. select a.site,a.declaration_no,a.customs_office_code,a.input_code,a.local_shipper,a.local_ship_address,a.ship_type,
  557. a.ship_date,a.submit_date,a.filing_no,a.overseas_shipper,a.shipping_mode,a.shipping_data,a.deliver_no,a.sales_partner,
  558. a.regulatory_method,a.duty_status,a.permit_number,a.cmc_invoice,a.sales_area,a.receive_area,a.shipping_port,
  559. a.exit_port,a.documents,a.remark,a.package_type,a.package_qty,a.gross_weight,a.net_weight,a.payment_type,a.ship_price,
  560. a.premium,a.other_price,a.special_relationship_comfirm,a.price_influence_confirm,a.royalty_payments_confirm,
  561. a.create_by,a.create_date,a.update_by,a.update_date,a.delNo,noHeader.bu_no,
  562. a.upc,a.so,a.origin,a.pallet_weight,a.material,a.hs_code,a.packaging,a.kgs,a.shipping_mark,
  563. a.hsCodeDesc,a.contractFlag,a.hsCodeDescType,a.goodsLabel,a.boxChange,noHeader.customer_name as customName,
  564. noHeader.destination
  565. from ecss_declaration_header a
  566. left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=noHeader.delNo
  567. <where>
  568. <if test="query.delNo != null and query.delNo != ''">
  569. AND a.delNo like #{query.delNo}
  570. </if>
  571. <if test="query.declarationNo != null and query.declarationNo != ''">
  572. AND a.declaration_no like #{query.declarationNo}
  573. </if>
  574. <if test="query.cmcInvoice != null and query.cmcInvoice != ''">
  575. AND a.cmc_invoice like #{query.cmcInvoice}
  576. </if>
  577. <if test="query.site != null and query.site != ''">
  578. AND a.site like #{query.site}
  579. </if>
  580. <if test = "query.startDate!= null">
  581. AND a.ship_date>= #{query.startDate}
  582. </if>
  583. <if test = "query.endDate!= null">
  584. AND #{query.endDate} >=a.ship_date
  585. </if>
  586. </where>
  587. order by a.create_date desc
  588. </select>
  589. <select id="searchDeclarationDetail" resultType="EcssDeclarationDetailData">
  590. select site,declaration_no,item_no,hs_code,hs_code_desc,qty,net_weight,unit_price,total_price,currency,made_area,destination,
  591. source_area,levy
  592. from ecss_declaration_detail
  593. where site=#{site} and declaration_no=#{declarationNo}
  594. </select>
  595. <delete id="deleteDeclarationHeader">
  596. delete from ecss_declaration_header where site=#{site} and declaration_no=#{declarationNo}
  597. </delete>
  598. <delete id="deleteDeclarationDetail">
  599. delete from ecss_declaration_detail where site=#{site} and declaration_no=#{declarationNo}
  600. </delete>
  601. <select id="searchPalletData" resultType="EcssPalletData">
  602. select a.id,a.Site,a.BuNo,a.pallet_type as palletType,a.Remark,a.CreateBy,a.CreateDate,a.UpdateBy,a.UpdateDate,
  603. a.length, a.width, a.height, a.application_area as applicationArea, a.pallet_weight as palletWeight
  604. ,dbo.get_bu_desc(a.site,a.BuNo) as BuDesc,a.pallet_no as palletNo
  605. from ecss_pallet a
  606. left join accessBu D on A.site=D.site and A.BuNo=d.bu_no and D.username=#{query.username}
  607. <where>
  608. and D.site is not null
  609. <if test="query.buNo != null and query.buNo != ''">
  610. AND a.BuNo = #{query.buNo}
  611. </if>
  612. <if test="query.palletType != null and query.palletType != ''">
  613. AND a.pallet_type = #{query.palletType}
  614. </if>
  615. </where>
  616. order by a.CreateDate
  617. </select>
  618. <insert id="insertPalletData" >
  619. insert into ecss_pallet (Site,BuNo,pallet_type,Remark,CreateBy,CreateDate,length,width,
  620. height,application_area,pallet_weight,pallet_no)
  621. values(#{site},#{buNo},#{palletType},#{remark},#{createBy},GetDate(),#{length},#{width},
  622. #{height},#{applicationArea},#{palletWeight},#{palletNo})
  623. </insert>
  624. <update id="updatePalletData">
  625. update ecss_pallet set Remark=#{remark} ,pallet_type=#{palletType} ,
  626. length=#{length} ,width=#{width} ,
  627. height=#{height} ,application_area=#{applicationArea} ,
  628. pallet_weight=#{palletWeight} ,pallet_no=#{palletNo},
  629. UpdateDate=GetDate(),UpdateBy=#{updateBy}
  630. where site=#{site} and buNo=#{buNo} and id=#{id}
  631. </update>
  632. <select id="deletePallet" >
  633. delete from ecss_pallet where site=#{site} and buNo=#{buNo} and id=#{id}
  634. </select>
  635. <select id="getPallet" resultType="EcssPalletData">
  636. select * from ecss_pallet where site=#{site} and buNo=#{buNo} and pallet_no=#{palletNo}
  637. </select>
  638. <select id="getPackage" resultType="EcssPackageData">
  639. select * from ecss_package where site=#{site} and buNo=#{buNo} and package_no=#{packageNo}
  640. </select>
  641. <insert id="insertPackageData" >
  642. insert into ecss_package (Site,BuNo,package_type,Remark,CreateBy,CreateDate,length,width,
  643. height,volume,weight,package_no)
  644. values(#{site},#{buNo},#{packageType},#{remark},#{createBy},GetDate(),#{length},#{width},
  645. #{height},#{volume},#{weight},#{packageNo})
  646. </insert>
  647. <update id="updatePackageData">
  648. update ecss_package set Remark=#{remark} ,package_type=#{packageType} ,
  649. length=#{length} ,width=#{width} ,volume=#{volume},weight=#{weight},
  650. package_no=#{packageNo},height=#{height} ,
  651. UpdateDate=GetDate(),UpdateBy=#{updateBy}
  652. where site=#{site} and buNo=#{buNo} and id=#{id}
  653. </update>
  654. <select id="deleteEcssPackage" >
  655. delete from ecss_package where site=#{site} and buNo=#{buNo} and id=#{id}
  656. </select>
  657. <select id="searchPackageData" resultType="EcssPackageData">
  658. select a.id,a.Site,a.BuNo,a.package_type as packageType,a.Remark,a.CreateBy,a.CreateDate,a.UpdateBy,a.UpdateDate,
  659. a.length, a.width, a.height, a.volume, a.weight,a.package_no as packageNo
  660. ,dbo.get_bu_desc(a.site,a.BuNo) as BuDesc
  661. from ecss_package a
  662. left join accessBu D on A.site=D.site and A.BuNo=d.bu_no and D.username=#{query.username}
  663. <where>
  664. and D.site is not null
  665. <if test="query.buNo != null and query.buNo != ''">
  666. AND a.BuNo = #{query.buNo}
  667. </if>
  668. <if test="query.packageType != null and query.packageType != ''">
  669. AND a.package_type = #{query.packageType}
  670. </if>
  671. </where>
  672. order by a.CreateDate
  673. </select>
  674. <select id="searchHsCodeList" resultType="java.util.Map">
  675. select a.BuNo,a.HsCode,a.hsCodeDesc,a.unit,a.hsCodeDescEn
  676. from ecss_hsCode a
  677. <where> a.BuNo = #{buNo}
  678. <if test="hsCode != null and hsCode != ''">
  679. AND a.HsCode like '%'+#{hsCode}+'%'
  680. </if>
  681. <if test="hsCodeDesc != null and hsCodeDesc != ''">
  682. AND a.hsCodeDesc like '%'+#{hsCodeDesc}+'%'
  683. </if>
  684. </where>
  685. order by a.CreateDate ,a.HsCode
  686. </select>
  687. <select id="searchPalletList" resultType="java.util.Map">
  688. select a.BuNo,a.id as palletId,a.pallet_type as palletType,a.pallet_no as palletNo,
  689. a.application_area as applicationArea ,a.length, a.width, a.height
  690. from ecss_pallet a
  691. <where> a.BuNo = #{buNo}
  692. <if test="palletType != null and palletType != ''">
  693. AND a.pallet_type like '%'+#{palletType}+'%'
  694. </if>
  695. </where>
  696. order by a.CreateDate
  697. </select>
  698. <select id="searchPackageList" resultType="java.util.Map">
  699. select a.BuNo,a.id as packageId,a.package_type as packageType,a.package_no as packageNo,
  700. a.length, a.width, a.height
  701. from ecss_package a
  702. <where> a.BuNo = #{buNo}
  703. <if test="packageType != null and packageType != ''">
  704. AND a.package_type like '%'+#{packageType}+'%'
  705. </if>
  706. </where>
  707. order by a.CreateDate
  708. </select>
  709. <select id="getDeclarationElements" resultType="java.util.Map">
  710. select part_no as partNo,bu_no as buNo
  711. from ecss_CoDelNotifyDetail
  712. where site=#{site} and delNo=#{delNo} and qty>0
  713. GROUP BY part_no,bu_no
  714. </select>
  715. <select id="getHsCodeByPartNo" resultType="java.util.Map">
  716. select p.hsCode, p.hsCodeDesc,p.part_no ,h.codeNo,h.BuNo,p.sku,h.hsCodeDescEn
  717. from Part p
  718. left join ecss_hsCode h on p.hsCodeDesc=h.hsCodeDesc and p.site=h.site
  719. where p.site=#{site,jdbcType=VARCHAR} and p.part_no in
  720. <foreach item="item" index="index" collection="partNos" open="(" separator="," close=")">
  721. #{item}
  722. </foreach>
  723. </select>
  724. <select id="getDeclarationHeader" resultType="EcssDeclarationHeaderData">
  725. select * from ecss_declaration_header where site=#{site} and declaration_no=#{declarationNo}
  726. </select>
  727. <select id="getDeclarationHeaderByDelNo" resultType="EcssDeclarationHeaderData">
  728. select * from ecss_declaration_header where site=#{site} and delNo=#{delNo}
  729. </select>
  730. <select id="exportDeclarationDetail" resultType="java.util.Map">
  731. select detail.site,detail.declaration_no,detail.item_no,
  732. CONVERT(DECIMAL(20, 0), detail.qty) as qty,isnull(h.unit,'') as qty_unit,'kg' as weight_unit,
  733. CONVERT(DECIMAL(20, 2),detail.net_weight) as net_weight,CONVERT(DECIMAL(20, 6),detail.unit_price) as unit_price,
  734. CONVERT(DECIMAL(20, 2),detail.total_price) as total_price,detail.currency,detail.made_area,detail.destination,
  735. detail.source_area,detail.levy,detail.hs_code,detail.hs_code_desc,h.hsCodeDescEn
  736. from ecss_declaration_detail detail
  737. left join ecss_hsCode h on detail.hs_code=h.HsCode and detail.site=h.Site and detail.hs_code_desc=h.hsCodeDesc
  738. where detail.site=#{site} and declaration_no=#{declarationNo}
  739. </select>
  740. <select id="getEcssCoDelNotifyHeader" resultType="EcssCoDelNotifyHeaderData">
  741. select * from ecss_CoDelNotifyHeader where site=#{site} and delNo=#{delNo}
  742. </select>
  743. <select id="exportEcssCoDelNotifyDetail" resultType="java.util.Map">
  744. select a.customerPO,a.part_no,a.part_description,a.currency,
  745. CONVERT(DECIMAL(20, 0), a.qty) as qty,CONVERT(DECIMAL(20, 6), a.tp) as unitPrice,b.hsCode,
  746. a.upc,a.so,a.ttl_amount,a.pn,h.hsCodeDesc,h.hsCodeDescEn
  747. from ecss_CoDelNotifydetail a
  748. left join part b on a.site=b.site and a.part_no=b.part_no
  749. left join ecss_hsCode h on b.hsCode=h.HsCode and a.site=h.site and b.hsCodeDesc=h.hsCodeDesc
  750. where a.site = #{site} AND a.delNo = #{delNo} and a.qty>0
  751. order by a.item_no
  752. </select>
  753. <select id="exportCoDelPalletDetail" resultType="java.util.Map">
  754. select b.part_no,CONVERT(DECIMAL(20, 0),sum(b.qty)) as total_qty,
  755. CONVERT(DECIMAL(20, 0),sum(DISTINCT a.box_qty)) as box_qty,
  756. CONVERT(DECIMAL(20, 0),sum(b.rolls)) as rolls,
  757. CONVERT(DECIMAL(20, 2),sum(a.net_weight)) as net_weight,
  758. CONVERT(DECIMAL(20, 2),sum(a.gross_weight)) as gross_weight,
  759. CONVERT(DECIMAL(20, 0),sum(b.rolls*b.qty)) as qty_per_carton
  760. from ecss_CoDelBoxList a left join ecss_CoDelPalletDetail b
  761. on a.site=b.site and a.bu_no=b.bu_no and a.delNo=b.delNo and a.item_no=b.seq_no
  762. where a.site=#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo} and b.site is not null GROUP BY b.part_no
  763. </select>
  764. <select id="getCoDelPalletDetailGroupByPn" resultType="java.util.Map">
  765. select b.pn,CONVERT(DECIMAL(20, 0),sum(b.qty)) as total_qty,
  766. CONVERT(DECIMAL(20, 0),sum(DISTINCT a.box_qty)) as box_qty,
  767. CONVERT(DECIMAL(20, 0),sum(b.rolls)) as rolls,
  768. CONVERT(DECIMAL(20, 2),sum(a.net_weight)) as net_weight,
  769. CONVERT(DECIMAL(20, 2),sum(a.gross_weight)) as gross_weight,
  770. CONVERT(DECIMAL(20, 0),sum(b.rolls*b.qty)) as qty_per_carton
  771. from ecss_CoDelBoxList a left join ecss_CoDelPalletDetail b
  772. on a.site=b.site and a.bu_no=b.bu_no and a.delNo=b.delNo and a.item_no=b.seq_no
  773. where a.site=#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo} GROUP BY b.pn
  774. </select>
  775. <select id="exportCoDelBoxList" resultType="java.util.Map">
  776. select CONVERT(DECIMAL(20, 0),sum(a.box_qty)) as box_qty
  777. from ecss_CoDelBoxList a
  778. where a.site=#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo} GROUP BY a.item_no
  779. </select>
  780. <update id="updateEcssDeclarationHeader" >
  781. update ecss_declaration_header set
  782. upc=#{upc},so=#{so},origin=#{origin},pallet_weight=#{palletWeight},material=#{material},
  783. hs_code=#{hsCode},packaging=#{packaging},kgs=#{kgs},shipping_mark=#{shippingMark},boxChange=#{boxChange},
  784. hsCodeDesc=#{hsCodeDesc},contractFlag=#{contractFlag},hsCodeDescType=#{hsCodeDescType},goodsLabel=#{goodsLabel}
  785. where site=#{site} and declaration_no=#{declarationNo}
  786. </update>
  787. <update id="updateEcssCoDelNotifyDetail" >
  788. update ecss_CoDelNotifydetail set lossratio=#{lossratio},ehundred=#{ehundred}
  789. where site=#{site} and delNo=#{delNo} and part_no=#{partNo}
  790. </update>
  791. <update id="updateEcssCoDelNotifyDetailSurplus" >
  792. update ecss_CoDelNotifydetail set surplus_qty=#{surplusQty}
  793. where site=#{site} and bu_no=#{buNo} and delNo=#{delNo} and part_no=#{partNo} and item_no=#{itemNo}
  794. </update>
  795. <select id="getNotifyPartDetail" resultType="java.util.Map">
  796. select a.part_no as partNo,b.hsCode,a.site,a.delNo,a.lossratio,a.ehundred,b.part_desc,a.pn
  797. from ecss_CoDelNotifydetail a
  798. left join part b on a.site=b.site and a.part_no=b.part_no
  799. where a.site = #{site} AND a.delNo = #{delNo} and a.qty>0
  800. group by a.part_no,b.hsCode,a.site,a.delNo,a.lossratio,a.ehundred,b.part_desc,a.pn
  801. </select>
  802. <select id="getNotifyPartDetail2" resultType="EcssCoDelNotifyDetailData">
  803. select a.part_no as partNo,b.hsCode,a.site,a.delNo,a.lossratio,a.ehundred,b.part_desc,a.pn
  804. from ecss_CoDelNotifydetail a
  805. left join part b on a.site=b.site and a.part_no=b.part_no
  806. where a.site = #{site} AND a.delNo = #{delNo} and a.qty>0
  807. group by a.part_no,b.hsCode,a.site,a.delNo,a.lossratio,a.ehundred,b.part_desc,a.pn
  808. </select>
  809. <select id="getNotifyDetailGroup" resultType="java.util.Map">
  810. select b.hsCodeDesc,CONVERT(DECIMAL(20, 2),sum(a.qty)) as total_qty,
  811. CONVERT(DECIMAL(20, 2),sum(a.ttl_amount)) as ttl_amount
  812. from ecss_CoDelNotifydetail a
  813. left join part b on a.site=b.site and a.part_no=b.part_no
  814. where a.site = #{site} AND a.delNo = #{delNo} and a.qty>0
  815. group by b.hsCodeDesc
  816. </select>
  817. <!-- 根据notifyDetailItemNo获取发货通知单明细 -->
  818. <select id="getEcssCoDelNotifyDetailByItemNo" resultType="EcssCoDelNotifyDetailData">
  819. select a.site,a.bu_no,a.delNo,a.item_no,a.salesOrder,a.salesOrder_item_no,a.customerPO,a.line,a.version,a.status,a.family,
  820. a.part_no,a.part_description,a.qty,a.lt,a.cmc_comment,a.saleType,a.awb_bl,a.shipping_number,a.forwarder_info,isnull(a.surplus_qty,0) surplusQty,
  821. a.currency,a.tp,a.ttl_amount,a.sum_price,a.so,a.upc,a.remark,a.erp_delItemNo,a.pn,CONVERT(DECIMAL(20, 0),a.nocartons) as nocartons,
  822. a.modifyFlag,a.modifyQtyFlag
  823. from ecss_CoDelNotifydetail a
  824. where a.site = #{site}
  825. and a.bu_no = #{buNo}
  826. and a.delNo = #{delNo}
  827. and a.item_no = #{notifyDetailItemNo}
  828. </select>
  829. <select id="getPropertiesListByTypeAndCodeNo" resultType="com.xujie.sys.modules.part.entity.PartSubPropertiesValueData">
  830. SELECT a.part_no , a.Site, a.code_no, a.sub_code_seq_no, a.sub_code_desc
  831. ,a.bu_no,a.item_no, a.properties_item_no, a.text_value, a.num_value, a.record_type
  832. , b.item_desc ItemDesc, b.value_type, b.value_type_db, b.value_choose_flag
  833. FROM part_sub_properties_value a
  834. left join plm_properties_item b
  835. on a.properties_item_no = b.Item_No and a.site = b.site and a.record_type = b.Item_Type and a.bu_no=b.bu_no
  836. <where>
  837. AND a.site = #{site}
  838. and a.record_type = #{recordType}
  839. and a.bu_no=#{buNo}
  840. and a.code_no = #{codeNo}
  841. and a.part_no = #{pn}
  842. </where>
  843. order by a.item_no
  844. </select>
  845. <select id="getEcssContacts" resultType="java.util.Map">
  846. select * from ecss_contacts where bu_no=#{buNo}
  847. </select>
  848. <select id="getCustomerList" resultType="java.util.Map">
  849. select * from ecss_custdev_mes_cmc_customer where buse='是'
  850. </select>
  851. <select id="getCustomerInfo" resultType="java.util.Map">
  852. select DISTINCT vcus.ccusname,vcusp.ccontactname,vcusp.cnative
  853. from ecss_custdev_mes_cmc_customer vcus
  854. LEFT JOIN ecss_custdev_mes_cmc_customer_person vcusp on vcus.ccuscode=vcusp.ccuscode
  855. <where>
  856. <if test="ccusname != null and ccusname != ''">
  857. and vcus.ccusname=#{ccusname}
  858. </if>
  859. <if test="ccuscode != null and ccuscode != ''">
  860. and vcus.ccuscode=#{ccuscode}
  861. </if>
  862. </where>
  863. </select>
  864. <select id="getCustomerAdd" resultType="java.util.Map">
  865. select DISTINCT vcus.ccusname,vcusa.cDeliverAdd
  866. from ecss_custdev_mes_cmc_customer vcus
  867. left join ecss_custdev_mes_cmc_customer_addr vcusa on vcus.ccuscode=vcusa.ccuscode
  868. where vcus.ccusname=#{ccusname}
  869. </select>
  870. <select id="getPackageNoByPartNo" resultType="java.util.Map">
  871. select p.part_no as partNo,p.packageNo
  872. from Part p
  873. where p.site=#{site,jdbcType=VARCHAR} and p.part_no in
  874. <foreach item="item" index="index" collection="partNos" open="(" separator="," close=")">
  875. #{item}
  876. </foreach>
  877. </select>
  878. <select id="getPackageNoByPn" resultType="java.util.Map">
  879. select p.sku as pn,p.packageNo
  880. from Part p
  881. where p.site=#{site,jdbcType=VARCHAR} and p.sku in
  882. <foreach item="item" index="index" collection="pns" open="(" separator="," close=")">
  883. #{item}
  884. </foreach>
  885. </select>
  886. <select id="getPackageList" resultType="EcssPackageData">
  887. select * from ecss_package where site=#{site} and buNo=#{buNo}
  888. and package_no in
  889. <foreach item="item" index="index" collection="packageNos" open="(" separator="," close=")">
  890. #{item}
  891. </foreach>
  892. </select>
  893. <select id="searchEcssTemplateData" resultType="EcssTemplate">
  894. select a.*,dbo.get_bu_desc(a.site,a.BuNo) as BuDesc
  895. from ecss_template a
  896. left join accessBu D on A.site=D.site and A.BuNo=d.bu_no and D.username=#{query.username}
  897. <where>
  898. and D.site is not null
  899. <if test="query.buNo != null and query.buNo != ''">
  900. AND a.buNo = #{query.buNo}
  901. </if>
  902. <if test="query.name != null and query.name != ''">
  903. AND a.name like '%'+#{query.name}+'%'
  904. </if>
  905. <if test="query.customName != null and query.customName != ''">
  906. AND a.customName like '%'+#{query.customName}+'%'
  907. </if>
  908. <if test="query.shippingMode != null and query.shippingMode != ''">
  909. AND a.shippingMode like '%'+#{query.shippingMode}+'%'
  910. </if>
  911. <if test="query.type != null and query.type != ''">
  912. AND a.type = #{query.type}
  913. </if>
  914. </where>
  915. order by a.CreateDate
  916. </select>
  917. <insert id="insertEcssTemplateData" >
  918. insert into ecss_template (customName,site,buNo,name,type,upc,so,origin,palletWeight,material,hsCode,packaging,itemNo,
  919. kgs,shippingMark,boxChange,hsCodeDesc,contractFlag,hsCodeDescType,goodsLabel,hsCodeFlag,shippingMode,CreateBy,CreateDate,
  920. salesMethod,currency,madeArea,sendPort,shipper,voyage,deliveryGoodsDate,shippingDate,fscWeight, remark,highPalletFlag)
  921. values(#{customName,jdbcType=NVARCHAR},#{site},#{buNo},#{name},#{type},#{upc},#{so},#{origin},#{palletWeight},#{material},#{hsCode},#{packaging},
  922. #{itemNo},#{kgs},#{shippingMark},#{boxChange},
  923. #{hsCodeDesc},#{contractFlag},#{hsCodeDescType},#{goodsLabel},#{hsCodeFlag},#{shippingMode},#{createBy},GetDate(),
  924. #{salesMethod},#{currency},#{madeArea},#{sendPort},#{shipper},#{voyage},#{deliveryGoodsDate},#{shippingDate},#{fscWeight},#{remark},#{highPalletFlag})
  925. </insert>
  926. <update id="updateEcssTemplateData">
  927. update ecss_template set buNo=#{buNo},name=#{name},type=#{type},upc=#{upc},so=#{so},origin=#{origin},boxChange=#{boxChange},
  928. palletWeight=#{palletWeight},material=#{material},hsCode=#{hsCode},itemNo=#{itemNo},
  929. packaging=#{packaging},kgs=#{kgs},shippingMark=#{shippingMark},hsCodeDesc=#{hsCodeDesc},
  930. contractFlag=#{contractFlag},hsCodeDescType=#{hsCodeDescType},goodsLabel=#{goodsLabel},hsCodeFlag=#{hsCodeFlag},
  931. shippingMode=#{shippingMode},UpdateDate=GetDate(),UpdateBy=#{updateBy},customName=#{customName,jdbcType=NVARCHAR},salesMethod= #{salesMethod},
  932. currency= #{currency},madeArea= #{madeArea},sendPort= #{sendPort},shipper= #{shipper},remark= #{remark},
  933. voyage= #{voyage},deliveryGoodsDate= #{deliveryGoodsDate},shippingDate= #{shippingDate},fscWeight=#{fscWeight},highPalletFlag=#{highPalletFlag}
  934. where buNo=#{buNo} and name=#{nameNative}
  935. </update>
  936. <select id="deleteEcssTemplate" >
  937. delete from ecss_template where buNo=#{buNo} and name=#{name}
  938. </select>
  939. <select id="getEcssTemplateByBuAndName" resultType="EcssTemplate">
  940. select * from ecss_template where name=#{name} and site=#{site}
  941. </select>
  942. <select id="searchWalMartOrderData" resultType="EcssWalMartOrder">
  943. select a.*
  944. from ecss_walMartOrder a
  945. <where>
  946. <if test="query.so != null and query.so != ''">
  947. AND a.so like '%'+#{query.so}+'%'
  948. </if>
  949. <if test="query.sku != null and query.sku != ''">
  950. AND a.sku like '%'+#{query.sku}+'%'
  951. </if>
  952. </where>
  953. order by a.CreateDate
  954. </select>
  955. <insert id="insertWalMartOrderData" >
  956. insert into ecss_walMartOrder (site,buNo,sku,so,qty,rolls,grossWeight,verificationSheet,CreateBy,CreateDate)
  957. values(#{site},#{buNo},#{sku},#{so},#{qty},#{rolls},#{grossWeight},#{verificationSheet},#{createBy},GetDate())
  958. </insert>
  959. <insert id="batchSaveWalMartOrder">
  960. insert into ecss_walMartOrder (site,buNo,sku,so,qty,rolls,grossWeight,verificationSheet,CreateBy,CreateDate)
  961. values
  962. <foreach collection="list" separator="," item="item">
  963. (#{item.site},#{item.buNo},#{item.sku},#{item.so},#{item.qty},
  964. #{item.rolls},#{item.grossWeight},#{item.verificationSheet},#{item.createBy},GetDate())
  965. </foreach>
  966. </insert>
  967. <update id="updateWalMartOrderData">
  968. update ecss_walMartOrder set buNo=#{buNo},sku=#{sku},so=#{so},qty=#{qty},rolls=#{rolls},grossWeight=#{grossWeight},
  969. verificationSheet=#{verificationSheet},UpdateDate=GetDate(),UpdateBy=#{updateBy}
  970. where buNo=#{buNo} and sku=#{sku} and so=#{so} and qty=#{qty}
  971. </update>
  972. <select id="deleteWalMartOrder" >
  973. delete from ecss_walMartOrder where buNo=#{buNo} and sku=#{sku} and so=#{so} and qty=#{qty}
  974. </select>
  975. <!-- 查出所有类型的物料 -->
  976. <select id="queryPartListAll" parameterType="PartInformationEntity" resultType="PartInformationEntity">
  977. SELECT site, sourceBu as buNo, part_no, part_desc, sku
  978. FROM part
  979. <where> sourceBu=#{query.buNo} and
  980. site = #{query.site} and active = 'Y'
  981. <if test = "query.partNo != null and query.partNo != ''">
  982. AND part_no like '%' + #{query.partNo} + '%'
  983. </if>
  984. <if test = "query.sku != null and query.sku != ''">
  985. AND sku like '%' + #{query.sku} + '%'
  986. </if>
  987. <if test = "query.partDesc != null and query.partDesc != ''">
  988. AND part_desc like '%' + #{query.partDesc} + '%'
  989. </if>
  990. </where>
  991. </select>
  992. <select id="queryByUserName" resultType="com.xujie.sys.modules.sys.entity.SysUserEntity">
  993. select * from sys_user where username = #{username}
  994. </select>
  995. <select id="queryUsersByRoleName" resultType="com.xujie.sys.modules.sys.entity.SysUserEntity">
  996. select u.email from sys_user u
  997. LEFT JOIN sys_user_role ur on ur.user_id = u.user_id
  998. LEFT JOIN sys_role r on r.role_id = ur.role_id
  999. where r.role_name = #{roleName} and u.site = #{site}
  1000. </select>
  1001. <select id="searchCoDelPalletDataNew" resultType="EcssCoDelPalletData">
  1002. select b.site,b.bu_no,b.delNo,b.seq_no,b.item_no,b.po_no,b.part_no,b.qty,b.box_qty,b.rolls,b.pn,
  1003. c.gross_weight,c.net_weight,c.box_qty as pallet_qty,b.notify_detail_item_no as notifyDetailItemNo
  1004. from ecss_CoDelPalletDetail b
  1005. left join ecss_CoDelBoxList c on b.site=c.site and b.bu_no=c.bu_no and b.delNo=c.delNo and b.seq_no=c.item_no
  1006. where b.site=#{site} and b.bu_no=#{buNo} and b.delNo=#{delNo}
  1007. <if test="seqNo != null and seqNo != ''">
  1008. and b.seq_no=#{seqNo}
  1009. </if>
  1010. </select>
  1011. <update id="updateExportFlag">
  1012. update ecss_CoDelNotifyHeader
  1013. set export_flag = #{exportFlag},
  1014. updateBy = #{updateBy},
  1015. updateDate = GetDate()
  1016. where site = #{site}
  1017. and bu_no = #{buNo}
  1018. and delNo = #{delNo}
  1019. </update>
  1020. <select id="selectBoxList" resultType="java.util.Map">
  1021. select *,CONVERT(DECIMAL(20, 3),gross_weight) as grossWeight,CONVERT(DECIMAL(20, 3),net_weight) as netWeight from ecss_CoDelBoxList
  1022. where site = #{site} and bu_no = #{buNo} and delNo = #{delNo}
  1023. </select>
  1024. <update id="updateBoxInfo">
  1025. update ecss_CoDelBoxList
  1026. set box_qty = #{box_qty},
  1027. gross_weight = #{grossWeight},
  1028. net_weight = #{netWeight}
  1029. where site = #{site}
  1030. and bu_no = #{buNo}
  1031. and delNo = #{delNo}
  1032. and item_no = #{item_no}
  1033. </update>
  1034. <delete id="deleteBoxInfo">
  1035. delete from ecss_CoDelBoxList
  1036. where site = #{site}
  1037. and bu_no = #{buNo}
  1038. and delNo = #{delNo}
  1039. and item_no = #{item_no}
  1040. </delete>
  1041. <update id="updateDetailInfo">
  1042. update ecss_CoDelPalletDetail
  1043. set qty = #{qty},
  1044. rolls = #{rolls}
  1045. where site = #{site}
  1046. and bu_no = #{buNo}
  1047. and delNo = #{delNo}
  1048. and seq_no = #{seqNo}
  1049. and item_no = #{itemNo}
  1050. </update>
  1051. <delete id="deleteDetailInfo">
  1052. delete from ecss_CoDelPalletDetail
  1053. where site = #{site}
  1054. and bu_no = #{buNo}
  1055. and delNo = #{delNo}
  1056. and seq_no = #{seqNo}
  1057. and item_no = #{itemNo}
  1058. </delete>
  1059. <delete id="deleteEmptyBoxAfterDetailDelete">
  1060. -- 删除明细后,如果该box下没有明细了,则删除对应的box
  1061. delete from ecss_CoDelBoxList
  1062. where site = #{site}
  1063. and bu_no = #{buNo}
  1064. and delNo = #{delNo}
  1065. and item_no = #{seqNo}
  1066. and not exists (
  1067. select 1
  1068. from ecss_CoDelPalletDetail
  1069. where site = #{site}
  1070. and bu_no = #{buNo}
  1071. and delNo = #{delNo}
  1072. and seq_no = #{seqNo}
  1073. );
  1074. </delete>
  1075. <!--<select id="selectPalletDetailList" resultType="java.util.Map">
  1076. select a.*,b.part_description,b.hsCode,b.upc,b.so
  1077. from ecss_CoDelPalletDetail a left join (
  1078. select a.site,a.bu_no,a.delNo,a.part_no,a.part_description,b.hsCode,a.upc,a.so,a.customerPO
  1079. from ecss_CoDelNotifydetail a
  1080. left join part b on a.site=b.site and a.part_no=b.part_no
  1081. where a.site=#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo}
  1082. GROUP BY a.site,a.bu_no,a.delNo,a.part_no,a.part_description,b.hsCode,a.upc,a.so,a.customerPO
  1083. ) b on a.site=b.site and a.bu_no=b.bu_no and a.delNo=b.delNo and a.part_no=b.part_no and b.customerPO=a.po_no
  1084. where a.site =#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo}
  1085. <if test="seqNo != null and seqNo != ''">
  1086. and a.seq_no=#{seqNo}
  1087. </if>
  1088. order by a.notify_detail_item_no
  1089. </select>-->
  1090. <select id="selectPalletDetailList" resultType="java.util.Map">
  1091. select a.*,b.part_description,c.hsCode,b.upc,b.so
  1092. from ecss_CoDelPalletDetail a
  1093. left join ecss_CoDelNotifydetail b on a.site=b.site and a.bu_no=b.bu_no and a.delNo=b.delNo and a.notify_detail_item_no=b.item_no
  1094. left join part c on a.site=c.site and a.part_no=c.part_no
  1095. where a.site =#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo}
  1096. <if test="seqNo != null and seqNo != ''">
  1097. and a.seq_no=#{seqNo}
  1098. </if>
  1099. order by a.notify_detail_item_no
  1100. </select>
  1101. <!-- 获取客户模板列表 -->
  1102. <select id="getCustomerTemplateList" resultType="java.util.Map">
  1103. SELECT
  1104. template_no,
  1105. template_name,
  1106. ccuscode,
  1107. ccusname,
  1108. caddcode1,
  1109. localShipAddress,
  1110. salesArea,
  1111. caddcode2,
  1112. overseasAddress,
  1113. cnative,
  1114. overseasShipper
  1115. FROM ecss_Customer_template
  1116. <where>
  1117. <if test="templateName != null and templateName != ''">
  1118. AND template_name like '%'+#{templateName}+'%'
  1119. </if>
  1120. <if test="customerName != null and customerName != ''">
  1121. AND customer_name like '%'+#{customerName}+'%'
  1122. </if>
  1123. </where>
  1124. ORDER BY template_name
  1125. </select>
  1126. </mapper>