O
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.

1163 lines
58 KiB

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