荣鑫后端
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.

2178 lines
86 KiB

4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.gaotao.modules.base.dao.BaseMapper">
  4. <select id="getCalendarData" resultType="com.gaotao.modules.base.entity.CalendarData"
  5. parameterType="com.gaotao.modules.base.entity.CalendarData">
  6. SELECT * FROM calendar
  7. <where>
  8. <if test="site != null and site != ''">
  9. AND site = #{site}
  10. </if>
  11. <if test="calendarId != null and calendarId != ''">
  12. AND CalendarID ${isIncluding} #{calendarId}
  13. </if>
  14. <if test="calendarDesc != null and calendarDesc != ''">
  15. AND CalendarDesc ${isIncluding} #{calendarDesc}
  16. </if>
  17. <if test="status != null and status != ''">
  18. AND status = #{status}
  19. </if>
  20. </where>
  21. </select>
  22. <select id="findBySite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData">
  23. SELECT * FROM calendar_datetype
  24. <where>
  25. <if test="site != null and site != ''">
  26. AND site = #{site}
  27. </if>
  28. </where>
  29. </select>
  30. <update id="editCalendar">
  31. UPDATE calendar set CalendarDesc=#{calendarDesc},status=#{status}
  32. WHERE CalendarID = #{calendarId} AND site = #{site}
  33. <!-- <if test="version != null and version != ''">-->
  34. <!-- AND version = #{version}-->
  35. <!-- </if>-->
  36. </update>
  37. <select id="findByCalendarId" resultType="com.gaotao.modules.base.entity.CalendarData">
  38. SELECT CalendarDesc FROM calendar
  39. <where>
  40. <if test="calendarId != null and calendarId != ''">
  41. AND CalendarID = #{calendarId}
  42. </if>
  43. <if test="site != null and site != ''">
  44. AND site = #{site}
  45. </if>
  46. </where>
  47. </select>
  48. <insert id="save" parameterType="com.gaotao.modules.base.entity.CalendarData">
  49. INSERT INTO calendar(site, calendarID, calendarDesc, status)
  50. VALUES (#{site}, #{calendarId}, #{calendarDesc}, #{status})
  51. </insert>
  52. <delete id="delCalendar">
  53. DELETE
  54. FROM calendar
  55. WHERE CalendarID = #{calendarId}
  56. AND site = #{site}
  57. </delete>
  58. <select id="findByDatetypeAndSite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData">
  59. select
  60. site,datetype,worktime,exceptexacttime1,exceptexacttime2,exceptexacttime3,exceptexacttime4,exceptexacttime5,exceptexacttime6,
  61. excepttime1,exceptduration1,excepttime2,exceptduration2,excepttime3,exceptduration3,excepttime4,exceptduration4,
  62. excepttime5,exceptduration5,excepttime6,exceptduration6 FROM calendar_datetype
  63. <where>
  64. <if test="dataType != null and dataType != ''">
  65. AND datetype = #{dataType}
  66. </if>
  67. <if test="site != null and site != ''">
  68. AND site = #{site}
  69. </if>
  70. </where>
  71. </select>
  72. <select id="getCalendarEByCIdAndSDate" resultType="com.gaotao.modules.base.entity.CalendarExceptionData">
  73. SELECT site,CalendarID,ScheduleDate FROM calendar_exception
  74. <where>
  75. <if test="site != null and site != ''">
  76. AND site = #{site}
  77. </if>
  78. <if test="calendarId != null and calendarId != ''">
  79. AND CalendarID = #{calendarId}
  80. </if>
  81. <if test="scheduledate != null and scheduledate != ''">
  82. AND ScheduleDate = #{scheduledate}
  83. </if>
  84. </where>
  85. </select>
  86. <select id="findBySiteAndCalendarId" resultType="com.gaotao.modules.base.entity.CalendarExceptionData">
  87. SELECT TOP 100 * FROM calendar_exception
  88. <where>
  89. <if test="site != null and site != ''">
  90. AND Site = #{site}
  91. </if>
  92. <if test="calendarId != null and calendarId != ''">
  93. AND CalendarID = #{calendarId}
  94. </if>
  95. <if test="scheduledDate != null and scheduledDate != ''">
  96. AND ScheduleDate <![CDATA[ >= ]]> #{scheduledDate}
  97. </if>
  98. </where>
  99. ORDER BY scheduledate DESC
  100. </select>
  101. <update id="editShift" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData">
  102. UPDATE calendar_datetype_shift set shiftdesc=#{shiftdesc},startexacttime=#{startexacttime}
  103. ,endexacttime=#{endexacttime},starttime=#{starttime},endtime=#{endtime}
  104. <where>
  105. <if test="site != null and site != ''">
  106. AND site = #{site}
  107. </if>
  108. AND DateType = #{datetype}
  109. and ShiftNo =#{shiftno}
  110. </where>
  111. </update>
  112. <select id="findShiftById" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData">
  113. SELECT * FROM calendar_datetype_shift
  114. <where>
  115. <if test="id != null and id != ''">
  116. AND id = #{id}
  117. </if>
  118. </where>
  119. </select>
  120. <select id="findByShiftno" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData">
  121. SELECT top 1 * FROM calendar_datetype_shift
  122. <where>
  123. <if test="site != null and site != ''">
  124. AND site = #{site}
  125. </if>
  126. AND DateType = #{datetype}
  127. and ShiftNo =#{shiftno}
  128. </where>
  129. </select>
  130. <insert id="saveCDS" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData">
  131. INSERT INTO calendar_datetype_shift (shiftno, datetype, site, shiftdesc, startexacttime, endexacttime,
  132. starttime, endtime)
  133. VALUES (#{shiftno}, #{datetype}, #{site}, #{shiftdesc}, #{startexacttime}, #{endexacttime}, #{starttime},
  134. #{endtime})
  135. </insert>
  136. <select id="findBySiteAndDatetype" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData">
  137. SELECT * FROM calendar_datetype_shift
  138. <where>
  139. <if test="site != null and site != ''">
  140. AND site = #{site}
  141. </if>
  142. <if test="datetype != null and datetype != ''">
  143. AND datetype = #{datetype}
  144. </if>
  145. </where>
  146. </select>
  147. <select id="findBySiteAndDatetype2" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData"
  148. resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData">
  149. SELECT * FROM calendar_datetype_shift
  150. <where>
  151. <if test="site != null and site != ''">
  152. AND site = #{site}
  153. </if>
  154. <if test="datetype != null and datetype != ''">
  155. AND datetype = #{datetype}
  156. </if>
  157. and ShiftNo != #{shiftno}
  158. </where>
  159. </select>
  160. <select id="findCDDByDatetypeAndSite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeData">
  161. SELECT datetype,site FROM Calendar_DateType
  162. <where>
  163. <if test="datetype != null and datetype != ''">
  164. AND datetype = #{datetype}
  165. </if>
  166. <if test="site != null and site != ''">
  167. AND site = #{site}
  168. </if>
  169. </where>
  170. </select>
  171. <select id="findCDDById" resultType="com.gaotao.modules.base.entity.CalendarDatetypeData">
  172. SELECT created_date,created_by,delflag FROM calendar_datetype
  173. <where>
  174. <if test="id != null and id != ''">
  175. AND id = #{id}
  176. </if>
  177. </where>
  178. </select>
  179. <insert id="saveCDD" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeData">
  180. INSERT INTO calendar_datetype (site, datetype, excepttime1, exceptduration1, excepttime2, exceptduration2,
  181. excepttime3, exceptduration3, excepttime4, exceptduration4,
  182. excepttime5, exceptduration5, excepttime6, exceptduration6, worktime, remark,
  183. exceptexacttime1, exceptexacttime2, exceptexacttime3, exceptexacttime4,
  184. exceptexacttime5, exceptexacttime6)
  185. VALUES (#{site}, #{datetype}, #{excepttime1}, #{exceptduration1}, #{excepttime2}, #{exceptduration2},
  186. #{excepttime3}, #{exceptduration3}, #{excepttime4}, #{exceptduration4},
  187. #{excepttime5}, #{exceptduration5}, #{excepttime6}, #{exceptduration6}, #{worktime}, #{remark},
  188. #{exceptexacttime1}, #{exceptexacttime2}, #{exceptexacttime3}, #{exceptexacttime4}, #{exceptexacttime5},
  189. #{exceptexacttime6})
  190. </insert>
  191. <delete id="deleteById">
  192. DELETE
  193. FROM calendar_datetype
  194. WHERE site = #{site}
  195. and datetype = #{datetype}
  196. </delete>
  197. <select id="getCalendarESByCIdAndSDate" resultType="com.gaotao.modules.base.entity.CalendarExceptionShiftData">
  198. select site,CalendarId,ScheduleDate from calendar_exception_shift
  199. <where>
  200. <if test="site != null and site != ''">
  201. AND site = #{site}
  202. </if>
  203. <if test="calendarId != null and calendarId != ''">
  204. AND CalendarId = #{calendarId}
  205. </if>
  206. <if test="scheduledate != null and scheduledate != ''">
  207. AND ScheduleDate = #{scheduledate}
  208. </if>
  209. </where>
  210. </select>
  211. <delete id="deleteCESById">
  212. DELETE
  213. FROM calendar_exception_shift
  214. WHERE site = #{site}
  215. AND CalendarId = #{calendarId}
  216. AND ScheduleDate = #{scheduledate}
  217. </delete>
  218. <insert id="saveCED" parameterType="com.gaotao.modules.base.entity.CalendarExceptionData">
  219. INSERT INTO calendar_exception ( site, CalendarID, scheduledate, excepttime1, exceptduration1, excepttime2
  220. , exceptduration2, excepttime3
  221. , exceptduration3, excepttime4, exceptduration4, excepttime5, exceptduration5
  222. , excepttime6, exceptduration6, worktime, datetype, exceptexacttime1
  223. , exceptexacttime2, exceptexacttime3, exceptexacttime4, exceptexacttime5
  224. , exceptexacttime6)
  225. VALUES (#{site}, #{calendarId}, #{scheduledate}, #{excepttime1}, #{exceptduration1}, #{excepttime2},
  226. #{exceptduration2}, #{excepttime3},
  227. #{exceptduration3}, #{excepttime4}, #{exceptduration4}, #{excepttime5}, #{exceptduration5},
  228. #{excepttime6}, #{exceptduration6}, #{worktime}, #{datetype}, #{exceptexacttime1}
  229. , #{exceptexacttime2}, #{exceptexacttime3}, #{exceptexacttime4}, #{exceptexacttime5},
  230. #{exceptexacttime6})
  231. </insert>
  232. <insert id="saveCESD" parameterType="com.gaotao.modules.base.entity.CalendarExceptionShiftInData">
  233. INSERT INTO calendar_exception_shift (site, calendarID, shiftno, scheduledate, shiftdesc, startexacttime,
  234. endexacttime,
  235. starttime, endtime)
  236. VALUES (#{site}, #{calendarId}, #{shiftno}, #{scheduledate}, #{shiftdesc}, #{startexacttime}, #{endexacttime},
  237. #{starttime}, #{endtime})
  238. </insert>
  239. <delete id="deleteCEDById">
  240. DELETE
  241. FROM calendar_exception
  242. WHERE site = #{site}
  243. and CalendarId = #{calendarId}
  244. AND scheduledate = #{scheduledate}
  245. </delete>
  246. <update id="updateCDD" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeData">
  247. UPDATE calendar_datetype set excepttime1=#{excepttime1},exceptduration1=#{exceptduration1},
  248. excepttime2=#{excepttime2},exceptduration2=#{exceptduration2},excepttime3=#{excepttime3},exceptduration3=#{exceptduration3},excepttime4=#{excepttime4},exceptduration4=#{exceptduration4},
  249. excepttime5=#{excepttime5},exceptduration5=#{exceptduration5},excepttime6=#{excepttime6},exceptduration6=#{exceptduration6},worktime=#{worktime},remark=#{remark},exceptexacttime1=#{exceptexacttime1},
  250. exceptexacttime2=#{exceptexacttime2},exceptexacttime3=#{exceptexacttime3},exceptexacttime4=#{exceptexacttime4},exceptexacttime5=#{exceptexacttime5},exceptexacttime6=#{exceptexacttime6}
  251. <where>
  252. <if test="site != null and site != ''">
  253. AND site = #{site}
  254. </if>
  255. <if test="datetype != null and datetype != ''">
  256. AND datetype = #{datetype}
  257. </if>
  258. </where>
  259. </update>
  260. <select id="getAllShiftData" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData">
  261. SELECT shiftno,shiftdesc,datetype,id FROM calendar_datetype_shift
  262. <where>
  263. AND site = #{site}
  264. </where>
  265. ORDER BY shiftno
  266. </select>
  267. <select id="findDateType" resultType="com.gaotao.modules.base.entity.CalendarExceptionData">
  268. SELECT site FROM calendar_exception
  269. <where>
  270. AND datetype = #{datetype}
  271. </where>
  272. </select>
  273. <delete id="deleteShift">
  274. DELETE
  275. FROM calendar_datetype_shift
  276. WHERE shiftno = #{shiftno}
  277. AND site = #{site}
  278. AND DateType = #{datetype}
  279. </delete>
  280. <select id="getShiftNo" resultType="int">
  281. SELECT isnull(max(convert(INT, SUBSTRING(shiftno, 3, 6))), 0)
  282. FROM calendar_datetype_shift
  283. </select>
  284. <select id="getSiteAccessFlag" resultType="java.lang.String">
  285. select dbo.Get_Site_Access_Flag(#{userId}, #{site})
  286. </select>
  287. <select id="getSiteData" resultType="com.gaotao.modules.base.entity.SiteData">
  288. Select T.* ,C.CompanyName from Site as T left join Company C ON T.CompanyID=C.CompanyID
  289. <where>
  290. <if test="companyID != null and companyID != ''">
  291. AND T.CompanyID = #{companyID}
  292. </if>
  293. <if test="companyName != null and companyName != ''">
  294. AND C.CompanyName = #{companyName}
  295. </if>
  296. </where>
  297. </select>
  298. <select id="getCompanyData" resultType="com.gaotao.modules.base.entity.CompanyData">
  299. Select CompanyID,
  300. CompanyName,
  301. Active,
  302. TaxNo,
  303. BankName,
  304. BankAccount,
  305. CutoffDate_DB,
  306. CutoffDate,
  307. CutoffDate_FixDate
  308. from Company
  309. </select>
  310. <select id="checkSiteId" resultType="com.gaotao.modules.base.entity.SiteData">
  311. select SiteName, SiteID
  312. from Site
  313. where SiteID = #{siteID}
  314. and Active = 'Y'
  315. </select>
  316. <select id="checkCal" resultType="com.gaotao.modules.base.entity.CalendarData">
  317. select calendarID
  318. from calendar
  319. where Site = #{site}
  320. and status = '使用中'
  321. and calendarID = #{calendarID}
  322. </select>
  323. <select id="checkResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  324. select site
  325. from WorkCenterResource
  326. where Site = #{site}
  327. and ResourceID = #{resourceID}
  328. </select>
  329. <insert id="saveResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  330. INSERT INTO WorkCenterResource (Site, WorkCenterNo, ResourceID, ResourceDesc, Efficiency, Utilization, Active,
  331. Remark, CreatedDate, CalendarID, VirturlFlag)
  332. VALUES (#{site}, #{workCenterNo}, #{resourceID}, #{resourceDesc}, #{efficiency}, #{utilization}, #{active},
  333. #{remark}, GetDate(), #{calendarID}, 'N')
  334. </insert>
  335. <update id="editResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  336. update WorkCenterResource
  337. SET ResourceDesc=#{resourceDesc},
  338. Efficiency=#{efficiency},
  339. Utilization=#{utilization},
  340. Active=#{active},
  341. Remark=#{remark},
  342. CalendarID=#{calendarID}
  343. where Site = #{site}
  344. and ResourceID = #{resourceID}
  345. </update>
  346. <insert id="saveSite" parameterType="com.gaotao.modules.base.entity.SiteData">
  347. INSERT INTO Site (SiteID, SiteName, SiteName_E, Address, Address_E, ContactName, PostCode, Email, FaxNo,
  348. PhoneNo, Active, Website, CompanyID, ShipTime,
  349. ReferenceCustomerID)
  350. VALUES (#{siteID}, #{siteName}, #{siteNameE}, #{address}, #{addressE}, #{contactName}, #{postCode}, #{email},
  351. #{faxNo}, #{phoneNo}, #{active},
  352. #{website}, #{companyID}, #{shipTime}, #{referenceCustomerID})
  353. </insert>
  354. <update id="editSite" parameterType="com.gaotao.modules.base.entity.SiteData">
  355. update Site
  356. SET SiteName=#{siteName},
  357. SiteName_E=#{siteNameE},
  358. Address=#{address},
  359. Address_E=#{addressE},
  360. ContactName=#{contactName},
  361. PostCode=#{postCode},
  362. Email=#{email},
  363. FaxNo=#{faxNo},
  364. PhoneNo=#{phoneNo},
  365. Active=#{active},
  366. Website=#{website},
  367. CompanyID=#{companyID},
  368. ShipTime=#{shipTime},
  369. ReferenceCustomerID=#{referenceCustomerID}
  370. where SiteID = #{siteID}
  371. </update>
  372. <select id="getPartFamily" resultType="com.gaotao.modules.base.entity.PartFamilyData">
  373. Select T.FamilyID,
  374. T.Site,
  375. T.FamilyName,
  376. T.CostType,
  377. T.CostTypeDesc,
  378. T.Active,
  379. T.BatchCreatedMethod,
  380. T.CheckPercentage,
  381. T.InspectFlag
  382. from PartFamily as T
  383. where T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
  384. </select>
  385. <select id="getPartFamilyInfo" resultType="com.gaotao.modules.base.entity.PartFamilyData">
  386. Select T.FamilyID,
  387. T.Site,
  388. T.FamilyName,
  389. T.CostType,
  390. T.CostTypeDesc,
  391. T.Active,
  392. T.BatchCreatedMethod,
  393. T.CheckPercentage,
  394. T.InspectFlag
  395. from PartFamily as T
  396. where T.Site = #{site}
  397. and T.FamilyID = #{familyID}
  398. </select>
  399. <select id="checkAccessSite" resultType="com.gaotao.modules.base.entity.AccessSiteData">
  400. Select UserID, Site
  401. from AccessSite
  402. where UserID = #{userID}
  403. and Site = #{site}
  404. </select>
  405. <select id="checkFamilyID" resultType="com.gaotao.modules.base.entity.PartFamilyData">
  406. select FamilyID, FamilyName
  407. from PartFamily
  408. where FamilyID = #{familyID}
  409. and Site = #{site}
  410. </select>
  411. <insert id="savePartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData">
  412. INSERT INTO PartFamily (FamilyID, Site, FamilyName, Active, CheckPercentage, InspectFlag)
  413. values (#{familyID}, #{site}, #{familyName}, #{active}, #{checkPercentage}, #{inspectFlag})
  414. </insert>
  415. <update id="editPartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData">
  416. UPDATE PartFamily
  417. SET Site=#{site},
  418. FamilyName=#{familyName},
  419. Active=#{active},
  420. CheckPercentage=#{checkPercentage},
  421. InspectFlag=#{inspectFlag}
  422. where FamilyID = #{familyID}
  423. and Site = #{site}
  424. </update>
  425. <delete id="deletePartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData">
  426. delete
  427. from PartFamily
  428. where FamilyID = #{familyID}
  429. and Site = #{site}
  430. </delete>
  431. <!-- 计量单位 -->
  432. <select id="getUMData" resultType="com.gaotao.modules.base.entity.UmData">
  433. Select T.UMID, T.Site, T.UMName, T.Active
  434. from UM as T
  435. where T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
  436. </select>
  437. <select id="checkUmID" resultType="com.gaotao.modules.base.entity.UmData">
  438. select UMID, UMName
  439. from UM
  440. where UMID = #{umid}
  441. and Site = #{site}
  442. </select>
  443. <insert id="saveUMData" parameterType="com.gaotao.modules.base.entity.UmData">
  444. INSERT INTO UM (UMID, Site, UMName, Active)
  445. values (#{umid}, #{site}, #{uMName}, #{active})
  446. </insert>
  447. <update id="editUMData" parameterType="com.gaotao.modules.base.entity.UmData">
  448. UPDATE UM
  449. SET Site=#{site},
  450. UMName=#{uMName},
  451. Active=#{active}
  452. where UMID = #{umid}
  453. and Site = #{site}
  454. </update>
  455. <select id="checkUmIDInPart" resultType="com.gaotao.modules.base.entity.PartData">
  456. SELECT PartNo, PartDescription
  457. FROM Part
  458. where Site = #{site}
  459. and UMID = #{umid}
  460. </select>
  461. <delete id="deleteUMData" parameterType="com.gaotao.modules.base.entity.UmData">
  462. delete
  463. from UM
  464. where UMID = #{umid}
  465. and Site = #{site}
  466. </delete>
  467. <!-- 查询-物料编码 -->
  468. <select id="searchPartNoData" resultType="com.gaotao.modules.base.entity.PartData">
  469. Select T.PartNo,T.Site,T.PartDescription,T.Spec,T.UMID,T.Active,T.CreateDate,T.Remark,T.ConfigurationTemplateID
  470. from Part as T
  471. <where>
  472. AND T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
  473. <if test=" site != null and site != ''">
  474. AND T.Site = #{site}
  475. </if>
  476. <if test="partNo != null and partNo != ''">
  477. AND T.PartNo LIKE #{partNo}
  478. </if>
  479. <if test="partDescription != null and partDescription != ''">
  480. AND T.PartDescription LIKE #{partDescription}
  481. </if>
  482. <if test="spec != null and spec != ''">
  483. AND T.Spec LIKE #{spec}
  484. </if>
  485. <if test="active != null and active != ''">
  486. AND T.Active = #{active}
  487. </if>
  488. <if test=" date1 != null ">
  489. AND T.CreateDate >= #{date1}
  490. </if>
  491. <if test=" date2 != null ">
  492. AND #{date2} >=T.CreateDate
  493. </if>
  494. </where>
  495. </select>
  496. <select id="searchPartNoDataWithPage" resultType="com.gaotao.modules.base.entity.PartData">
  497. Select T.PartNo,T.Site,T.PartDescription,T.Spec,T.UMID,T.Active,T.CreateDate,T.Remark,T.ConfigurationTemplateID
  498. from Part as T
  499. <where>
  500. AND T.Site in (Select Site from AccessSite where upper(UserID)=#{query.user})
  501. <if test=" query.site != null and query.site != ''">
  502. AND T.Site = #{query.site}
  503. </if>
  504. <if test="query.partNo != null and query.partNo != ''">
  505. AND T.PartNo LIKE #{query.partNo}
  506. </if>
  507. <if test="query.partDescription != null and query.partDescription != ''">
  508. AND T.PartDescription LIKE #{query.partDescription}
  509. </if>
  510. <if test="query.spec != null and query.spec != ''">
  511. AND T.Spec LIKE #{query.spec}
  512. </if>
  513. <if test="query.active != null and query.active != ''">
  514. AND T.Active = #{query.active}
  515. </if>
  516. <if test=" query.date1 != null ">
  517. AND T.CreateDate >= #{query.date1}
  518. </if>
  519. <if test=" query.date2 != null ">
  520. AND dateadd( DAY, 1, #{query.date2} ) >T.CreateDate
  521. </if>
  522. </where>
  523. </select>
  524. <!-- 停机原因 -->
  525. <select id="getShutDownReasonData" resultType="com.gaotao.modules.base.entity.DowntimeReasonData">
  526. Select Site, ReasonCode, Area, ReasonDescription, Active
  527. from DowntimeReason as T
  528. where T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
  529. </select>
  530. <select id="checkRasonCode" resultType="com.gaotao.modules.base.entity.DowntimeReasonData">
  531. select ReasonCode, ReasonDescription
  532. from DowntimeReason
  533. where ReasonCode = #{reasonCode}
  534. and Site = #{site}
  535. </select>
  536. <insert id="saveShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  537. INSERT INTO DowntimeReason (Site, ReasonCode, Area, ReasonDescription, Active)
  538. values (#{site}, #{reasonCode}, #{area}, #{reasonDescription}, #{active})
  539. </insert>
  540. <update id="editShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  541. UPDATE DowntimeReason
  542. SET Active=#{active},
  543. Area=#{area},
  544. ReasonDescription=#{reasonDescription}
  545. where ReasonCode = #{reasonCode}
  546. and Site = #{site}
  547. </update>
  548. <delete id="deleteShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  549. delete
  550. from DowntimeReason
  551. where ReasonCode = #{reasonCode}
  552. and Site = #{site}
  553. </delete>
  554. <!-- 物料参照信息 -->
  555. <select id="getReferencePartInfoData" resultType="com.gaotao.modules.base.entity.ReferencePartInfoData">
  556. SELECT T.Site,
  557. T.CustomerID,
  558. T.FGPartNo,
  559. T.PartNo,
  560. T.ReferencePartDesc,
  561. T.LastUpdateBy,
  562. T.Remark,
  563. T.SupplierID,
  564. P.PartDescription,
  565. P2.PartDescription AS fGPartDescription,
  566. p.umid,
  567. S.SupplierName
  568. FROM ReferencePartInfo AS T
  569. LEFT JOIN Part AS P ON T.Site = P.Site AND T.PartNo = P.PartNo
  570. LEFT JOIN Part AS P2 ON T.Site = P2.Site AND T.FGPartNo = P2.PartNo
  571. LEFT JOIN Supplier AS S ON S.SupplierID = T.SupplierID and S.Site = T.Site
  572. WHERE T.Site IN (SELECT Site
  573. FROM AccessSite
  574. WHERE UPPER(UserID) = #{user})
  575. </select>
  576. <select id="getPartNoDetail" resultType="com.gaotao.modules.base.entity.PartData">
  577. select partDescription, umid, spec, PartType_DB, MRPCode
  578. from Part
  579. Where Site = #{site}
  580. and PartNo = #{partNo}
  581. and Active = 'Y'
  582. </select>
  583. <select id="getSupplierDetail" resultType="com.gaotao.modules.base.entity.SupplierData">
  584. select SupplierID, SupplierName
  585. from Supplier
  586. Where Site = #{site}
  587. and SupplierID = #{supplierID}
  588. and Active = 'Y'
  589. </select>
  590. <select id="checkReferencePartInfo" resultType="com.gaotao.modules.base.entity.ReferencePartInfoData">
  591. select Site, PartNo
  592. from ReferencePartInfo
  593. where CustomerID = #{customerID}
  594. and Site = #{site}
  595. and FGPartNo = #{fGPartNo}
  596. and PartNo = #{partNo}
  597. </select>
  598. <insert id="saveReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  599. INSERT INTO ReferencePartInfo (Site, CustomerID, PartNo, ReferencePartDesc, SupplierID, FGPartNo, LastUpdateBy)
  600. values (#{site}, #{customerID}, #{partNo}, #{referencePartDesc}, #{supplierID}, #{fGPartNo}, #{user})
  601. </insert>
  602. <update id="editReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  603. UPDATE ReferencePartInfo
  604. SET Site=#{site},
  605. CustomerID=#{customerID},
  606. PartNo=#{partNo},
  607. ReferencePartDesc=#{referencePartDesc},
  608. SupplierID=#{supplierID},
  609. FGPartNo=#{fGPartNo},
  610. LastUpdateBy=#{user}
  611. where CustomerID = #{customerID}
  612. and Site = #{site}
  613. and FGPartNo = #{fGPartNo}
  614. and PartNo = #{partNo}
  615. </update>
  616. <delete id="deleteReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData">
  617. delete
  618. from ReferencePartInfo
  619. where CustomerID = #{customerID}
  620. and Site = #{site}
  621. and FGPartNo = #{fGPartNo}
  622. and PartNo = #{partNo}
  623. </delete>
  624. <!-- 生产线 -->
  625. <select id="getProductionLineData" resultType="com.gaotao.modules.base.entity.ProductionLineData">
  626. Select T.Site, T.ProLineNo, T.ProLineDesc, T.Active, T.CreatedDate
  627. from ProductionLine as T
  628. where T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
  629. </select>
  630. <select id="checkProLineNo" resultType="com.gaotao.modules.base.entity.ProductionLineData">
  631. select ProLineNo, ProLineDesc
  632. from ProductionLine
  633. where ProLineNo = #{proLineNo}
  634. and Site = #{site}
  635. </select>
  636. <insert id="saveProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData">
  637. INSERT INTO ProductionLine (Site, ProLineNo, ProLineDesc, Active, CreatedDate)
  638. values (#{site}, #{proLineNo}, #{proLineDesc}, #{active}, #{createdDate})
  639. </insert>
  640. <update id="editProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData">
  641. UPDATE ProductionLine
  642. SET ProLineDesc=#{proLineDesc},
  643. Active=#{active},
  644. CreatedDate=#{createdDate}
  645. where ProLineNo = #{proLineNo}
  646. and Site = #{site}
  647. </update>
  648. <delete id="deleteProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData">
  649. delete
  650. from ProductionLine
  651. where ProLineNo = #{proLineNo}
  652. and Site = #{site}
  653. </delete>
  654. <!-- 加工中心 -->
  655. <select id="getWorkCenterData" resultType="com.gaotao.modules.base.entity.WorkCenterData">
  656. Select T.* ,P.ProLineDesc as ProductionLineDesc
  657. from WorkCenter as T
  658. LEFT JOIN ProductionLine P ON P.Site=T.Site and T.ProLineNo=P.ProLineNo
  659. <where>
  660. AND T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
  661. <if test=" site != null and site != ''">
  662. and T.Site like #{site}
  663. </if>
  664. <if test=" workCenterNo != null and workCenterNo != ''">
  665. and T.workCenterNo like #{workCenterNo}
  666. </if>
  667. </where>
  668. </select>
  669. <select id="getWorkCenterResourceData" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  670. Select T.*
  671. from WorkCenterResource as T
  672. where T.Site = #{site}
  673. and T.WorkCenterNo = #{workCenterNo}
  674. </select>
  675. <select id="getProductInWorkCenterData" resultType="com.gaotao.modules.base.entity.ProductInWorkCenterData">
  676. Select T.Site,
  677. T.PartNo,
  678. T.RevNo,
  679. D.ItemNo,
  680. D.OperationDesc,
  681. D.MachSetuptime,
  682. D.MachRunFactor,
  683. D.FactorUnit,
  684. D.Crewsize,
  685. D.Efficiency,
  686. D.Remark,
  687. T.Status,
  688. T.RoutingType
  689. from RoutingHeader as T,
  690. RoutingDetail as D
  691. Where T.Site = D.Site
  692. and T.PartNo = D.PartNo
  693. and T.RevNo = D.RevNo
  694. and T.Site = #{site}
  695. and D.WorkCenterNo = #{workCenterNo}
  696. </select>
  697. <select id="getProLineNoDetail" resultType="com.gaotao.modules.base.entity.ProductionLineData">
  698. Select *
  699. FROM ProductionLine
  700. where Site = #{site}
  701. and ProLineNo = #{proLineNo}
  702. </select>
  703. <select id="checkWorkCenter" resultType="com.gaotao.modules.base.entity.WorkCenterData">
  704. select WorkCenterNo, WorkCenterDesc
  705. from WorkCenter
  706. where WorkCenterNo = #{workCenterNo}
  707. and Site = #{site}
  708. </select>
  709. <insert id="saveWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData">
  710. INSERT INTO WorkCenter (Site, WorkCenterNo, WorkCenterDesc, WorkCenterType_DB, WorkCenterType, AverageCapacity,
  711. Efficiency, Utilization, CapacityType_DB,
  712. CapacityType, UMID, Active, Remark, CreatedDate, ProLineNo, CanCreateNewRollFlag,
  713. NeedSetupFlag)
  714. values (#{site}, #{workCenterNo}, #{workCenterDesc}, #{workCenterTypeDb}, #{workCenterType}, 0, 100, 100, 'I',
  715. '无限能力',
  716. #{umid}, #{active}, #{remark}, #{createdDate}, #{proLineNo}, #{canCreateNewRollFlag}, #{needSetupFlag})
  717. </insert>
  718. <update id="editWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData">
  719. UPDATE WorkCenter
  720. SET WorkCenterDesc=#{workCenterDesc},
  721. Active=#{active},
  722. WorkCenterType=#{workCenterNo},
  723. WorkCenterType_DB=#{workCenterTypeDb},
  724. Remark=#{remark},
  725. CreatedDate=#{createdDate},
  726. ProLineNo=#{proLineNo},
  727. CanCreateNewRollFlag=#{canCreateNewRollFlag},
  728. NeedSetupFlag=#{needSetupFlag}
  729. where WorkCenterNo = #{workCenterNo}
  730. and Site = #{site}
  731. </update>
  732. <delete id="deleteWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData">
  733. delete
  734. from WorkCenter
  735. where WorkCenterNo = #{workCenterNo}
  736. and Site = #{site}
  737. </delete>
  738. <delete id="deleteResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  739. delete
  740. from WorkCenterResource
  741. where ResourceID = #{resourceID}
  742. and Site = #{site}
  743. </delete>
  744. <update id="setResourceFlag" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  745. UPDATE WorkCenterResource
  746. SET VirturlFlag=#{virturlFlag}
  747. where ResourceID = #{resourceID}
  748. and Site = #{site}
  749. </update>
  750. <select id="checkCustomerID" resultType="com.gaotao.modules.base.entity.PartData">
  751. select PartNo, ConfigurationTemplateID
  752. from Part
  753. WHERE site = #{site}
  754. and ConfigurationTemplateID = #{configurationTemplateID}
  755. </select>
  756. <select id="getCompanyInformation" resultType="com.gaotao.modules.base.entity.CompanyData">
  757. Select * from Company
  758. <where>
  759. <if test="companyID != null and companyID != ''">
  760. AND companyID LIKE #{companyID}
  761. </if>
  762. <if test="companyName != null and companyName != ''">
  763. AND companyName LIKE #{companyName}
  764. </if>
  765. <if test="active != null and active != ''">
  766. AND Active = #{active}
  767. </if>
  768. </where>
  769. </select>
  770. <select id="checkCompanyInformation" resultType="com.gaotao.modules.base.entity.CompanyData">
  771. select companyID, companyName
  772. FROM Company
  773. WHERE companyID = #{companyID}
  774. </select>
  775. <insert id="saveCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData">
  776. INSERT INTO Company (CompanyID, CompanyName, Active, TaxNo, BankName, BankAccount, CutoffDate_DB, CutoffDate,
  777. CutoffDate_FixDate)
  778. values (#{companyID}, #{companyName}, #{active}, #{taxNo}, #{bankName}, #{bankAccount}, #{cutoffDateDb},
  779. #{cutoffDate}, #{cutoffDateFixDate})
  780. </insert>
  781. <update id="editCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData">
  782. UPDATE Company
  783. SET CompanyName=#{companyName},
  784. CutoffDate_DB=#{cutoffDateDb},
  785. Active=#{active},
  786. TaxNo=#{taxNo},
  787. BankName=#{bankName},
  788. BankAccount=#{bankAccount},
  789. CutoffDate=#{cutoffDate},
  790. CutoffDate_FixDate=#{cutoffDateFixDate}
  791. where CompanyID = #{companyID}
  792. </update>
  793. <delete id="deleteCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData">
  794. delete
  795. from Company
  796. where CompanyID = #{companyID}
  797. </delete>
  798. <select id="getPartFamilyList" resultType="com.gaotao.modules.base.entity.PartFamilyData">
  799. select A.FamilyID,A.Site,A.FamilyName,A.CostType,A.CostTypeDesc,A.Active,A.BatchCreatedMethod,A.CheckPercentage
  800. from PartFamily A
  801. <where>
  802. <if test="site != null and site != ''">
  803. and A.site = #{site,jdbcType=VARCHAR}
  804. </if>
  805. <if test="familyID != null and familyID != ''">
  806. and A.FamilyID = #{familyID,jdbcType=VARCHAR}
  807. </if>
  808. <if test="familyName != null and familyName != ''">
  809. and A.FamilyName = #{familyName,jdbcType=VARCHAR}
  810. </if>
  811. <if test="active != null and active != ''">
  812. and A.Active = #{active,jdbcType=VARCHAR}
  813. </if>
  814. </where>
  815. </select>
  816. <select id="checkConfigurationTemplateID" resultType="com.gaotao.modules.base.entity.PartData">
  817. Select ConfigurationTemplateID
  818. from Part
  819. where ConfigurationTemplateID = #{configurationTemplateID}
  820. and site = #{site}
  821. </select>
  822. <select id="checkCompanyInSite" resultType="com.gaotao.modules.base.entity.SiteData">
  823. Select SiteID
  824. from site
  825. where CompanyID = #{companyID}
  826. </select>
  827. <!--=================维护工艺路线信息===================-->
  828. <select id="searchRoutingWithPartNo" resultType="com.gaotao.modules.base.entity.RoutingHeaderData">
  829. Select top 1000
  830. r.Site,r.PartNo,r.RevNo,r.PhaseInDate,r.PhaseOutDate,r.RoutingType_DB,r.RoutingType,r.Status,r.Status_DB,
  831. r.Defaultflag,r.Remark,r.RepairFlag,p.PartDescription+' / '+isnull(p.Spec,'') as spec,p.umid
  832. from RoutingHeader r
  833. LEFT JOIN Part p on p.partNo=r.partNo and p.site=r.site
  834. <where>
  835. <if test="partNo != null and partNo != ''">
  836. and r.partNo like #{partNo}
  837. </if>
  838. <if test="site != null and site != ''">
  839. and r.site = #{site}
  840. </if>
  841. <if test="revNo != null and revNo != ''">
  842. and r.revNo = #{revNo}
  843. </if>
  844. </where>
  845. </select>
  846. <select id="searchRoutingDetailData" resultType="com.gaotao.modules.base.entity.RoutingDetailData">
  847. Select
  848. Site,PartNo,RevNo,ItemNo,OperationDesc,WorkCenterNo,MachSetupTime,MachRunFactor,FactorUnit_DB,FactorUnit,Efficiency,
  849. Crewsize,JJGZ_UnitFactor_DB,JJGZ_UnitFactor,JJGZ_UnitPrice,Remark,WX_PartNo,WX_UnitCost,BatchQty,dbo.Get_Part_DescSpec(Site,PartNo)
  850. as spec,
  851. dbo.Get_Part_DescSpec(site,WX_PartNo) as wxSpec,dbo.Get_WorkCenter_Type(Site,WorkCenterNo) as workCenterType
  852. ,dbo.Get_WorkCenterDesc(Site,WorkCenterNo) as workCenterDesc
  853. from RoutingDetail
  854. <where>
  855. <if test="partNo != null and partNo != ''">
  856. and partNo like #{partNo}
  857. </if>
  858. <if test="site != null and site != ''">
  859. and site = #{site}
  860. </if>
  861. <if test="revNo != null and revNo != ''">
  862. and revNo = #{revNo}
  863. </if>
  864. </where>
  865. order by ItemNo
  866. </select>
  867. <select id="checkRoutingItemNo" resultType="com.gaotao.modules.base.entity.RoutingDetailData">
  868. Select ItemNo from RoutingDetail
  869. <where>
  870. <if test="partNo != null and partNo != ''">
  871. and partNo like #{partNo}
  872. </if>
  873. <if test="site != null and site != ''">
  874. and site = #{site}
  875. </if>
  876. <if test="revNo != null and revNo != ''">
  877. and revNo = #{revNo}
  878. </if>
  879. <if test="itemNo != null and itemNo != ''">
  880. and ItemNo = #{itemNo}
  881. </if>
  882. </where>
  883. </select>
  884. <insert id="saveRoutingDetailData" parameterType="com.gaotao.modules.base.entity.RoutingDetailData">
  885. insert into RoutingDetail (Site, PartNo, RevNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime,
  886. MachRunFactor, FactorUnit_DB, FactorUnit, Efficiency,
  887. Crewsize, JJGZ_UnitFactor_DB, JJGZ_UnitFactor, JJGZ_UnitPrice, Remark, WX_UnitCost,
  888. BatchQty)
  889. VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{operationDesc}, #{workCenterNo}, #{machSetupTime},
  890. #{machRunFactor}, #{factorUnitDb}, #{factorUnit}, #{efficiency},
  891. #{crewsize}, #{jjgzUnitFactorDb}, #{jjgzUnitFactor}, #{jjgzUnitPrice}, #{remark}, 0, 0)
  892. </insert>
  893. <update id="editRoutingDetailData" parameterType="com.gaotao.modules.base.entity.RoutingDetailData">
  894. UPDATE RoutingDetail
  895. <set>
  896. OperationDesc=#{operationDesc},
  897. WorkCenterNo=#{workCenterNo},
  898. MachSetupTime=#{machSetupTime},
  899. MachRunFactor=#{machRunFactor},
  900. FactorUnit_DB=#{factorUnitDb},
  901. FactorUnit=#{factorUnit},
  902. Efficiency=#{efficiency},
  903. Crewsize=#{crewsize},
  904. JJGZ_UnitFactor_DB=#{jjgzUnitFactorDb},
  905. JJGZ_UnitFactor=#{jjgzUnitFactor},
  906. <if test="jjgzUnitPrice!=null">
  907. JJGZ_UnitPrice=#{jjgzUnitPrice},
  908. </if>
  909. Remark=#{remark}
  910. </set>
  911. WHERE partNo = #{partNo}
  912. and site = #{site}
  913. and revNo = #{revNo}
  914. and ItemNo = #{itemNo}
  915. </update>
  916. <delete id="deleteRoutingDetail" parameterType="com.gaotao.modules.base.entity.RoutingDetailData">
  917. delete
  918. from RoutingDetail
  919. where site = #{site}
  920. and PartNo = #{partNo}
  921. and RevNo = #{revNo}
  922. and ItemNo = #{itemNo}
  923. </delete>
  924. <select id="searchRoutingToolData" resultType="com.gaotao.modules.base.entity.RoutingToolData">
  925. Select T.Site,T.RevNo,T.ItemNo,T.ToolID,P.ToolDescription,P.Spec
  926. ,T.ToolQty,P.FamilyID,dbo.Get_PartFamilyDesc(T.Site,P.FamilyID) as FamilyName,P.Active
  927. ,T.Remark,T.CreateDate,T.CreatedBy
  928. from RoutingTool as T,ToolHeader as P
  929. <where>
  930. <if test="toolID != null and toolID != ''">
  931. and T.ToolID = #{toolID}
  932. </if>
  933. <if test="newToolId != null and newToolId != ''">
  934. and T.ToolID = #{newToolId}
  935. </if>
  936. <if test="itemNo != null and itemNo != ''">
  937. and T.ItemNo = #{itemNo}
  938. </if>
  939. and T.Site=P.Site and T.ToolID=P.ToolID
  940. and T.PartNo=#{partNo}
  941. and T.Site=#{site} and T.RevNo=#{revNo}
  942. </where>
  943. </select>
  944. <select id="searchAllResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  945. Select Site, WorkCenterNo, ResourceID, ResourceDesc, Active
  946. from WorkCenterResource
  947. where site = #{site}
  948. and WorkCenterNo = #{workCenterNo}
  949. and Active = 'Y'
  950. </select>
  951. <select id="searchUsedResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData">
  952. SELECT R.ResourceID, W.ResourceDesc, W.Active
  953. FROM RoutingDetail_AvailableResource R
  954. LEFT JOIN WorkCenterResource W on W.ResourceID = R.ResourceID and R.Site = W.Site
  955. where R.site = #{site}
  956. and R.PartNo = #{partNo}
  957. and R.revNo = #{revNo}
  958. and R.itemNo = #{itemNo}
  959. </select>
  960. <select id="checkRoutingResource" resultType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData">
  961. SELECT site, ResourceID
  962. FROM RoutingDetail_AvailableResource
  963. where site = #{site}
  964. and PartNo = #{partNo}
  965. and revNo = #{revNo}
  966. and itemNo = #{itemNo}
  967. and ResourceID = #{resourceID}
  968. </select>
  969. <insert id="addRoutingResource" parameterType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData">
  970. INSERT INTO RoutingDetail_AvailableResource(Site, PartNo, RevNo, ItemNo, ResourceID)
  971. VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{resourceID})
  972. </insert>
  973. <delete id="deleteRoutingResource"
  974. parameterType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData">
  975. delete
  976. from RoutingDetail_AvailableResource
  977. where site = #{site}
  978. and PartNo = #{partNo}
  979. and revNo = #{revNo}
  980. and itemNo = #{itemNo}
  981. and ResourceID = #{resourceID}
  982. </delete>
  983. <select id="getItemSelect" resultType="com.gaotao.modules.base.entity.RoutingDetailData">
  984. SELECT ItemNo,OperationDesc from RoutingDetail
  985. <where>
  986. and partNo = #{partNo}
  987. and site = #{site}
  988. and revNo = #{revNo}
  989. <if test="itemNo != null and itemNo != ''">
  990. and ItemNo = #{itemNo}
  991. </if>
  992. </where>
  993. </select>
  994. <select id="getToolDesc" resultType="com.gaotao.modules.base.entity.ToolHeaderData">
  995. SELECT toolID, ToolDescription, Spec
  996. FROM ToolHeader
  997. WHERE site = #{site}
  998. and toolID = #{toolID}
  999. </select>
  1000. <select id="checkToolHeader" resultType="com.gaotao.modules.base.entity.ToolHeaderData">
  1001. SELECT toolID, ToolDescription, Spec
  1002. FROM ToolHeader
  1003. WHERE site = #{site}
  1004. and toolID = #{toolID}
  1005. </select>
  1006. <insert id="saveRoutingToolData" parameterType="com.gaotao.modules.base.entity.RoutingToolData">
  1007. INSERT INTO RoutingTool(Site, PartNo, RevNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy)
  1008. VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{newToolId}, #{toolQty}, #{remark}, GETDATE(), #{user})
  1009. </insert>
  1010. <update id="editRoutingToolData" parameterType="com.gaotao.modules.base.entity.RoutingToolData">
  1011. update RoutingTool
  1012. SET ToolQty=#{toolQty},
  1013. Remark=#{remark},
  1014. ToolID = #{newToolId}
  1015. WHERE Site = #{site}
  1016. and PartNo = #{partNo}
  1017. and ToolID = #{toolID}
  1018. and RevNo = #{revNo}
  1019. and ItemNo = #{itemNo}
  1020. </update>
  1021. <delete id="deleteRoutingTool" parameterType="com.gaotao.modules.base.entity.RoutingToolData">
  1022. delete
  1023. from RoutingTool
  1024. WHERE Site = #{site}
  1025. and PartNo = #{partNo}
  1026. and ToolID = #{toolID}
  1027. and RevNo = #{revNo}
  1028. and ItemNo = #{itemNo}
  1029. </delete>
  1030. <update id="changeRoutingStatus" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1031. update RoutingHeader
  1032. SET status=#{status},
  1033. status_DB=#{statusDb},
  1034. PhaseOutDate=#{phaseOutDate}
  1035. where Site = #{site}
  1036. and PartNo = #{partNo}
  1037. and RevNo = #{revNo}
  1038. </update>
  1039. <select id="checkRoutingStatus" resultType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1040. Select top 1 Status
  1041. from RoutingHeader
  1042. where Site = #{site}
  1043. and PartNo = #{partNo}
  1044. and RevNo = #{revNo}
  1045. </select>
  1046. <select id="shopOrderRoutingNumber" resultType="int">
  1047. Select count(1) as SL
  1048. from ShopOrder as T
  1049. where Site = #{site}
  1050. and PartNo = #{partNo}
  1051. and (Status = '已计划' or Status = '已下达')
  1052. and Not exists(Select 1 from SOScheduledRouting as D Where T.Site = D.Site and T.OrderNo = D.OrderNo)
  1053. and T.OrderType != 'P'
  1054. </select>
  1055. <insert id="saveRoutingChangeCach">
  1056. Select Site, OrderNo, LotSize
  1057. into ${tableName}
  1058. from ShopOrder as T
  1059. where Site = #{site}
  1060. and PartNo = #{partNo}
  1061. and (Status = '已计划' or Status = '已下达')
  1062. and Not exists(Select 1 from SOScheduledRouting as D Where T.Site = D.Site and T.OrderNo = D.OrderNo)
  1063. and T.OrderType != 'P'
  1064. </insert>
  1065. <update id="updateOrderRevNo">
  1066. Update ShopOrder
  1067. Set RoutingRevNo=#{revNo}
  1068. from ${tableName} as T
  1069. where ShopOrder.Site = T.Site
  1070. and ShopOrder.OrderNo = T.OrderNo
  1071. </update>
  1072. <delete id="deleteNowItemNo">
  1073. Delete SORouting
  1074. from ${tableName} as T
  1075. where SORouting.Site = T.Site
  1076. and SORouting.OrderNo = T.OrderNo
  1077. </delete>
  1078. <delete id="deleteNowToolNo">
  1079. Delete SOTool
  1080. from ${tableName} as T
  1081. where SOTool.Site = T.Site
  1082. and SOTool.OrderNo = T.OrderNo
  1083. </delete>
  1084. <insert id="saveNewItemNo">
  1085. Insert into SORouting( Site, OrderNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor
  1086. , FactorUnit_DB, FactorUnit, TimeRequired, TimeReported, Efficiency, Remark, QtyRequired
  1087. , QtyReported, QtyApprove
  1088. , PlanStartTime, PlanFinishTime, BarcodeID, PartNo, ClosedFlag, OutWorkFlag, OutWorkPartNo
  1089. , QtyOnPR, QtyOnPO, QtyScrapt, Crewsize
  1090. , PreItemNo, NextItemNo, ScheduledFlag, QtyScheduled)
  1091. Select T.Site
  1092. , D.OrderNo
  1093. , ItemNo
  1094. , OperationDesc
  1095. , WorkCenterNo
  1096. , MachSetupTime
  1097. , MachRunFactor
  1098. , FactorUnit_DB
  1099. , FactorUnit
  1100. , (MachSetupTime + (Case
  1101. when MachRunFactor = 0 then 0
  1102. else (Case
  1103. when FactorUnit_DB = '1' then D.LotSize / MachRunFactor
  1104. when FactorUnit_DB = '2' then D.LotSize * MachRunFactor
  1105. when FactorUnit_DB = '3' then MachRunFactor end) end) /
  1106. (Efficiency / 100)) as TimeRequired
  1107. , 0
  1108. , Efficiency
  1109. , Remark
  1110. , D.LotSize
  1111. , 0
  1112. , 0
  1113. , 0
  1114. , 0
  1115. , (Case
  1116. when len(OrderNo) > 10 then D.Site + '-' + D.OrderNo + '-' + dbo.Get_PadL(ItemNo, 4, '0')
  1117. else D.Site + '-' + dbo.Get_PadL(D.OrderNo, 10, '0') + '-' + dbo.Get_PadL(ItemNo, 4, '0') end)
  1118. , T.PartNo
  1119. , 'N'
  1120. , (Case when dbo.Get_WorkCenter_TypeDB(T.Site, WorkCenterNo) = 'O' then 'Y' else 'N' end) as OutWorkFlag
  1121. , WX_PartNo as OutWorkPartNo
  1122. , 0.0 as QtyOnPR
  1123. , 0.0 as QtyOnPO
  1124. , 0.0 as QtyScrapt
  1125. , Crewsize
  1126. , Isnull((Select Max(D.ItemNo) as PreItemNo
  1127. from RoutingDetail as D
  1128. Where D.Site = T.Site
  1129. and D.PartNo = T.PartNo
  1130. and D.RevNo = T.RevNo
  1131. and T.ItemNo > D.ItemNo), 0)
  1132. , Isnull((Select Min(D.ItemNo) as NextItemNo
  1133. from RoutingDetail as D
  1134. Where D.Site = T.Site
  1135. and D.PartNo = T.PartNo
  1136. and D.RevNo = T.RevNo
  1137. and D.ItemNo > T.ItemNo), 0)
  1138. , 'N'
  1139. , 0
  1140. from RoutingDetail as T,
  1141. ${tableName} as D
  1142. Where D.Site = T.Site
  1143. and T.site = #{site}
  1144. and T.PartNo = #{partNo}
  1145. and T.RevNo = #{revNo}
  1146. </insert>
  1147. <insert id="saveNewTool">
  1148. Insert into SOTool(Site, OrderNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy)
  1149. Select T.Site,
  1150. D.OrderNo,
  1151. ItemNo,
  1152. ToolID,
  1153. ToolQty,
  1154. Remark,
  1155. getdate(),
  1156. #{user}
  1157. from RoutingTool as T,
  1158. ${tableName} as D
  1159. Where D.Site = T.Site
  1160. and T.site = #{site}
  1161. and T.PartNo = #{partNo}
  1162. and T.RevNo = #{revNo}
  1163. </insert>
  1164. <delete id="deleteRoutingChangeCach">
  1165. Drop table ${tableName}
  1166. </delete>
  1167. <select id="checkRoutingRevNo" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData"
  1168. resultType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1169. Select Site, PartNo
  1170. from RoutingHeader
  1171. where Site = #{site}
  1172. and PartNo = #{partNo1}
  1173. and RevNo = #{revNo1}
  1174. </select>
  1175. <insert id="copyBom" parameterType="com.gaotao.modules.base.entity.CopyRoutingData">
  1176. Insert into RoutingHeader(Site, PartNo, RevNo, PhaseInDate, PhaseOutDate, RoutingType_DB, RoutingType, Status,
  1177. Status_DB, Remark, Defaultflag, RepairFlag)
  1178. Select Site,
  1179. #{partNo1},
  1180. #{revNo1},
  1181. #{phaseInDate1},
  1182. null,
  1183. RoutingType_DB,
  1184. RoutingType,
  1185. '试验',
  1186. 'T',
  1187. '',
  1188. #{oldFlag1},
  1189. #{repairFlag1}
  1190. FROM RoutingHeader
  1191. where Site = #{site}
  1192. and PartNo = #{partNo}
  1193. and RevNo = #{revNo}
  1194. </insert>
  1195. <insert id="copyRoutingDetail" parameterType="com.gaotao.modules.base.entity.CopyRoutingData">
  1196. Insert into RoutingDetail(Site, PartNo, RevNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime,
  1197. MachRunFactor, FactorUnit_DB, FactorUnit, Efficiency, Crewsize, Remark, WX_PartNo,
  1198. WX_UnitCost)
  1199. Select Site,
  1200. #{partNo1},
  1201. #{revNo1},
  1202. ItemNo,
  1203. OperationDesc,
  1204. WorkCenterNo,
  1205. MachSetupTime,
  1206. MachRunFactor,
  1207. FactorUnit_DB,
  1208. FactorUnit,
  1209. Efficiency,
  1210. Crewsize,
  1211. Remark,
  1212. WX_PartNo,
  1213. WX_UnitCost
  1214. from RoutingDetail
  1215. where Site = #{site}
  1216. and PartNo = #{partNo}
  1217. and RevNo = #{revNo}
  1218. </insert>
  1219. <insert id="copyRoutingTool" parameterType="com.gaotao.modules.base.entity.CopyRoutingData">
  1220. Insert into RoutingTool(Site, PartNo, RevNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy)
  1221. Select Site,
  1222. #{partNo1},
  1223. #{revNo1},
  1224. ItemNo,
  1225. ToolID,
  1226. ToolQty,
  1227. Remark,
  1228. getdate(),
  1229. #{user}
  1230. from RoutingTool
  1231. where Site = #{site}
  1232. and PartNo = #{partNo}
  1233. and RevNo = #{revNo}
  1234. </insert>
  1235. <insert id="copyAvailableResource" parameterType="com.gaotao.modules.base.entity.CopyRoutingData">
  1236. Insert into RoutingDetail_AvailableResource(Site, PartNo, RevNo, ItemNo, ResourceID)
  1237. Select Site, #{partNo1}, #{revNo1}, ItemNo, ResourceID
  1238. from RoutingDetail_AvailableResource as T
  1239. where T.Site = #{site}
  1240. and T.PartNo = #{partNo}
  1241. and T.RevNo = #{revNo}
  1242. </insert>
  1243. <update id="closeOldBom" parameterType="com.gaotao.modules.base.entity.CopyRoutingData">
  1244. Update RoutingHeader
  1245. Set PhaseOutDate=(Case when Status_DB != 'S' then #{phaseInDate1} else PhaseOutDate end),
  1246. Status_DB='S',
  1247. Status='停用',
  1248. DefaultFlag='N'
  1249. where Site = #{site}
  1250. and PartNo = #{partNo1}
  1251. and RevNo = #{revNo}
  1252. </update>
  1253. <select id="checkRoutingDefaultFlag" resultType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1254. SELECT top 1 Defaultflag
  1255. FROM RoutingHeader
  1256. where Site = #{site}
  1257. and PartNo = #{partNo}
  1258. and RevNo = #{revNo}
  1259. </select>
  1260. <update id="setDefault">
  1261. update RoutingHeader
  1262. set Defaultflag = case when RevNo = #{revNo} then 'Y' else 'N' end
  1263. where Site = #{site}
  1264. and PartNo = #{partNo}
  1265. </update>
  1266. <insert id="saveRoutingHeaderData" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1267. insert into RoutingHeader(Site, PartNo, RevNo, PhaseInDate, PhaseOutDate, RoutingType_DB, RoutingType, Status,
  1268. Status_DB, Defaultflag, Remark, RepairFlag)
  1269. VALUES (#{site}, #{partNo}, #{revNo}, #{phaseInDate}, #{phaseOutDate}, #{routingTypeDb}, #{routingType},
  1270. #{status}, #{statusDb}, #{defaultflag}, #{remark}, #{repairFlag})
  1271. </insert>
  1272. <update id="updateRoutingHeaderData">
  1273. update RoutingHeader
  1274. SET PhaseInDate=#{phaseInDate},
  1275. PhaseOutDate=#{phaseOutDate},
  1276. Remark=#{remark},
  1277. RepairFlag=#{repairFlag}
  1278. where Site = #{site}
  1279. and PartNo = #{partNo}
  1280. and RevNo = #{revNo}
  1281. </update>
  1282. <update id="cancelDefault">
  1283. update RoutingHeader
  1284. set Defaultflag = 'N'
  1285. where Site = #{site}
  1286. and PartNo = #{partNo}
  1287. </update>
  1288. <delete id="deleteRoutingHeaderData">
  1289. DELETE
  1290. FROM RoutingHeader
  1291. where Site = #{site}
  1292. and PartNo = #{partNo}
  1293. and RevNo = #{revNo}
  1294. </delete>
  1295. <delete id="deleteRoutingDetailData">
  1296. DELETE
  1297. FROM RoutingDetail
  1298. where Site = #{site}
  1299. and PartNo = #{partNo}
  1300. and RevNo = #{revNo}
  1301. </delete>
  1302. <delete id="deleteRoutingToolAll">
  1303. DELETE
  1304. FROM RoutingTool
  1305. where Site = #{site}
  1306. and PartNo = #{partNo}
  1307. and RevNo = #{revNo}
  1308. </delete>
  1309. <delete id="deleteRoutingResourceAll">
  1310. DELETE
  1311. FROM RoutingDetail_AvailableResource
  1312. where Site = #{site}
  1313. and PartNo = #{partNo}
  1314. and RevNo = #{revNo}
  1315. </delete>
  1316. <select id="getCalendarExceptionShiftData" resultType="CalendarExceptionShiftData">
  1317. select Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime, EndExactTime
  1318. from Calendar_Exception_Shift
  1319. where site = #{site}
  1320. and CalendarID = #{calendarId}
  1321. and ScheduleDate = #{scheduledate}
  1322. </select>
  1323. <select id="findCalendarExceptionShiftData" resultType="CalendarExceptionShiftData">
  1324. select Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime, EndExactTime
  1325. from Calendar_Exception_Shift
  1326. where site = #{site}
  1327. and CalendarID = #{calendarId}
  1328. and ScheduleDate = #{scheduledate}
  1329. and ShiftNo != #{shiftno}
  1330. </select>
  1331. <update id="updateCESShift" parameterType="CalendarExceptionShiftData">
  1332. UPDATE Calendar_Exception_Shift
  1333. set startexacttime=#{startexacttime}
  1334. , endexacttime=#{endexacttime}
  1335. , starttime=#{starttime}
  1336. , endtime=#{endtime}
  1337. where site = #{site}
  1338. and CalendarID = #{calendarId}
  1339. and ScheduleDate = #{scheduledate}
  1340. and ShiftNo = #{shiftno}
  1341. </update>
  1342. <select id="getSORoutingData" resultType="com.gaotao.modules.base.entity.SORoutingData">
  1343. select
  1344. Site,OrderNo,ItemNo,OperationDesc,WorkCenterNo,MachSetupTime,MachRunFactor,FactorUnit_DB,FactorUnit,QtyRequired,
  1345. QtyReported,QtyApprove,TimeRequired,TimeReported,Efficiency,PlanStartTime,PlanFinishTime,BarcodeID,Remark,PartNo,
  1346. Crewsize,ClosedFlag,ActionNotes,QtyScrapt,OutWorkFlag,OutWorkPartNo,QtyOnPR,QtyOnPO,PreItemNo,NextItemNo,ScheduledFlag,
  1347. QtyScheduled,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo,dbo.Get_WorkCenterDesc(Site,WorkCenterNo)
  1348. as WorkCenterDesc
  1349. from SORouting
  1350. <where>
  1351. and site = #{site}
  1352. <if test="orderNo != null and orderNo != ''">
  1353. and OrderNo = #{orderNo}
  1354. </if>
  1355. </where>
  1356. </select>
  1357. <select id="checkSORoutingItemNo" resultType="com.gaotao.modules.base.entity.SORoutingData">
  1358. Select ItemNo from SORouting
  1359. <where>
  1360. <if test="orderNo != null and orderNo != ''">
  1361. and OrderNo = #{orderNo}
  1362. </if>
  1363. <if test="site != null and site != ''">
  1364. and site = #{site}
  1365. </if>
  1366. <if test="itemNo != null and itemNo != ''">
  1367. and ItemNo = #{itemNo}
  1368. </if>
  1369. </where>
  1370. </select>
  1371. <select id="getMaxSORoutingItemNo" resultType="com.gaotao.modules.base.entity.SORoutingData">
  1372. Select IsNull(MAX(ItemNo),0) as ItemNo from SORouting
  1373. <where>
  1374. <if test="orderNo != null and orderNo != ''">
  1375. and OrderNo = #{orderNo}
  1376. </if>
  1377. <if test="site != null and site != ''">
  1378. and site = #{site}
  1379. </if>
  1380. </where>
  1381. </select>
  1382. <insert id="saveSORoutingData" parameterType="SORoutingData">
  1383. insert into SORouting(Site, OrderNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor,
  1384. FactorUnit_DB, FactorUnit, QtyRequired,
  1385. QtyReported, QtyApprove, TimeRequired, TimeReported, Efficiency, PlanStartTime,
  1386. PlanFinishTime, BarcodeID, Remark, PartNo,
  1387. Crewsize, ClosedFlag, QtyScrapt, OutWorkFlag, OutWorkPartNo, QtyOnPR, QtyOnPO, PreItemNo,
  1388. NextItemNo, ScheduledFlag,
  1389. QtyScheduled)
  1390. values (#{site}, #{orderNo}, #{itemNo}, #{operationDesc}, #{workCenterNo}, #{machSetupTime}, #{machRunFactor},
  1391. #{factorUnitDb}, #{factorUnit}, #{lotSize},
  1392. 0, 0,
  1393. dbo.Get_Routing_TimeRequired(#{site}, #{lotSize}, #{machSetupTime}, #{machRunFactor}, #{factorUnit},
  1394. #{efficiency}), 0, #{efficiency}, #{planStartTime}, #{planFinishTime},
  1395. #{barcodeID}, #{remark}, #{partNo},
  1396. #{crewsize}, 'N', 0, 'N', '', 0, 0, #{preItemNo}, 0, 'N', 0)
  1397. </insert>
  1398. <update id="updateSORoutingData" parameterType="SORoutingData">
  1399. update SORouting
  1400. SET OperationDesc=#{operationDesc},
  1401. WorkCenterNo=#{workCenterNo},
  1402. MachSetupTime=#{machSetupTime},
  1403. FactorUnit_DB=#{factorUnitDb},
  1404. FactorUnit=#{factorUnit},
  1405. MachRunFactor=#{machRunFactor},
  1406. PlanStartTime=#{planStartTime},
  1407. PlanFinishTime=#{planFinishTime},
  1408. Efficiency=#{efficiency},
  1409. Crewsize=#{crewsize},
  1410. Remark=#{remark},
  1411. TimeRequired=dbo.Get_Routing_TimeRequired(#{site}, #{lotSize}, #{machSetupTime}, #{machRunFactor},
  1412. #{factorUnit}, #{efficiency})
  1413. where OrderNo = #{orderNo}
  1414. and site = #{site}
  1415. and ItemNo = #{itemNo}
  1416. </update>
  1417. <update id="updateSORoutingDataNextItemNo" parameterType="SORoutingData">
  1418. update SORouting
  1419. SET NextItemNo=#{itemNo}
  1420. where OrderNo = #{orderNo}
  1421. and site = #{site}
  1422. and ItemNo = #{preItemNo}
  1423. </update>
  1424. <select id="getShopOrderLotSize" resultType="float">
  1425. select top 1 isNull(LotSize, 0) as lotSize
  1426. FROM ShopOrder
  1427. where site = #{site}
  1428. and orderNo = #{orderNo}
  1429. </select>
  1430. <select id="searchSORoutingResource" resultType="SORoutingAvailableResourceData">
  1431. select R.Site, R.OrderNo, R.ItemNo, R.ResourceID, W.ResourceDesc, W.Active
  1432. from SORouting_AvailableResource R
  1433. LEFT JOIN WorkCenterResource W on W.ResourceID = R.ResourceID and R.Site = W.Site
  1434. where R.site = #{site}
  1435. and R.orderNo = #{orderNo}
  1436. and R.ItemNo = #{itemNo}
  1437. </select>
  1438. <select id="checkSORoutingResource" resultType="SORoutingAvailableResourceData">
  1439. select Site, OrderNo, ItemNo, ResourceID
  1440. from SORouting_AvailableResource
  1441. where site = #{site}
  1442. and orderNo = #{orderNo}
  1443. and ItemNo = #{itemNo}
  1444. and ResourceID = #{resourceID}
  1445. </select>
  1446. <insert id="addSORoutingResource">
  1447. insert into SORouting_AvailableResource(Site, OrderNo, ItemNo, ResourceID)
  1448. values (#{site}, #{orderNo}, #{itemNo}, #{resourceID})
  1449. </insert>
  1450. <delete id="deleteSORoutingResource">
  1451. delete
  1452. from SORouting_AvailableResource
  1453. where site = #{site}
  1454. and orderNo = #{orderNo}
  1455. and ItemNo = #{itemNo}
  1456. and ResourceID = #{resourceID}
  1457. </delete>
  1458. <select id="getSORoutingRevNo" resultType="com.gaotao.modules.base.entity.RoutingHeaderData">
  1459. Select B.site
  1460. , B.PartNo
  1461. , P.PartDescription + ' / ' + P.Spec as PartDesc
  1462. , B.RevNo
  1463. , B.PhaseInDate
  1464. , B.PhaseOutDate
  1465. , B.Status
  1466. , B.Remark
  1467. , Cast(#{orderNo} as Varchar(20)) as OrderNo
  1468. , B.RoutingType_DB
  1469. , B.RoutingType
  1470. , B.RepairFlag
  1471. from RoutingHeader as B,
  1472. Part as P
  1473. where B.Site = P.Site
  1474. and B.PartNo = P.PartNo
  1475. and B.Site = #{site}
  1476. and B.PartNo = #{partNo}
  1477. and (B.RoutingType_DB = 'M')
  1478. and B.RepairFlag = 'N'
  1479. and B.Status_DB = 'B'
  1480. </select>
  1481. <select id="checkSOSchedule" resultType="SOScheduledRoutingData">
  1482. Select Site
  1483. from SOScheduledRouting
  1484. Where Site = #{site}
  1485. and OrderNo = #{orderNo}
  1486. and itemNo = #{itemNo}
  1487. </select>
  1488. <select id="checkSORouting" resultType="SORoutingData">
  1489. Select isnull(QtyReported, 0.0) as QtyReported,
  1490. isnull(TimeReported, 0.0) as TimeReported,
  1491. dbo.Get_WorkCenter_Type(Site, WorkCenterNo) as WorkCenter_Type
  1492. from SORouting
  1493. Where Site = #{site}
  1494. and OrderNo = #{orderNo}
  1495. and itemNo = #{itemNo}
  1496. </select>
  1497. <select id="checkPRDetail" resultType="PRDetail">
  1498. Select Site
  1499. from PRDetail
  1500. Where Site = #{site}
  1501. and OrderRef1 = #{orderNo}
  1502. and OrderRef2 = #{itemNo}
  1503. and OrderRefType = '生产订单-工序外协'
  1504. </select>
  1505. <select id="checkSORoutingAvailableResourceData" resultType="SORoutingAvailableResourceData">
  1506. Select Site
  1507. from SORouting_AvailableResource as T
  1508. Where Site = #{site}
  1509. and OrderNo = #{orderNo}
  1510. and itemNo = #{itemNo}
  1511. </select>
  1512. <select id="checkSOTool" resultType="SOToolData">
  1513. SELECT site
  1514. from SOTool
  1515. Where Site = #{site}
  1516. and OrderNo = #{orderNo}
  1517. and itemNo = #{itemNo}
  1518. </select>
  1519. <select id="checkShopOrder" resultType="ShopOrderData">
  1520. Select top 1 Status, isnull(CostRollUpFlag, 'N') as CostRollUpFlag, OrderType
  1521. from ShopOrder as T
  1522. Where T.Site = #{site}
  1523. and T.OrderNo = #{orderNo}
  1524. </select>
  1525. <delete id="deleteSORouting">
  1526. DELETE
  1527. FROM SORouting
  1528. Where Site = #{site}
  1529. and OrderNo = #{orderNo}
  1530. and itemNo = #{itemNo}
  1531. </delete>
  1532. <update id="updateSORoutingNextLast">
  1533. Update SORouting
  1534. Set PreItemNo =
  1535. Isnull((Select Max(D.ItemNo) as PreItemNo
  1536. from SORouting as D
  1537. Where D.Site = SORouting.Site
  1538. and D.OrderNo = SORouting.OrderNo
  1539. and SORouting.ItemNo > D.ItemNo), 0)
  1540. , NextItemNo =
  1541. Isnull((Select Min(D.ItemNo) as NextItemNo
  1542. from SORouting as D
  1543. Where D.Site = SORouting.Site
  1544. and D.OrderNo = SORouting.OrderNo
  1545. and D.ItemNo > SORouting.ItemNo), 0)
  1546. where Site = #{site}
  1547. and OrderNo = #{orderNo}
  1548. </update>
  1549. <select id="getCalendarDatetypeInfo" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData">
  1550. SELECT Site
  1551. ,DateType
  1552. ,ExceptTime1
  1553. ,ExceptDuration1
  1554. ,ExceptTime2
  1555. ,ExceptDuration2
  1556. ,ExceptTime3
  1557. ,ExceptDuration3
  1558. ,ExceptTime4
  1559. ,ExceptDuration4
  1560. ,ExceptTime5
  1561. ,ExceptDuration5
  1562. ,ExceptTime6
  1563. ,ExceptDuration6
  1564. ,WorkTime
  1565. ,Remark
  1566. ,exceptexacttime1
  1567. ,exceptexacttime2
  1568. ,exceptexacttime3
  1569. ,exceptexacttime4
  1570. ,exceptexacttime5
  1571. ,exceptexacttime6
  1572. ,StartTime
  1573. ,EndTime
  1574. ,StartExactTime
  1575. ,EndExactTime
  1576. FROM calendar_datetype
  1577. <where>
  1578. site = #{site}
  1579. and datetype = #{datetype}
  1580. </where>
  1581. </select>
  1582. <update id="updateWorkingCalendar">
  1583. update calendar_exception
  1584. set excepttime1 = #{excepttime1}
  1585. , exceptduration1 = #{exceptduration1}
  1586. , excepttime2 = #{excepttime2}
  1587. , exceptduration2 = #{exceptduration2}
  1588. , excepttime3 = #{excepttime3}
  1589. , exceptduration3 = #{exceptduration3}
  1590. , excepttime4 =#{excepttime4}
  1591. , exceptduration4 =#{exceptduration4}
  1592. , excepttime5 = #{excepttime5}
  1593. , exceptduration5 =#{exceptduration5}
  1594. , excepttime6 = #{excepttime6}
  1595. , exceptduration6 = #{exceptduration6}
  1596. , worktime =#{worktime}
  1597. , datetype = #{datetype}
  1598. , exceptexacttime1 =#{exceptexacttime1}
  1599. , exceptexacttime2 = #{exceptexacttime2}
  1600. , exceptexacttime3 = #{exceptexacttime3}
  1601. , exceptexacttime4 = #{exceptexacttime4}
  1602. , exceptexacttime5 = #{exceptexacttime5}
  1603. , exceptexacttime6 = #{exceptexacttime6}
  1604. where site = #{site}
  1605. AND CalendarID = #{calendarId}
  1606. AND scheduledate = #{scheduledate}
  1607. </update>
  1608. <!--查询标签定义的相关信息-->
  1609. <select id="getLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData">
  1610. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark
  1611. FROM ReportFileList
  1612. <where>
  1613. <if test="labelNo != null and labelNo != ''">
  1614. and ReportID LIKE #{labelNo}
  1615. </if>
  1616. <if test="labelType != null and labelType != ''">
  1617. and ReportFamily LIKE #{labelType}
  1618. </if>
  1619. <if test="labelName != null and labelName != ''">
  1620. and Reportfile LIKE #{labelName}
  1621. </if>
  1622. </where>
  1623. ORDER BY ReportID ASC
  1624. </select>
  1625. <!--查询标签定义的相关信息按照标签的编码-->
  1626. <select id="getLabelSettingByLabelNo" parameterType="java.lang.String" resultType="LabelSettingData">
  1627. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark
  1628. FROM ReportFileList
  1629. <where>
  1630. AND ReportID = #{labelNo}
  1631. </where>
  1632. </select>
  1633. <!--插入标签自定义的数据-->
  1634. <insert id="insertLabelSetting" parameterType="LabelSettingData">
  1635. INSERT INTO ReportFileList(ReportID, ReportFamily, Reportfile, ReportType, Remark)
  1636. VALUES (#{labelNo}, #{labelType}, #{labelName}, #{labelClass}, #{remark})
  1637. </insert>
  1638. <!--修改标签自定义的信息-->
  1639. <update id="updateLabelSetting" parameterType="LabelSettingData">
  1640. UPDATE ReportFileList SET ReportFamily = #{labelType}, Reportfile = #{labelName}, ReportType = #{labelClass},
  1641. Remark = #{remark}
  1642. <where>
  1643. AND ReportID = #{labelNo}
  1644. </where>
  1645. </update>
  1646. <!--删除标签定义的主表信息-->
  1647. <delete id="deleteLabelSettingByLabelNo" parameterType="java.lang.String">
  1648. DELETE FROM ReportFileList
  1649. <where>
  1650. AND ReportID = #{labelNo}
  1651. </where>
  1652. </delete>
  1653. <!--查询标签的默认配置信息-->
  1654. <select id="getDefaultLabelSettingList" parameterType="DefaultLabelSettingData"
  1655. resultType="DefaultLabelSettingData">
  1656. SELECT rfd.ReportFamily labelType, rfd.ReportID labelNo, rfl.ReportType labelClass, rfl.Reportfile labelName,
  1657. rfd.Remark remark,
  1658. rfd.SubReportFlag subLabelFlag, rfd.ParentReportID parentLabelNo FROM ReportFileDefDefault rfd
  1659. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ReportID
  1660. <where>
  1661. AND rfl.ReportID = rfd.ReportID
  1662. <if test="labelNo != null and labelNo != ''">
  1663. and rfd.ReportID LIKE #{labelNo}
  1664. </if>
  1665. <if test="labelType != null and labelType != ''">
  1666. and rfd.ReportFamily LIKE #{labelType}
  1667. </if>
  1668. <if test="labelName != null and labelName != ''">
  1669. and rfl.Reportfile LIKE #{labelName}
  1670. </if>
  1671. </where>
  1672. ORDER BY rfd.ReportFamily ASC
  1673. </select>
  1674. <!--插入默认标签配置信息-->
  1675. <insert id="insertDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  1676. INSERT INTO ReportFileDefDefault(FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID)
  1677. VALUES ('*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo})
  1678. </insert>
  1679. <!--修改默认标签配置信息-->
  1680. <update id="updateDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  1681. UPDATE ReportFileDefDefault SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark =
  1682. #{remark}
  1683. <where>
  1684. AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*'
  1685. </where>
  1686. </update>
  1687. <!--删除默认标签配置信息-->
  1688. <delete id="deleteDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  1689. DELETE FROM ReportFileDefDefault
  1690. <where>
  1691. AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*'
  1692. </where>
  1693. </delete>
  1694. <!--查询标签的客制化配置信息-->
  1695. <select id="getCustomerLabelSettingList" parameterType="CustomerLabelSettingData"
  1696. resultType="CustomerLabelSettingData">
  1697. SELECT rfc.ReportFamily labelType, rfc.CustomerID customerId, dbo.Get_CustomerDesc(rfc.Site, rfc.CustomerID)
  1698. customerDesc, rfc.ReportID labelNo,
  1699. rfl.Reportfile labelName, rfl.ReportType labelClass, rfc.Site site, rfc.Remark remark, rfc.SubReportFlag
  1700. subLabelFlag, rfc.ParentReportID parentLabelNo
  1701. FROM ReportFileDefCustomer rfc
  1702. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfc.ReportID AND rfl.ReportFamily = rfc.ReportFamily
  1703. <where>
  1704. AND rfl.ReportID = rfc.ReportID
  1705. <if test="customerId != null and customerId != ''">
  1706. and rfc.CustomerID LIKE #{customerId}
  1707. </if>
  1708. <if test="labelNo != null and labelNo != ''">
  1709. and rfc.ReportID LIKE #{labelNo}
  1710. </if>
  1711. <if test="labelType != null and labelType != ''">
  1712. and rfc.ReportFamily LIKE #{labelType}
  1713. </if>
  1714. <if test="labelName != null and labelName != ''">
  1715. and rfl.Reportfile LIKE #{labelName}
  1716. </if>
  1717. </where>
  1718. ORDER BY rfc.CustomerID ASC
  1719. </select>
  1720. <!--插入客制化标签配置信息-->
  1721. <insert id="insertCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  1722. INSERT INTO ReportFileDefCustomer(Site, CustomerID, FamilyID, ReportFamily, ReportID, Remark, SubReportFlag,
  1723. ParentReportID)
  1724. VALUES (#{site}, #{customerId}, '*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo})
  1725. </insert>
  1726. <!--修改客制化标签配置信息-->
  1727. <update id="updateCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  1728. UPDATE ReportFileDefCustomer SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark =
  1729. #{remark}
  1730. <where>
  1731. AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*'
  1732. </where>
  1733. </update>
  1734. <!--删除客制化标签配置信息-->
  1735. <delete id="deleteCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  1736. DELETE FROM ReportFileDefCustomer
  1737. <where>
  1738. AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*'
  1739. </where>
  1740. </delete>
  1741. <!--查询标签的客制化配置信息-->
  1742. <select id="getUserLabelPrinters" parameterType="UserLabelPrinterData" resultType="UserLabelPrinterData">
  1743. SELECT rfp.UserID userId, ssu.user_display userDisplay, rfp.ReportID labelNo, rfl.Reportfile labelName,
  1744. rfl.ReportType labelClass,
  1745. rfp.NewPrinterName printerName, rfp.IPAddress ipAddress
  1746. FROM ReportFileList_UserPrinter rfp
  1747. LEFT JOIN sys_user ssu ON ssu.username = rfp.UserID
  1748. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfp.ReportID
  1749. <where>
  1750. AND rfl.ReportID = rfp.ReportID
  1751. <if test='"admin".equalsIgnoreCase(username)'>
  1752. </if>
  1753. <if test='!"admin".equalsIgnoreCase(username)'>
  1754. and rfp.UserID = #{username}
  1755. </if>
  1756. <if test="userId != null and userId != ''">
  1757. and rfp.UserID LIKE #{userId}
  1758. </if>
  1759. <if test="labelNo != null and labelNo != ''">
  1760. and rfp.ReportID LIKE #{labelNo}
  1761. </if>
  1762. <if test="labelName != null and labelName != ''">
  1763. and rfl.Reportfile LIKE #{labelName}
  1764. </if>
  1765. </where>
  1766. ORDER BY rfp.ReportID ASC
  1767. </select>
  1768. <!--按照userId 查询用户的信息-->
  1769. <select id="getSysUserDataByUserId" parameterType="UserLabelPrinterData" resultType="SysUserData">
  1770. SELECT user_id, username, password, salt, email, mobile, status, create_user_id,
  1771. create_time, language_default, site, user_display FROM sys_user
  1772. <where>
  1773. AND username = #{userId}
  1774. </where>
  1775. </select>
  1776. <!--插入用户的标签打印机参数-->
  1777. <insert id="insertUserLabelPrinter" parameterType="UserLabelPrinterData">
  1778. INSERT INTO ReportFileList_UserPrinter(ReportID, UserID, PrinterName, IPAddress, NewPrinterName)
  1779. VALUES (#{labelNo}, #{userId}, '', #{ipAddress}, #{printerName})
  1780. </insert>
  1781. <!--修改用户的标签打印机参数-->
  1782. <update id="updateUserLabelPrinter" parameterType="UserLabelPrinterData">
  1783. UPDATE ReportFileList_UserPrinter SET IPAddress = #{ipAddress}, NewPrinterName = #{printerName}
  1784. <where>
  1785. AND ReportID = #{labelNo} AND UserID = #{userId}
  1786. </where>
  1787. </update>
  1788. <!--删除用户标签的打印机的信息-->
  1789. <delete id="deleteUserLabelPrinter" parameterType="UserLabelPrinterData">
  1790. DELETE FROM ReportFileList_UserPrinter
  1791. <where>
  1792. AND ReportID = #{labelNo} AND UserID = #{userId}
  1793. </where>
  1794. </delete>
  1795. <!--获取标签打印参数配置信息-->
  1796. <select id="getLabelParameterList" parameterType="LabelParameterData" resultType="LabelParameterData">
  1797. SELECT ReportID labelNo, ItemNo itemNo, ShowSeqNo showSeqNo, ParameterDesc parameterDesc, ParameterName
  1798. parameterName,
  1799. ValueType_DB valueTypeDb, ValueType valueType, OptionValue optionValue, DefaultValue defaultValue
  1800. FROM ReportParameters
  1801. <where>
  1802. AND ReportID = #{labelNo}
  1803. </where>
  1804. ORDER BY ItemNo
  1805. </select>
  1806. <!--插入标签的打印参数-->
  1807. <insert id="insertLabelPrintParameter" parameterType="LabelParameterData">
  1808. INSERT INTO ReportParameters(ReportID, ItemNo, ShowSeqNo, ParameterDesc, ParameterName, ValueType_DB,
  1809. ValueType, OptionValue, DefaultValue)
  1810. VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{parameterDesc}, #{parameterName}, #{valueTypeDb},
  1811. #{valueType}, #{optionValue}, #{defaultValue})
  1812. </insert>
  1813. <!--修改标签打印参数的信息-->
  1814. <update id="updateLabelPrintParameter" parameterType="LabelParameterData">
  1815. UPDATE ReportParameters SET OptionValue = #{optionValue}, DefaultValue = #{defaultValue}, ShowSeqNo =
  1816. #{showSeqNo}
  1817. <where>
  1818. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  1819. </where>
  1820. </update>
  1821. <!--删除标签打印参数的信息-->
  1822. <delete id="deleteLabelPrintParameter" parameterType="LabelParameterData">
  1823. DELETE FROM ReportParameters
  1824. <where>
  1825. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  1826. </where>
  1827. </delete>
  1828. <!--查询标签内容定义列表-->
  1829. <select id="getLabelContentList" parameterType="LabelContentData" resultType="LabelContentData">
  1830. SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup,
  1831. DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue,
  1832. ReportID labelNo
  1833. FROM ReportContentItem
  1834. <where>
  1835. AND ReportID = #{labelNo}
  1836. </where>
  1837. ORDER BY ItemNo
  1838. </select>
  1839. <!--插入标签内容定义-->
  1840. <insert id="insertLabelContent" parameterType="LabelContentData">
  1841. INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup,
  1842. DBFieldName, SequenceNoflag, SequenceBits, [Interval])
  1843. VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{itemDesc}, #{objectName}, #{objectGroup},
  1844. #{dbFieldName}, #{sequenceNoFlag}, #{sequenceBits}, #{intervalValue})
  1845. </insert>
  1846. <!--修改标签的打印参数-->
  1847. <update id="updateLabelContent" parameterType="LabelContentData">
  1848. UPDATE ReportContentItem SET ShowSeqNo = #{showSeqNo}, ObjectName = #{objectName}, ObjectGroup = #{objectGroup},
  1849. DBFieldName = #{dbFieldName}, SequenceNoflag = #{sequenceNoFlag}, SequenceBits = #{sequenceBits},
  1850. [Interval] = #{intervalValue}, ItemDesc = #{itemDesc}
  1851. <where>
  1852. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  1853. </where>
  1854. </update>
  1855. <!--删除标签打印参数的信息-->
  1856. <delete id="deleteLabelContent" parameterType="LabelContentData">
  1857. DELETE FROM ReportContentItem
  1858. <where>
  1859. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  1860. </where>
  1861. </delete>
  1862. <!--查询可以复制的标签内容定义-->
  1863. <select id="getCopyLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData">
  1864. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark
  1865. FROM ReportFileList
  1866. <where>
  1867. AND ReportID != #{labelNo} AND ReportFamily = #{labelType} AND ReportType = #{labelClass}
  1868. </where>
  1869. ORDER BY ReportID ASC
  1870. </select>
  1871. <!--首先删除原标签内容定义-->
  1872. <delete id="deleteLabelAllContentsByLabelNo" parameterType="LabelSettingData">
  1873. DELETE FROM ReportContentItem
  1874. <where>
  1875. AND ReportID = #{labelNo}
  1876. </where>
  1877. </delete>
  1878. <!--复制其他标签的标签内容定义-->
  1879. <insert id="copyLabelAllContentsWithOther" parameterType="LabelSettingData">
  1880. INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup,
  1881. DBFieldName, SequenceNoflag, SequenceBits, [Interval])
  1882. SELECT #{labelNo},
  1883. ItemNo,
  1884. ShowSeqNo,
  1885. ItemDesc,
  1886. ObjectName,
  1887. ObjectGroup,
  1888. DBFieldName,
  1889. SequenceNoflag,
  1890. SequenceBits,
  1891. [Interval]
  1892. FROM ReportContentItem
  1893. WHERE ReportID = #{newLabelNo}
  1894. </insert>
  1895. <!--获取要用的标签内容-->
  1896. <select id="getUsedLabelContent" parameterType="LabelContentData" resultType="LabelContentData">
  1897. SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup,
  1898. DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue,
  1899. ReportID labelNo
  1900. FROM ReportContentItem
  1901. <where>
  1902. AND ReportID = #{labelNo} AND ItemNo != #{itemNo}
  1903. </where>
  1904. ORDER BY ItemNo
  1905. </select>
  1906. <!--获取标签内容的流水号规则-->
  1907. <select id="getLabelContentSerialRule" parameterType="LabelContentData" resultType="LabelContentSerialRuleData">
  1908. SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.SeqNo seqNo, rcs.ObjectName objectName
  1909. FROM ReportContentItem_SeqRule rcs
  1910. <where>
  1911. AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo}
  1912. </where>
  1913. ORDER BY rcs.SeqNo
  1914. </select>
  1915. <!--删除标签内容的流水号规则-->
  1916. <delete id="deleteLabelContentSerialRule" parameterType="LabelContentSerialRuleData">
  1917. DELETE FROM ReportContentItem_SeqRule
  1918. <where>
  1919. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND SeqNo = #{seqNo}
  1920. </where>
  1921. </delete>
  1922. <!--获取标签内容的流水号信息-->
  1923. <select id="getLabelSerialInfos" parameterType="LabelContentData" resultType="LabelContentSerialInfoData">
  1924. SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.KeyInfo keyInfo, rcs.LastSeqNo lastSeqNo
  1925. FROM ReportFile_SeqInfo rcs
  1926. <where>
  1927. AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo}
  1928. </where>
  1929. </select>
  1930. <select id="getPartNoRouteInMaxItemNo" resultType="java.lang.String">
  1931. SELECT MAX(ItemNo) FROM RoutingDetail
  1932. WHERE site =#{site} AND partNo = #{partNo} AND revNo = #{revNo}
  1933. </select>
  1934. <!--插入标签流水号信息-->
  1935. <insert id="insertLabelSerialInfo" parameterType="LabelContentSerialInfoData">
  1936. INSERT INTO ReportFile_SeqInfo(ReportID, ItemNo, KeyInfo, LastSeqNo)
  1937. VALUES (#{labelNo}, #{itemNo}, #{keyInfo}, #{lastSeqNo})
  1938. </insert>
  1939. <!--修改标签流水号信息-->
  1940. <update id="updateLabelSerialInfo" parameterType="LabelContentSerialInfoData">
  1941. UPDATE ReportFile_SeqInfo SET KeyInfo = #{keyInfo}, LastSeqNo = #{lastSeqNo}
  1942. <where>
  1943. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{oriKeyInfo}
  1944. </where>
  1945. </update>
  1946. <!--删除标签流水号信息-->
  1947. <delete id="deleteLabelSerialInfo" parameterType="LabelContentSerialRuleData">
  1948. DELETE FROM ReportFile_SeqInfo
  1949. <where>
  1950. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{keyInfo}
  1951. </where>
  1952. </delete>
  1953. <insert id="saveCalendarExceptionShift">
  1954. INSERT INTO Calendar_Exception_Shift(Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime,
  1955. EndExactTime, StartTime, EndTime)
  1956. SELECT site,
  1957. #{calendarId},
  1958. ShiftNo,
  1959. #{scheduledate},
  1960. ShiftDesc,
  1961. StartExactTime,
  1962. EndExactTime,
  1963. StartTime,
  1964. EndTime
  1965. FROM Calendar_DateType_Shift
  1966. WHERE DateType = #{datetype}
  1967. AND site = #{site}
  1968. </insert>
  1969. <delete id="deleteCalendarExceptionShift">
  1970. DELETE Calendar_Exception_Shift
  1971. WHERE site = #{site}
  1972. AND CalendarID = #{calendarId}
  1973. AND scheduledate = #{scheduledate}
  1974. </delete>
  1975. </mapper>