|
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.gaotao.modules.base.dao.BaseMapper">
<select id="getCalendarData" resultType="com.gaotao.modules.base.entity.CalendarData" parameterType="com.gaotao.modules.base.entity.CalendarData"> SELECT * FROM calendar <where> <if test="site != null and site != ''"> AND site = #{site} </if>
<if test="calendarId != null and calendarId != ''"> AND CalendarID ${isIncluding} #{calendarId} </if> <if test="calendarDesc != null and calendarDesc != ''"> AND CalendarDesc ${isIncluding} #{calendarDesc} </if> <if test="status != null and status != ''"> AND status = #{status} </if>
</where> </select>
<select id="findBySite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData"> SELECT * FROM calendar_datetype <where> <if test="site != null and site != ''"> AND site = #{site} </if> </where> </select>
<update id="editCalendar"> UPDATE calendar set CalendarDesc=#{calendarDesc},status=#{status}
WHERE CalendarID = #{calendarId} AND site = #{site}
<!-- <if test="version != null and version != ''">--> <!-- AND version = #{version}--> <!-- </if>-->
</update>
<select id="findByCalendarId" resultType="com.gaotao.modules.base.entity.CalendarData"> SELECT CalendarDesc FROM calendar <where> <if test="calendarId != null and calendarId != ''"> AND CalendarID = #{calendarId} </if> <if test="site != null and site != ''"> AND site = #{site} </if> </where> </select>
<insert id="save" parameterType="com.gaotao.modules.base.entity.CalendarData"> INSERT INTO calendar(site, calendarID, calendarDesc, status) VALUES (#{site}, #{calendarId}, #{calendarDesc}, #{status}) </insert>
<delete id="delCalendar"> DELETE FROM calendar WHERE CalendarID = #{calendarId} AND site = #{site}
</delete>
<select id="findByDatetypeAndSite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData"> select site,datetype,worktime,exceptexacttime1,exceptexacttime2,exceptexacttime3,exceptexacttime4,exceptexacttime5,exceptexacttime6, excepttime1,exceptduration1,excepttime2,exceptduration2,excepttime3,exceptduration3,excepttime4,exceptduration4, excepttime5,exceptduration5,excepttime6,exceptduration6 FROM calendar_datetype <where> <if test="dataType != null and dataType != ''"> AND datetype = #{dataType} </if> <if test="site != null and site != ''"> AND site = #{site} </if> </where> </select>
<select id="getCalendarEByCIdAndSDate" resultType="com.gaotao.modules.base.entity.CalendarExceptionData"> SELECT site,CalendarID,ScheduleDate FROM calendar_exception <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="calendarId != null and calendarId != ''"> AND CalendarID = #{calendarId} </if> <if test="scheduledate != null and scheduledate != ''"> AND ScheduleDate = #{scheduledate} </if> </where> </select>
<select id="findBySiteAndCalendarId" resultType="com.gaotao.modules.base.entity.CalendarExceptionData"> SELECT TOP 100 * FROM calendar_exception <where> <if test="site != null and site != ''"> AND Site = #{site} </if> <if test="calendarId != null and calendarId != ''"> AND CalendarID = #{calendarId} </if> <if test="scheduledDate != null and scheduledDate != ''"> AND ScheduleDate <![CDATA[ >= ]]> #{scheduledDate} </if> </where> ORDER BY scheduledate DESC </select>
<update id="editShift" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData"> UPDATE calendar_datetype_shift set shiftdesc=#{shiftdesc},startexacttime=#{startexacttime} ,endexacttime=#{endexacttime},starttime=#{starttime},endtime=#{endtime} <where> <if test="site != null and site != ''"> AND site = #{site} </if> AND DateType = #{datetype} and ShiftNo =#{shiftno} </where> </update>
<select id="findShiftById" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData"> SELECT * FROM calendar_datetype_shift <where> <if test="id != null and id != ''"> AND id = #{id} </if> </where> </select>
<select id="findByShiftno" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData"> SELECT top 1 * FROM calendar_datetype_shift <where> <if test="site != null and site != ''"> AND site = #{site} </if> AND DateType = #{datetype} and ShiftNo =#{shiftno} </where> </select>
<insert id="saveCDS" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData"> INSERT INTO calendar_datetype_shift (shiftno, datetype, site, shiftdesc, startexacttime, endexacttime, starttime, endtime) VALUES (#{shiftno}, #{datetype}, #{site}, #{shiftdesc}, #{startexacttime}, #{endexacttime}, #{starttime}, #{endtime}) </insert>
<select id="findBySiteAndDatetype" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData"> SELECT * FROM calendar_datetype_shift <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="datetype != null and datetype != ''"> AND datetype = #{datetype} </if> </where> </select>
<select id="findBySiteAndDatetype2" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftOutData"> SELECT * FROM calendar_datetype_shift <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="datetype != null and datetype != ''"> AND datetype = #{datetype} </if> and ShiftNo != #{shiftno} </where> </select>
<select id="findCDDByDatetypeAndSite" resultType="com.gaotao.modules.base.entity.CalendarDatetypeData"> SELECT datetype,site FROM Calendar_DateType <where> <if test="datetype != null and datetype != ''"> AND datetype = #{datetype} </if> <if test="site != null and site != ''"> AND site = #{site} </if> </where> </select>
<select id="findCDDById" resultType="com.gaotao.modules.base.entity.CalendarDatetypeData"> SELECT created_date,created_by,delflag FROM calendar_datetype <where> <if test="id != null and id != ''"> AND id = #{id} </if> </where> </select>
<insert id="saveCDD" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeData"> INSERT INTO calendar_datetype (site, datetype, excepttime1, exceptduration1, excepttime2, exceptduration2, excepttime3, exceptduration3, excepttime4, exceptduration4, excepttime5, exceptduration5, excepttime6, exceptduration6, worktime, remark, exceptexacttime1, exceptexacttime2, exceptexacttime3, exceptexacttime4, exceptexacttime5, exceptexacttime6) VALUES (#{site}, #{datetype}, #{excepttime1}, #{exceptduration1}, #{excepttime2}, #{exceptduration2}, #{excepttime3}, #{exceptduration3}, #{excepttime4}, #{exceptduration4}, #{excepttime5}, #{exceptduration5}, #{excepttime6}, #{exceptduration6}, #{worktime}, #{remark}, #{exceptexacttime1}, #{exceptexacttime2}, #{exceptexacttime3}, #{exceptexacttime4}, #{exceptexacttime5}, #{exceptexacttime6}) </insert>
<delete id="deleteById"> DELETE FROM calendar_datetype WHERE site = #{site} and datetype = #{datetype} </delete>
<select id="getCalendarESByCIdAndSDate" resultType="com.gaotao.modules.base.entity.CalendarExceptionShiftData"> select site,CalendarId,ScheduleDate from calendar_exception_shift <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="calendarId != null and calendarId != ''"> AND CalendarId = #{calendarId} </if> <if test="scheduledate != null and scheduledate != ''"> AND ScheduleDate = #{scheduledate} </if> </where> </select>
<delete id="deleteCESById"> DELETE FROM calendar_exception_shift WHERE site = #{site} AND CalendarId = #{calendarId} AND ScheduleDate = #{scheduledate} </delete>
<insert id="saveCED" parameterType="com.gaotao.modules.base.entity.CalendarExceptionData"> INSERT INTO calendar_exception ( site, CalendarID, scheduledate, excepttime1, exceptduration1, excepttime2 , exceptduration2, excepttime3 , exceptduration3, excepttime4, exceptduration4, excepttime5, exceptduration5 , excepttime6, exceptduration6, worktime, datetype, exceptexacttime1 , exceptexacttime2, exceptexacttime3, exceptexacttime4, exceptexacttime5 , exceptexacttime6) VALUES (#{site}, #{calendarId}, #{scheduledate}, #{excepttime1}, #{exceptduration1}, #{excepttime2}, #{exceptduration2}, #{excepttime3}, #{exceptduration3}, #{excepttime4}, #{exceptduration4}, #{excepttime5}, #{exceptduration5}, #{excepttime6}, #{exceptduration6}, #{worktime}, #{datetype}, #{exceptexacttime1} , #{exceptexacttime2}, #{exceptexacttime3}, #{exceptexacttime4}, #{exceptexacttime5}, #{exceptexacttime6}) </insert>
<insert id="saveCESD" parameterType="com.gaotao.modules.base.entity.CalendarExceptionShiftInData"> INSERT INTO calendar_exception_shift (site, calendarID, shiftno, scheduledate, shiftdesc, startexacttime, endexacttime, starttime, endtime) VALUES (#{site}, #{calendarId}, #{shiftno}, #{scheduledate}, #{shiftdesc}, #{startexacttime}, #{endexacttime}, #{starttime}, #{endtime}) </insert>
<delete id="deleteCEDById"> DELETE FROM calendar_exception WHERE site = #{site} and CalendarId = #{calendarId} AND scheduledate = #{scheduledate} </delete>
<update id="updateCDD" parameterType="com.gaotao.modules.base.entity.CalendarDatetypeData"> UPDATE calendar_datetype set excepttime1=#{excepttime1},exceptduration1=#{exceptduration1}, excepttime2=#{excepttime2},exceptduration2=#{exceptduration2},excepttime3=#{excepttime3},exceptduration3=#{exceptduration3},excepttime4=#{excepttime4},exceptduration4=#{exceptduration4}, excepttime5=#{excepttime5},exceptduration5=#{exceptduration5},excepttime6=#{excepttime6},exceptduration6=#{exceptduration6},worktime=#{worktime},remark=#{remark},exceptexacttime1=#{exceptexacttime1}, exceptexacttime2=#{exceptexacttime2},exceptexacttime3=#{exceptexacttime3},exceptexacttime4=#{exceptexacttime4},exceptexacttime5=#{exceptexacttime5},exceptexacttime6=#{exceptexacttime6} <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="datetype != null and datetype != ''"> AND datetype = #{datetype} </if> </where> </update>
<select id="getAllShiftData" resultType="com.gaotao.modules.base.entity.CalendarDatetypeShiftData"> SELECT shiftno,shiftdesc,datetype,id FROM calendar_datetype_shift <where> AND site = #{site} </where> ORDER BY shiftno </select>
<select id="findDateType" resultType="com.gaotao.modules.base.entity.CalendarExceptionData"> SELECT site FROM calendar_exception <where> AND datetype = #{datetype} </where> </select> <delete id="deleteShift"> DELETE FROM calendar_datetype_shift WHERE shiftno = #{shiftno} AND site = #{site} AND DateType = #{datetype} </delete>
<select id="getShiftNo" resultType="int"> SELECT isnull(max(convert(INT, SUBSTRING(shiftno, 3, 6))), 0) FROM calendar_datetype_shift
</select>
<select id="getSiteAccessFlag" resultType="java.lang.String"> select dbo.Get_Site_Access_Flag(#{userId}, #{site}) </select>
<select id="getSiteData" resultType="com.gaotao.modules.base.entity.SiteData"> Select T.* ,C.CompanyName from Site as T left join Company C ON T.CompanyID=C.CompanyID <where> <if test="companyID != null and companyID != ''"> AND T.CompanyID = #{companyID} </if> <if test="companyName != null and companyName != ''"> AND C.CompanyName = #{companyName} </if> </where> </select>
<select id="getCompanyData" resultType="com.gaotao.modules.base.entity.CompanyData"> Select CompanyID, CompanyName, Active, TaxNo, BankName, BankAccount, CutoffDate_DB, CutoffDate, CutoffDate_FixDate from Company </select>
<select id="checkSiteId" resultType="com.gaotao.modules.base.entity.SiteData"> select SiteName, SiteID from Site where SiteID = #{siteID} and Active = 'Y' </select>
<select id="checkCal" resultType="com.gaotao.modules.base.entity.CalendarData"> select calendarID from calendar where Site = #{site} and status = '使用中' and calendarID = #{calendarID} </select>
<select id="checkResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData"> select site from WorkCenterResource where Site = #{site} and ResourceID = #{resourceID} </select>
<insert id="saveResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData"> INSERT INTO WorkCenterResource (Site, WorkCenterNo, ResourceID, ResourceDesc, Efficiency, Utilization, Active, Remark, CreatedDate, CalendarID, VirturlFlag) VALUES (#{site}, #{workCenterNo}, #{resourceID}, #{resourceDesc}, #{efficiency}, #{utilization}, #{active}, #{remark}, GetDate(), #{calendarID}, 'N') </insert> <update id="editResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData"> update WorkCenterResource SET ResourceDesc=#{resourceDesc}, Efficiency=#{efficiency}, Utilization=#{utilization}, Active=#{active}, Remark=#{remark}, CalendarID=#{calendarID} where Site = #{site} and ResourceID = #{resourceID} </update>
<insert id="saveSite" parameterType="com.gaotao.modules.base.entity.SiteData"> INSERT INTO Site (SiteID, SiteName, SiteName_E, Address, Address_E, ContactName, PostCode, Email, FaxNo, PhoneNo, Active, Website, CompanyID, ShipTime, ReferenceCustomerID) VALUES (#{siteID}, #{siteName}, #{siteNameE}, #{address}, #{addressE}, #{contactName}, #{postCode}, #{email}, #{faxNo}, #{phoneNo}, #{active}, #{website}, #{companyID}, #{shipTime}, #{referenceCustomerID}) </insert>
<update id="editSite" parameterType="com.gaotao.modules.base.entity.SiteData"> update Site SET SiteName=#{siteName}, SiteName_E=#{siteNameE}, Address=#{address}, Address_E=#{addressE}, ContactName=#{contactName}, PostCode=#{postCode}, Email=#{email}, FaxNo=#{faxNo}, PhoneNo=#{phoneNo}, Active=#{active}, Website=#{website}, CompanyID=#{companyID}, ShipTime=#{shipTime}, ReferenceCustomerID=#{referenceCustomerID} where SiteID = #{siteID} </update>
<select id="getPartFamily" resultType="com.gaotao.modules.base.entity.PartFamilyData"> Select T.FamilyID, T.Site, T.FamilyName, T.CostType, T.CostTypeDesc, T.Active, T.BatchCreatedMethod, T.CheckPercentage, T.InspectFlag from PartFamily as T where T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
</select>
<select id="getPartFamilyInfo" resultType="com.gaotao.modules.base.entity.PartFamilyData"> Select T.FamilyID, T.Site, T.FamilyName, T.CostType, T.CostTypeDesc, T.Active, T.BatchCreatedMethod, T.CheckPercentage, T.InspectFlag from PartFamily as T where T.Site = #{site} and T.FamilyID = #{familyID} </select> <select id="checkAccessSite" resultType="com.gaotao.modules.base.entity.AccessSiteData"> Select UserID, Site from AccessSite where UserID = #{userID} and Site = #{site} </select> <select id="checkFamilyID" resultType="com.gaotao.modules.base.entity.PartFamilyData"> select FamilyID, FamilyName from PartFamily where FamilyID = #{familyID} and Site = #{site} </select> <insert id="savePartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData"> INSERT INTO PartFamily (FamilyID, Site, FamilyName, Active, CheckPercentage, InspectFlag) values (#{familyID}, #{site}, #{familyName}, #{active}, #{checkPercentage}, #{inspectFlag}) </insert> <update id="editPartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData"> UPDATE PartFamily SET Site=#{site}, FamilyName=#{familyName}, Active=#{active}, CheckPercentage=#{checkPercentage}, InspectFlag=#{inspectFlag} where FamilyID = #{familyID} and Site = #{site} </update>
<delete id="deletePartFamily" parameterType="com.gaotao.modules.base.entity.PartFamilyData"> delete from PartFamily where FamilyID = #{familyID} and Site = #{site} </delete> <!-- 计量单位 --> <select id="getUMData" resultType="com.gaotao.modules.base.entity.UmData"> Select T.UMID, T.Site, T.UMName, T.Active from UM as T where T.Site in (Select Site from AccessSite where upper(UserID) = #{user}) </select>
<select id="checkUmID" resultType="com.gaotao.modules.base.entity.UmData"> select UMID, UMName from UM where UMID = #{umid} and Site = #{site} </select> <insert id="saveUMData" parameterType="com.gaotao.modules.base.entity.UmData"> INSERT INTO UM (UMID, Site, UMName, Active) values (#{umid}, #{site}, #{uMName}, #{active}) </insert> <update id="editUMData" parameterType="com.gaotao.modules.base.entity.UmData"> UPDATE UM SET Site=#{site}, UMName=#{uMName}, Active=#{active} where UMID = #{umid} and Site = #{site} </update> <select id="checkUmIDInPart" resultType="com.gaotao.modules.base.entity.PartData"> SELECT PartNo, PartDescription FROM Part where Site = #{site} and UMID = #{umid} </select> <delete id="deleteUMData" parameterType="com.gaotao.modules.base.entity.UmData"> delete from UM where UMID = #{umid} and Site = #{site} </delete> <!-- 查询-物料编码 --> <select id="searchPartNoData" resultType="com.gaotao.modules.base.entity.PartData"> Select T.PartNo,T.Site,T.PartDescription,T.Spec,T.UMID,T.Active,T.CreateDate,T.Remark,T.ConfigurationTemplateID from Part as T <where> AND T.Site in (Select Site from AccessSite where upper(UserID)=#{user}) <if test=" site != null and site != ''"> AND T.Site = #{site} </if> <if test="partNo != null and partNo != ''"> AND T.PartNo LIKE #{partNo} </if> <if test="partDescription != null and partDescription != ''"> AND T.PartDescription LIKE #{partDescription} </if> <if test="spec != null and spec != ''"> AND T.Spec LIKE #{spec} </if> <if test="active != null and active != ''"> AND T.Active = #{active} </if> <if test=" date1 != null "> AND T.CreateDate >= #{date1} </if> <if test=" date2 != null "> AND #{date2} >=T.CreateDate </if> </where>
</select>
<select id="searchPartNoDataWithPage" resultType="com.gaotao.modules.base.entity.PartData"> Select T.PartNo,T.Site,T.PartDescription,T.Spec,T.UMID,T.Active,T.CreateDate,T.Remark,T.ConfigurationTemplateID from Part as T <where> AND T.Site in (Select Site from AccessSite where upper(UserID)=#{query.user}) <if test=" query.site != null and query.site != ''"> AND T.Site = #{query.site} </if> <if test="query.partNo != null and query.partNo != ''"> AND T.PartNo LIKE #{query.partNo} </if> <if test="query.partDescription != null and query.partDescription != ''"> AND T.PartDescription LIKE #{query.partDescription} </if> <if test="query.spec != null and query.spec != ''"> AND T.Spec LIKE #{query.spec} </if> <if test="query.active != null and query.active != ''"> AND T.Active = #{query.active} </if> <if test=" query.date1 != null "> AND T.CreateDate >= #{query.date1} </if> <if test=" query.date2 != null "> AND dateadd( DAY, 1, #{query.date2} ) >T.CreateDate </if> </where>
</select> <!-- 停机原因 --> <select id="getShutDownReasonData" resultType="com.gaotao.modules.base.entity.DowntimeReasonData"> Select Site, ReasonCode, Area, ReasonDescription, Active from DowntimeReason as T where T.Site in (Select Site from AccessSite where upper(UserID) = #{user}) </select>
<select id="checkRasonCode" resultType="com.gaotao.modules.base.entity.DowntimeReasonData"> select ReasonCode, ReasonDescription from DowntimeReason where ReasonCode = #{reasonCode} and Site = #{site} </select> <insert id="saveShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> INSERT INTO DowntimeReason (Site, ReasonCode, Area, ReasonDescription, Active) values (#{site}, #{reasonCode}, #{area}, #{reasonDescription}, #{active}) </insert> <update id="editShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> UPDATE DowntimeReason SET Active=#{active}, Area=#{area}, ReasonDescription=#{reasonDescription} where ReasonCode = #{reasonCode} and Site = #{site} </update>
<delete id="deleteShutDownReasonData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> delete from DowntimeReason where ReasonCode = #{reasonCode} and Site = #{site} </delete> <!-- 物料参照信息 --> <select id="getReferencePartInfoData" resultType="com.gaotao.modules.base.entity.ReferencePartInfoData"> SELECT T.Site, T.CustomerID, T.FGPartNo, T.PartNo, T.ReferencePartDesc, T.LastUpdateBy, T.Remark, T.SupplierID, P.PartDescription, P2.PartDescription AS fGPartDescription, p.umid, S.SupplierName FROM ReferencePartInfo AS T LEFT JOIN Part AS P ON T.Site = P.Site AND T.PartNo = P.PartNo LEFT JOIN Part AS P2 ON T.Site = P2.Site AND T.FGPartNo = P2.PartNo LEFT JOIN Supplier AS S ON S.SupplierID = T.SupplierID and S.Site = T.Site WHERE T.Site IN (SELECT Site FROM AccessSite WHERE UPPER(UserID) = #{user}) </select>
<select id="getPartNoDetail" resultType="com.gaotao.modules.base.entity.PartData"> select partDescription, umid, spec, PartType_DB, MRPCode from Part Where Site = #{site} and PartNo = #{partNo} and Active = 'Y' </select>
<select id="getSupplierDetail" resultType="com.gaotao.modules.base.entity.SupplierData"> select SupplierID, SupplierName from Supplier Where Site = #{site} and SupplierID = #{supplierID} and Active = 'Y' </select>
<select id="checkReferencePartInfo" resultType="com.gaotao.modules.base.entity.ReferencePartInfoData"> select Site, PartNo from ReferencePartInfo where CustomerID = #{customerID} and Site = #{site} and FGPartNo = #{fGPartNo} and PartNo = #{partNo} </select> <insert id="saveReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> INSERT INTO ReferencePartInfo (Site, CustomerID, PartNo, ReferencePartDesc, SupplierID, FGPartNo, LastUpdateBy) values (#{site}, #{customerID}, #{partNo}, #{referencePartDesc}, #{supplierID}, #{fGPartNo}, #{user}) </insert> <update id="editReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> UPDATE ReferencePartInfo SET Site=#{site}, CustomerID=#{customerID}, PartNo=#{partNo}, ReferencePartDesc=#{referencePartDesc}, SupplierID=#{supplierID}, FGPartNo=#{fGPartNo}, LastUpdateBy=#{user} where CustomerID = #{customerID} and Site = #{site} and FGPartNo = #{fGPartNo} and PartNo = #{partNo} </update>
<delete id="deleteReferencePartInfoData" parameterType="com.gaotao.modules.base.entity.DowntimeReasonData"> delete from ReferencePartInfo where CustomerID = #{customerID} and Site = #{site} and FGPartNo = #{fGPartNo} and PartNo = #{partNo} </delete>
<!-- 生产线 --> <select id="getProductionLineData" resultType="com.gaotao.modules.base.entity.ProductionLineData"> Select T.Site, T.ProLineNo, T.ProLineDesc, T.Active, T.CreatedDate from ProductionLine as T where T.Site in (Select Site from AccessSite where upper(UserID) = #{user}) </select>
<select id="checkProLineNo" resultType="com.gaotao.modules.base.entity.ProductionLineData"> select ProLineNo, ProLineDesc from ProductionLine where ProLineNo = #{proLineNo} and Site = #{site} </select> <insert id="saveProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData"> INSERT INTO ProductionLine (Site, ProLineNo, ProLineDesc, Active, CreatedDate) values (#{site}, #{proLineNo}, #{proLineDesc}, #{active}, #{createdDate}) </insert> <update id="editProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData"> UPDATE ProductionLine SET ProLineDesc=#{proLineDesc}, Active=#{active}, CreatedDate=#{createdDate} where ProLineNo = #{proLineNo} and Site = #{site} </update>
<delete id="deleteProductionLineData" parameterType="com.gaotao.modules.base.entity.ProductionLineData"> delete from ProductionLine where ProLineNo = #{proLineNo} and Site = #{site} </delete>
<!-- 加工中心 --> <select id="getWorkCenterData" resultType="com.gaotao.modules.base.entity.WorkCenterData"> Select T.* ,P.ProLineDesc as ProductionLineDesc from WorkCenter as T LEFT JOIN ProductionLine P ON P.Site=T.Site and T.ProLineNo=P.ProLineNo <where> AND T.Site in (Select Site from AccessSite where upper(UserID)=#{user}) <if test=" site != null and site != ''"> and T.Site like #{site} </if> <if test=" workCenterNo != null and workCenterNo != ''"> and T.workCenterNo like #{workCenterNo} </if> </where> </select>
<select id="getWorkCenterResourceData" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData"> Select T.* from WorkCenterResource as T where T.Site = #{site} and T.WorkCenterNo = #{workCenterNo} </select> <select id="getProductInWorkCenterData" resultType="com.gaotao.modules.base.entity.ProductInWorkCenterData"> Select T.Site, T.PartNo, T.RevNo, D.ItemNo, D.OperationDesc, D.MachSetuptime, D.MachRunFactor, D.FactorUnit, D.Crewsize, D.Efficiency, D.Remark, T.Status, T.RoutingType from RoutingHeader as T, RoutingDetail as D Where T.Site = D.Site and T.PartNo = D.PartNo and T.RevNo = D.RevNo and T.Site = #{site} and D.WorkCenterNo = #{workCenterNo} </select> <select id="getProLineNoDetail" resultType="com.gaotao.modules.base.entity.ProductionLineData"> Select * FROM ProductionLine where Site = #{site} and ProLineNo = #{proLineNo} </select>
<select id="checkWorkCenter" resultType="com.gaotao.modules.base.entity.WorkCenterData"> select WorkCenterNo, WorkCenterDesc from WorkCenter where WorkCenterNo = #{workCenterNo} and Site = #{site} </select> <insert id="saveWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData"> INSERT INTO WorkCenter (Site, WorkCenterNo, WorkCenterDesc, WorkCenterType_DB, WorkCenterType, AverageCapacity, Efficiency, Utilization, CapacityType_DB, CapacityType, UMID, Active, Remark, CreatedDate, ProLineNo, CanCreateNewRollFlag, NeedSetupFlag) values (#{site}, #{workCenterNo}, #{workCenterDesc}, #{workCenterTypeDb}, #{workCenterType}, 0, 100, 100, 'I', '无限能力', #{umid}, #{active}, #{remark}, #{createdDate}, #{proLineNo}, #{canCreateNewRollFlag}, #{needSetupFlag}) </insert> <update id="editWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData"> UPDATE WorkCenter SET WorkCenterDesc=#{workCenterDesc}, Active=#{active}, WorkCenterType=#{workCenterNo}, WorkCenterType_DB=#{workCenterTypeDb}, Remark=#{remark}, CreatedDate=#{createdDate}, ProLineNo=#{proLineNo}, CanCreateNewRollFlag=#{canCreateNewRollFlag}, NeedSetupFlag=#{needSetupFlag} where WorkCenterNo = #{workCenterNo} and Site = #{site} </update>
<delete id="deleteWorkCenterData" parameterType="com.gaotao.modules.base.entity.WorkCenterData"> delete from WorkCenter where WorkCenterNo = #{workCenterNo} and Site = #{site} </delete>
<delete id="deleteResource" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData"> delete from WorkCenterResource where ResourceID = #{resourceID} and Site = #{site} </delete>
<update id="setResourceFlag" parameterType="com.gaotao.modules.base.entity.WorkCenterResourceData"> UPDATE WorkCenterResource SET VirturlFlag=#{virturlFlag} where ResourceID = #{resourceID} and Site = #{site} </update>
<select id="checkCustomerID" resultType="com.gaotao.modules.base.entity.PartData"> select PartNo, ConfigurationTemplateID from Part WHERE site = #{site} and ConfigurationTemplateID = #{configurationTemplateID} </select>
<select id="getCompanyInformation" resultType="com.gaotao.modules.base.entity.CompanyData"> Select * from Company <where>
<if test="companyID != null and companyID != ''"> AND companyID LIKE #{companyID} </if> <if test="companyName != null and companyName != ''"> AND companyName LIKE #{companyName} </if>
<if test="active != null and active != ''"> AND Active = #{active} </if> </where> </select> <select id="checkCompanyInformation" resultType="com.gaotao.modules.base.entity.CompanyData"> select companyID, companyName FROM Company WHERE companyID = #{companyID} </select>
<insert id="saveCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData"> INSERT INTO Company (CompanyID, CompanyName, Active, TaxNo, BankName, BankAccount, CutoffDate_DB, CutoffDate, CutoffDate_FixDate) values (#{companyID}, #{companyName}, #{active}, #{taxNo}, #{bankName}, #{bankAccount}, #{cutoffDateDb}, #{cutoffDate}, #{cutoffDateFixDate}) </insert> <update id="editCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData"> UPDATE Company SET CompanyName=#{companyName}, CutoffDate_DB=#{cutoffDateDb}, Active=#{active}, TaxNo=#{taxNo}, BankName=#{bankName}, BankAccount=#{bankAccount}, CutoffDate=#{cutoffDate}, CutoffDate_FixDate=#{cutoffDateFixDate} where CompanyID = #{companyID} </update> <delete id="deleteCompanyInformation" parameterType="com.gaotao.modules.base.entity.CompanyData"> delete from Company where CompanyID = #{companyID} </delete>
<select id="getPartFamilyList" resultType="com.gaotao.modules.base.entity.PartFamilyData"> select A.FamilyID,A.Site,A.FamilyName,A.CostType,A.CostTypeDesc,A.Active,A.BatchCreatedMethod,A.CheckPercentage from PartFamily A <where> <if test="site != null and site != ''"> and A.site = #{site,jdbcType=VARCHAR} </if> <if test="familyID != null and familyID != ''"> and A.FamilyID = #{familyID,jdbcType=VARCHAR} </if> <if test="familyName != null and familyName != ''"> and A.FamilyName = #{familyName,jdbcType=VARCHAR} </if> <if test="active != null and active != ''"> and A.Active = #{active,jdbcType=VARCHAR} </if> </where> </select>
<select id="checkConfigurationTemplateID" resultType="com.gaotao.modules.base.entity.PartData"> Select ConfigurationTemplateID from Part where ConfigurationTemplateID = #{configurationTemplateID} and site = #{site} </select>
<select id="checkCompanyInSite" resultType="com.gaotao.modules.base.entity.SiteData"> Select SiteID from site where CompanyID = #{companyID} </select> <!--=================维护工艺路线信息===================--> <select id="searchRoutingWithPartNo" resultType="com.gaotao.modules.base.entity.RoutingHeaderData"> Select top 1000 r.Site,r.PartNo,r.RevNo,r.PhaseInDate,r.PhaseOutDate,r.RoutingType_DB,r.RoutingType,r.Status,r.Status_DB, r.Defaultflag,r.Remark,r.RepairFlag,p.PartDescription+' / '+isnull(p.Spec,'') as spec,p.umid from RoutingHeader r LEFT JOIN Part p on p.partNo=r.partNo and p.site=r.site <where> <if test="partNo != null and partNo != ''"> and r.partNo like #{partNo} </if> <if test="site != null and site != ''"> and r.site = #{site} </if> <if test="revNo != null and revNo != ''"> and r.revNo = #{revNo} </if> </where> </select>
<select id="searchRoutingDetailData" resultType="com.gaotao.modules.base.entity.RoutingDetailData"> Select Site,PartNo,RevNo,ItemNo,OperationDesc,WorkCenterNo,MachSetupTime,MachRunFactor,FactorUnit_DB,FactorUnit,Efficiency, Crewsize,JJGZ_UnitFactor_DB,JJGZ_UnitFactor,JJGZ_UnitPrice,Remark,WX_PartNo,WX_UnitCost,BatchQty,dbo.Get_Part_DescSpec(Site,PartNo) as spec, dbo.Get_Part_DescSpec(site,WX_PartNo) as wxSpec,dbo.Get_WorkCenter_Type(Site,WorkCenterNo) as workCenterType ,dbo.Get_WorkCenterDesc(Site,WorkCenterNo) as workCenterDesc from RoutingDetail <where> <if test="partNo != null and partNo != ''"> and partNo like #{partNo} </if> <if test="site != null and site != ''"> and site = #{site} </if> <if test="revNo != null and revNo != ''"> and revNo = #{revNo} </if> </where> order by ItemNo </select>
<select id="checkRoutingItemNo" resultType="com.gaotao.modules.base.entity.RoutingDetailData"> Select ItemNo from RoutingDetail <where> <if test="partNo != null and partNo != ''"> and partNo like #{partNo} </if> <if test="site != null and site != ''"> and site = #{site} </if> <if test="revNo != null and revNo != ''"> and revNo = #{revNo} </if> <if test="itemNo != null and itemNo != ''"> and ItemNo = #{itemNo} </if> </where> </select>
<insert id="saveRoutingDetailData" parameterType="com.gaotao.modules.base.entity.RoutingDetailData"> insert into RoutingDetail (Site, PartNo, RevNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor, FactorUnit_DB, FactorUnit, Efficiency, Crewsize, JJGZ_UnitFactor_DB, JJGZ_UnitFactor, JJGZ_UnitPrice, Remark, WX_UnitCost, BatchQty) VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{operationDesc}, #{workCenterNo}, #{machSetupTime}, #{machRunFactor}, #{factorUnitDb}, #{factorUnit}, #{efficiency}, #{crewsize}, #{jjgzUnitFactorDb}, #{jjgzUnitFactor}, #{jjgzUnitPrice}, #{remark}, 0, 0) </insert>
<update id="editRoutingDetailData" parameterType="com.gaotao.modules.base.entity.RoutingDetailData"> UPDATE RoutingDetail <set> OperationDesc=#{operationDesc}, WorkCenterNo=#{workCenterNo}, MachSetupTime=#{machSetupTime}, MachRunFactor=#{machRunFactor}, FactorUnit_DB=#{factorUnitDb}, FactorUnit=#{factorUnit}, Efficiency=#{efficiency}, Crewsize=#{crewsize}, JJGZ_UnitFactor_DB=#{jjgzUnitFactorDb}, JJGZ_UnitFactor=#{jjgzUnitFactor}, <if test="jjgzUnitPrice!=null"> JJGZ_UnitPrice=#{jjgzUnitPrice}, </if>
Remark=#{remark} </set> WHERE partNo = #{partNo} and site = #{site} and revNo = #{revNo} and ItemNo = #{itemNo} </update>
<delete id="deleteRoutingDetail" parameterType="com.gaotao.modules.base.entity.RoutingDetailData"> delete from RoutingDetail where site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} and ItemNo = #{itemNo} </delete>
<select id="searchRoutingToolData" resultType="com.gaotao.modules.base.entity.RoutingToolData"> Select T.Site,T.RevNo,T.ItemNo,T.ToolID,P.ToolDescription,P.Spec ,T.ToolQty,P.FamilyID,dbo.Get_PartFamilyDesc(T.Site,P.FamilyID) as FamilyName,P.Active ,T.Remark,T.CreateDate,T.CreatedBy from RoutingTool as T,ToolHeader as P <where>
<if test="toolID != null and toolID != ''"> and T.ToolID = #{toolID} </if> <if test="newToolId != null and newToolId != ''"> and T.ToolID = #{newToolId} </if> <if test="itemNo != null and itemNo != ''"> and T.ItemNo = #{itemNo} </if> and T.Site=P.Site and T.ToolID=P.ToolID and T.PartNo=#{partNo} and T.Site=#{site} and T.RevNo=#{revNo} </where> </select>
<select id="searchAllResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData"> Select Site, WorkCenterNo, ResourceID, ResourceDesc, Active from WorkCenterResource where site = #{site} and WorkCenterNo = #{workCenterNo} and Active = 'Y' </select>
<select id="searchUsedResource" resultType="com.gaotao.modules.base.entity.WorkCenterResourceData"> SELECT R.ResourceID, W.ResourceDesc, W.Active FROM RoutingDetail_AvailableResource R LEFT JOIN WorkCenterResource W on W.ResourceID = R.ResourceID and R.Site = W.Site where R.site = #{site} and R.PartNo = #{partNo} and R.revNo = #{revNo} and R.itemNo = #{itemNo} </select>
<select id="checkRoutingResource" resultType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData"> SELECT site, ResourceID FROM RoutingDetail_AvailableResource where site = #{site} and PartNo = #{partNo} and revNo = #{revNo} and itemNo = #{itemNo} and ResourceID = #{resourceID} </select>
<insert id="addRoutingResource" parameterType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData"> INSERT INTO RoutingDetail_AvailableResource(Site, PartNo, RevNo, ItemNo, ResourceID) VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{resourceID}) </insert>
<delete id="deleteRoutingResource" parameterType="com.gaotao.modules.base.entity.RoutingDetailAvailableResourceData"> delete from RoutingDetail_AvailableResource where site = #{site} and PartNo = #{partNo} and revNo = #{revNo} and itemNo = #{itemNo} and ResourceID = #{resourceID} </delete>
<select id="getItemSelect" resultType="com.gaotao.modules.base.entity.RoutingDetailData"> SELECT ItemNo,OperationDesc from RoutingDetail <where>
and partNo = #{partNo}
and site = #{site}
and revNo = #{revNo}
<if test="itemNo != null and itemNo != ''"> and ItemNo = #{itemNo} </if> </where> </select>
<select id="getToolDesc" resultType="com.gaotao.modules.base.entity.ToolHeaderData"> SELECT toolID, ToolDescription, Spec FROM ToolHeader WHERE site = #{site} and toolID = #{toolID} </select>
<select id="checkToolHeader" resultType="com.gaotao.modules.base.entity.ToolHeaderData"> SELECT toolID, ToolDescription, Spec FROM ToolHeader WHERE site = #{site} and toolID = #{toolID} </select>
<insert id="saveRoutingToolData" parameterType="com.gaotao.modules.base.entity.RoutingToolData"> INSERT INTO RoutingTool(Site, PartNo, RevNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy) VALUES (#{site}, #{partNo}, #{revNo}, #{itemNo}, #{newToolId}, #{toolQty}, #{remark}, GETDATE(), #{user}) </insert>
<update id="editRoutingToolData" parameterType="com.gaotao.modules.base.entity.RoutingToolData"> update RoutingTool SET ToolQty=#{toolQty}, Remark=#{remark}, ToolID = #{newToolId} WHERE Site = #{site} and PartNo = #{partNo} and ToolID = #{toolID} and RevNo = #{revNo} and ItemNo = #{itemNo} </update>
<delete id="deleteRoutingTool" parameterType="com.gaotao.modules.base.entity.RoutingToolData"> delete from RoutingTool WHERE Site = #{site} and PartNo = #{partNo} and ToolID = #{toolID} and RevNo = #{revNo} and ItemNo = #{itemNo} </delete>
<update id="changeRoutingStatus" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData"> update RoutingHeader SET status=#{status}, status_DB=#{statusDb}, PhaseOutDate=#{phaseOutDate} where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </update>
<select id="checkRoutingStatus" resultType="com.gaotao.modules.base.entity.RoutingHeaderData"> Select top 1 Status from RoutingHeader where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </select>
<select id="shopOrderRoutingNumber" resultType="int"> Select count(1) as SL from ShopOrder as T where Site = #{site} and PartNo = #{partNo} and (Status = '已计划' or Status = '已下达') and Not exists(Select 1 from SOScheduledRouting as D Where T.Site = D.Site and T.OrderNo = D.OrderNo) and T.OrderType != 'P' </select>
<insert id="saveRoutingChangeCach"> Select Site, OrderNo, LotSize into ${tableName} from ShopOrder as T where Site = #{site} and PartNo = #{partNo} and (Status = '已计划' or Status = '已下达') and Not exists(Select 1 from SOScheduledRouting as D Where T.Site = D.Site and T.OrderNo = D.OrderNo) and T.OrderType != 'P' </insert>
<update id="updateOrderRevNo"> Update ShopOrder Set RoutingRevNo=#{revNo} from ${tableName} as T where ShopOrder.Site = T.Site and ShopOrder.OrderNo = T.OrderNo </update>
<delete id="deleteNowItemNo"> Delete SORouting from ${tableName} as T where SORouting.Site = T.Site and SORouting.OrderNo = T.OrderNo </delete>
<delete id="deleteNowToolNo"> Delete SOTool from ${tableName} as T where SOTool.Site = T.Site and SOTool.OrderNo = T.OrderNo </delete>
<insert id="saveNewItemNo"> Insert into SORouting( Site, OrderNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor , FactorUnit_DB, FactorUnit, TimeRequired, TimeReported, Efficiency, Remark, QtyRequired , QtyReported, QtyApprove , PlanStartTime, PlanFinishTime, BarcodeID, PartNo, ClosedFlag, OutWorkFlag, OutWorkPartNo , QtyOnPR, QtyOnPO, QtyScrapt, Crewsize , PreItemNo, NextItemNo, ScheduledFlag, QtyScheduled) Select T.Site , D.OrderNo , ItemNo , OperationDesc , WorkCenterNo , MachSetupTime , MachRunFactor , FactorUnit_DB , FactorUnit , (MachSetupTime + (Case when MachRunFactor = 0 then 0 else (Case when FactorUnit_DB = '1' then D.LotSize / MachRunFactor when FactorUnit_DB = '2' then D.LotSize * MachRunFactor when FactorUnit_DB = '3' then MachRunFactor end) end) / (Efficiency / 100)) as TimeRequired , 0 , Efficiency , Remark , D.LotSize , 0 , 0 , 0 , 0 , (Case when len(OrderNo) > 10 then D.Site + '-' + D.OrderNo + '-' + dbo.Get_PadL(ItemNo, 4, '0') else D.Site + '-' + dbo.Get_PadL(D.OrderNo, 10, '0') + '-' + dbo.Get_PadL(ItemNo, 4, '0') end) , T.PartNo , 'N' , (Case when dbo.Get_WorkCenter_TypeDB(T.Site, WorkCenterNo) = 'O' then 'Y' else 'N' end) as OutWorkFlag , WX_PartNo as OutWorkPartNo , 0.0 as QtyOnPR , 0.0 as QtyOnPO , 0.0 as QtyScrapt , Crewsize , Isnull((Select Max(D.ItemNo) as PreItemNo from RoutingDetail as D Where D.Site = T.Site and D.PartNo = T.PartNo and D.RevNo = T.RevNo and T.ItemNo > D.ItemNo), 0) , Isnull((Select Min(D.ItemNo) as NextItemNo from RoutingDetail as D Where D.Site = T.Site and D.PartNo = T.PartNo and D.RevNo = T.RevNo and D.ItemNo > T.ItemNo), 0) , 'N' , 0 from RoutingDetail as T, ${tableName} as D Where D.Site = T.Site and T.site = #{site} and T.PartNo = #{partNo} and T.RevNo = #{revNo} </insert>
<insert id="saveNewTool"> Insert into SOTool(Site, OrderNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy) Select T.Site, D.OrderNo, ItemNo, ToolID, ToolQty, Remark, getdate(), #{user} from RoutingTool as T, ${tableName} as D Where D.Site = T.Site and T.site = #{site} and T.PartNo = #{partNo} and T.RevNo = #{revNo} </insert>
<delete id="deleteRoutingChangeCach"> Drop table ${tableName} </delete>
<select id="checkRoutingRevNo" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData" resultType="com.gaotao.modules.base.entity.RoutingHeaderData"> Select Site, PartNo from RoutingHeader where Site = #{site} and PartNo = #{partNo1} and RevNo = #{revNo1} </select>
<insert id="copyBom" parameterType="com.gaotao.modules.base.entity.CopyRoutingData"> Insert into RoutingHeader(Site, PartNo, RevNo, PhaseInDate, PhaseOutDate, RoutingType_DB, RoutingType, Status, Status_DB, Remark, Defaultflag, RepairFlag) Select Site, #{partNo1}, #{revNo1}, #{phaseInDate1}, null, RoutingType_DB, RoutingType, '试验', 'T', '', #{oldFlag1}, #{repairFlag1} FROM RoutingHeader where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </insert>
<insert id="copyRoutingDetail" parameterType="com.gaotao.modules.base.entity.CopyRoutingData"> Insert into RoutingDetail(Site, PartNo, RevNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor, FactorUnit_DB, FactorUnit, Efficiency, Crewsize, Remark, WX_PartNo, WX_UnitCost) Select Site, #{partNo1}, #{revNo1}, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor, FactorUnit_DB, FactorUnit, Efficiency, Crewsize, Remark, WX_PartNo, WX_UnitCost from RoutingDetail where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </insert>
<insert id="copyRoutingTool" parameterType="com.gaotao.modules.base.entity.CopyRoutingData"> Insert into RoutingTool(Site, PartNo, RevNo, ItemNo, ToolID, ToolQty, Remark, CreateDate, CreatedBy) Select Site, #{partNo1}, #{revNo1}, ItemNo, ToolID, ToolQty, Remark, getdate(), #{user} from RoutingTool where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </insert>
<insert id="copyAvailableResource" parameterType="com.gaotao.modules.base.entity.CopyRoutingData"> Insert into RoutingDetail_AvailableResource(Site, PartNo, RevNo, ItemNo, ResourceID) Select Site, #{partNo1}, #{revNo1}, ItemNo, ResourceID from RoutingDetail_AvailableResource as T where T.Site = #{site} and T.PartNo = #{partNo} and T.RevNo = #{revNo} </insert>
<update id="closeOldBom" parameterType="com.gaotao.modules.base.entity.CopyRoutingData"> Update RoutingHeader Set PhaseOutDate=(Case when Status_DB != 'S' then #{phaseInDate1} else PhaseOutDate end), Status_DB='S', Status='停用', DefaultFlag='N' where Site = #{site} and PartNo = #{partNo1} and RevNo = #{revNo} </update>
<select id="checkRoutingDefaultFlag" resultType="com.gaotao.modules.base.entity.RoutingHeaderData"> SELECT top 1 Defaultflag FROM RoutingHeader where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </select>
<update id="setDefault"> update RoutingHeader set Defaultflag = case when RevNo = #{revNo} then 'Y' else 'N' end where Site = #{site} and PartNo = #{partNo} </update>
<insert id="saveRoutingHeaderData" parameterType="com.gaotao.modules.base.entity.RoutingHeaderData"> insert into RoutingHeader(Site, PartNo, RevNo, PhaseInDate, PhaseOutDate, RoutingType_DB, RoutingType, Status, Status_DB, Defaultflag, Remark, RepairFlag) VALUES (#{site}, #{partNo}, #{revNo}, #{phaseInDate}, #{phaseOutDate}, #{routingTypeDb}, #{routingType}, #{status}, #{statusDb}, #{defaultflag}, #{remark}, #{repairFlag}) </insert>
<update id="updateRoutingHeaderData"> update RoutingHeader SET PhaseInDate=#{phaseInDate}, PhaseOutDate=#{phaseOutDate}, Remark=#{remark}, RepairFlag=#{repairFlag} where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </update>
<update id="cancelDefault"> update RoutingHeader set Defaultflag = 'N' where Site = #{site} and PartNo = #{partNo} </update>
<delete id="deleteRoutingHeaderData"> DELETE FROM RoutingHeader where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </delete>
<delete id="deleteRoutingDetailData"> DELETE FROM RoutingDetail where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </delete>
<delete id="deleteRoutingToolAll"> DELETE FROM RoutingTool where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </delete>
<delete id="deleteRoutingResourceAll"> DELETE FROM RoutingDetail_AvailableResource where Site = #{site} and PartNo = #{partNo} and RevNo = #{revNo} </delete>
<select id="getCalendarExceptionShiftData" resultType="CalendarExceptionShiftData"> select Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime, EndExactTime from Calendar_Exception_Shift where site = #{site} and CalendarID = #{calendarId} and ScheduleDate = #{scheduledate} </select>
<select id="findCalendarExceptionShiftData" resultType="CalendarExceptionShiftData"> select Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime, EndExactTime from Calendar_Exception_Shift where site = #{site} and CalendarID = #{calendarId} and ScheduleDate = #{scheduledate} and ShiftNo != #{shiftno} </select>
<update id="updateCESShift" parameterType="CalendarExceptionShiftData"> UPDATE Calendar_Exception_Shift set startexacttime=#{startexacttime} , endexacttime=#{endexacttime} , starttime=#{starttime} , endtime=#{endtime} where site = #{site} and CalendarID = #{calendarId} and ScheduleDate = #{scheduledate} and ShiftNo = #{shiftno} </update>
<select id="getSORoutingData" resultType="com.gaotao.modules.base.entity.SORoutingData"> select Site,OrderNo,ItemNo,OperationDesc,WorkCenterNo,MachSetupTime,MachRunFactor,FactorUnit_DB,FactorUnit,QtyRequired, QtyReported,QtyApprove,TimeRequired,TimeReported,Efficiency,PlanStartTime,PlanFinishTime,BarcodeID,Remark,PartNo, Crewsize,ClosedFlag,ActionNotes,QtyScrapt,OutWorkFlag,OutWorkPartNo,QtyOnPR,QtyOnPO,PreItemNo,NextItemNo,ScheduledFlag, QtyScheduled,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo,dbo.Get_WorkCenterDesc(Site,WorkCenterNo) as WorkCenterDesc from SORouting <where>
and site = #{site}
<if test="orderNo != null and orderNo != ''"> and OrderNo = #{orderNo} </if> </where> </select>
<select id="checkSORoutingItemNo" resultType="com.gaotao.modules.base.entity.SORoutingData"> Select ItemNo from SORouting <where> <if test="orderNo != null and orderNo != ''"> and OrderNo = #{orderNo} </if> <if test="site != null and site != ''"> and site = #{site} </if>
<if test="itemNo != null and itemNo != ''"> and ItemNo = #{itemNo} </if> </where> </select>
<select id="getMaxSORoutingItemNo" resultType="com.gaotao.modules.base.entity.SORoutingData"> Select IsNull(MAX(ItemNo),0) as ItemNo from SORouting <where> <if test="orderNo != null and orderNo != ''"> and OrderNo = #{orderNo} </if> <if test="site != null and site != ''"> and site = #{site} </if>
</where> </select>
<insert id="saveSORoutingData" parameterType="SORoutingData"> insert into SORouting(Site, OrderNo, ItemNo, OperationDesc, WorkCenterNo, MachSetupTime, MachRunFactor, FactorUnit_DB, FactorUnit, QtyRequired, QtyReported, QtyApprove, TimeRequired, TimeReported, Efficiency, PlanStartTime, PlanFinishTime, BarcodeID, Remark, PartNo, Crewsize, ClosedFlag, QtyScrapt, OutWorkFlag, OutWorkPartNo, QtyOnPR, QtyOnPO, PreItemNo, NextItemNo, ScheduledFlag, QtyScheduled) values (#{site}, #{orderNo}, #{itemNo}, #{operationDesc}, #{workCenterNo}, #{machSetupTime}, #{machRunFactor}, #{factorUnitDb}, #{factorUnit}, #{lotSize}, 0, 0, dbo.Get_Routing_TimeRequired(#{site}, #{lotSize}, #{machSetupTime}, #{machRunFactor}, #{factorUnit}, #{efficiency}), 0, #{efficiency}, #{planStartTime}, #{planFinishTime}, #{barcodeID}, #{remark}, #{partNo}, #{crewsize}, 'N', 0, 'N', '', 0, 0, #{preItemNo}, 0, 'N', 0) </insert>
<update id="updateSORoutingData" parameterType="SORoutingData"> update SORouting SET OperationDesc=#{operationDesc}, WorkCenterNo=#{workCenterNo}, MachSetupTime=#{machSetupTime}, FactorUnit_DB=#{factorUnitDb}, FactorUnit=#{factorUnit}, MachRunFactor=#{machRunFactor}, PlanStartTime=#{planStartTime}, PlanFinishTime=#{planFinishTime}, Efficiency=#{efficiency}, Crewsize=#{crewsize}, Remark=#{remark}, TimeRequired=dbo.Get_Routing_TimeRequired(#{site}, #{lotSize}, #{machSetupTime}, #{machRunFactor}, #{factorUnit}, #{efficiency}) where OrderNo = #{orderNo} and site = #{site} and ItemNo = #{itemNo} </update>
<update id="updateSORoutingDataNextItemNo" parameterType="SORoutingData"> update SORouting SET NextItemNo=#{itemNo} where OrderNo = #{orderNo} and site = #{site} and ItemNo = #{preItemNo} </update>
<select id="getShopOrderLotSize" resultType="float"> select top 1 isNull(LotSize, 0) as lotSize FROM ShopOrder where site = #{site} and orderNo = #{orderNo} </select>
<select id="searchSORoutingResource" resultType="SORoutingAvailableResourceData"> select R.Site, R.OrderNo, R.ItemNo, R.ResourceID, W.ResourceDesc, W.Active from SORouting_AvailableResource R LEFT JOIN WorkCenterResource W on W.ResourceID = R.ResourceID and R.Site = W.Site where R.site = #{site} and R.orderNo = #{orderNo} and R.ItemNo = #{itemNo} </select> <select id="checkSORoutingResource" resultType="SORoutingAvailableResourceData"> select Site, OrderNo, ItemNo, ResourceID from SORouting_AvailableResource where site = #{site} and orderNo = #{orderNo} and ItemNo = #{itemNo} and ResourceID = #{resourceID} </select>
<insert id="addSORoutingResource"> insert into SORouting_AvailableResource(Site, OrderNo, ItemNo, ResourceID) values (#{site}, #{orderNo}, #{itemNo}, #{resourceID}) </insert> <delete id="deleteSORoutingResource"> delete from SORouting_AvailableResource where site = #{site} and orderNo = #{orderNo} and ItemNo = #{itemNo} and ResourceID = #{resourceID} </delete>
<select id="getSORoutingRevNo" resultType="com.gaotao.modules.base.entity.RoutingHeaderData"> Select B.site , B.PartNo , P.PartDescription + ' / ' + P.Spec as PartDesc , B.RevNo , B.PhaseInDate , B.PhaseOutDate , B.Status , B.Remark , Cast(#{orderNo} as Varchar(20)) as OrderNo , B.RoutingType_DB , B.RoutingType , B.RepairFlag from RoutingHeader as B, Part as P where B.Site = P.Site and B.PartNo = P.PartNo and B.Site = #{site} and B.PartNo = #{partNo} and (B.RoutingType_DB = 'M') and B.RepairFlag = 'N' and B.Status_DB = 'B' </select>
<select id="checkSOSchedule" resultType="SOScheduledRoutingData"> Select Site from SOScheduledRouting Where Site = #{site} and OrderNo = #{orderNo} and itemNo = #{itemNo} </select>
<select id="checkSORouting" resultType="SORoutingData"> Select isnull(QtyReported, 0.0) as QtyReported, isnull(TimeReported, 0.0) as TimeReported, dbo.Get_WorkCenter_Type(Site, WorkCenterNo) as WorkCenter_Type from SORouting Where Site = #{site} and OrderNo = #{orderNo} and itemNo = #{itemNo} </select>
<select id="checkPRDetail" resultType="PRDetail"> Select Site from PRDetail Where Site = #{site} and OrderRef1 = #{orderNo} and OrderRef2 = #{itemNo} and OrderRefType = '生产订单-工序外协' </select>
<select id="checkSORoutingAvailableResourceData" resultType="SORoutingAvailableResourceData"> Select Site from SORouting_AvailableResource as T Where Site = #{site} and OrderNo = #{orderNo} and itemNo = #{itemNo} </select>
<select id="checkSOTool" resultType="SOToolData"> SELECT site from SOTool Where Site = #{site} and OrderNo = #{orderNo} and itemNo = #{itemNo} </select>
<select id="checkShopOrder" resultType="ShopOrderData"> Select top 1 Status, isnull(CostRollUpFlag, 'N') as CostRollUpFlag, OrderType from ShopOrder as T Where T.Site = #{site} and T.OrderNo = #{orderNo} </select>
<delete id="deleteSORouting"> DELETE FROM SORouting Where Site = #{site} and OrderNo = #{orderNo} and itemNo = #{itemNo} </delete>
<update id="updateSORoutingNextLast"> Update SORouting Set PreItemNo = Isnull((Select Max(D.ItemNo) as PreItemNo from SORouting as D Where D.Site = SORouting.Site and D.OrderNo = SORouting.OrderNo and SORouting.ItemNo > D.ItemNo), 0) , NextItemNo = Isnull((Select Min(D.ItemNo) as NextItemNo from SORouting as D Where D.Site = SORouting.Site and D.OrderNo = SORouting.OrderNo and D.ItemNo > SORouting.ItemNo), 0) where Site = #{site} and OrderNo = #{orderNo} </update>
<select id="getCalendarDatetypeInfo" resultType="com.gaotao.modules.base.entity.CalendarDatetypeOutData"> SELECT Site ,DateType ,ExceptTime1 ,ExceptDuration1 ,ExceptTime2 ,ExceptDuration2 ,ExceptTime3 ,ExceptDuration3 ,ExceptTime4 ,ExceptDuration4 ,ExceptTime5 ,ExceptDuration5 ,ExceptTime6 ,ExceptDuration6 ,WorkTime ,Remark ,exceptexacttime1 ,exceptexacttime2 ,exceptexacttime3 ,exceptexacttime4 ,exceptexacttime5 ,exceptexacttime6 ,StartTime ,EndTime ,StartExactTime ,EndExactTime FROM calendar_datetype <where> site = #{site} and datetype = #{datetype} </where> </select>
<update id="updateWorkingCalendar"> update calendar_exception set excepttime1 = #{excepttime1} , exceptduration1 = #{exceptduration1} , excepttime2 = #{excepttime2} , exceptduration2 = #{exceptduration2} , excepttime3 = #{excepttime3} , exceptduration3 = #{exceptduration3} , excepttime4 =#{excepttime4} , exceptduration4 =#{exceptduration4} , excepttime5 = #{excepttime5} , exceptduration5 =#{exceptduration5} , excepttime6 = #{excepttime6} , exceptduration6 = #{exceptduration6} , worktime =#{worktime} , datetype = #{datetype} , exceptexacttime1 =#{exceptexacttime1} , exceptexacttime2 = #{exceptexacttime2} , exceptexacttime3 = #{exceptexacttime3} , exceptexacttime4 = #{exceptexacttime4} , exceptexacttime5 = #{exceptexacttime5} , exceptexacttime6 = #{exceptexacttime6} where site = #{site} AND CalendarID = #{calendarId} AND scheduledate = #{scheduledate}
</update>
<!--查询标签定义的相关信息--> <select id="getLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark FROM ReportFileList <where> <if test="labelNo != null and labelNo != ''"> and ReportID LIKE #{labelNo} </if> <if test="labelType != null and labelType != ''"> and ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and Reportfile LIKE #{labelName} </if> </where> ORDER BY ReportID ASC </select>
<!--查询标签定义的相关信息按照标签的编码--> <select id="getLabelSettingByLabelNo" parameterType="java.lang.String" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark FROM ReportFileList <where> AND ReportID = #{labelNo} </where> </select>
<!--插入标签自定义的数据--> <insert id="insertLabelSetting" parameterType="LabelSettingData"> INSERT INTO ReportFileList(ReportID, ReportFamily, Reportfile, ReportType, Remark) VALUES (#{labelNo}, #{labelType}, #{labelName}, #{labelClass}, #{remark}) </insert>
<!--修改标签自定义的信息--> <update id="updateLabelSetting" parameterType="LabelSettingData"> UPDATE ReportFileList SET ReportFamily = #{labelType}, Reportfile = #{labelName}, ReportType = #{labelClass}, Remark = #{remark} <where> AND ReportID = #{labelNo} </where> </update>
<!--删除标签定义的主表信息--> <delete id="deleteLabelSettingByLabelNo" parameterType="java.lang.String"> DELETE FROM ReportFileList <where> AND ReportID = #{labelNo} </where> </delete>
<!--查询标签的默认配置信息--> <select id="getDefaultLabelSettingList" parameterType="DefaultLabelSettingData" resultType="DefaultLabelSettingData"> SELECT rfd.ReportFamily labelType, rfd.ReportID labelNo, rfl.ReportType labelClass, rfl.Reportfile labelName, rfd.Remark remark, rfd.SubReportFlag subLabelFlag, rfd.ParentReportID parentLabelNo FROM ReportFileDefDefault rfd LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ReportID <where> AND rfl.ReportID = rfd.ReportID <if test="labelNo != null and labelNo != ''"> and rfd.ReportID LIKE #{labelNo} </if> <if test="labelType != null and labelType != ''"> and rfd.ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and rfl.Reportfile LIKE #{labelName} </if> </where> ORDER BY rfd.ReportFamily ASC </select>
<!--插入默认标签配置信息--> <insert id="insertDefaultLabelSetting" parameterType="DefaultLabelSettingData"> INSERT INTO ReportFileDefDefault(FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID) VALUES ('*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo}) </insert>
<!--修改默认标签配置信息--> <update id="updateDefaultLabelSetting" parameterType="DefaultLabelSettingData"> UPDATE ReportFileDefDefault SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark = #{remark} <where> AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*' </where> </update>
<!--删除默认标签配置信息--> <delete id="deleteDefaultLabelSetting" parameterType="DefaultLabelSettingData"> DELETE FROM ReportFileDefDefault <where> AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*' </where> </delete>
<!--查询标签的客制化配置信息--> <select id="getCustomerLabelSettingList" parameterType="CustomerLabelSettingData" resultType="CustomerLabelSettingData"> SELECT rfc.ReportFamily labelType, rfc.CustomerID customerId, dbo.Get_CustomerDesc(rfc.Site, rfc.CustomerID) customerDesc, rfc.ReportID labelNo, rfl.Reportfile labelName, rfl.ReportType labelClass, rfc.Site site, rfc.Remark remark, rfc.SubReportFlag subLabelFlag, rfc.ParentReportID parentLabelNo FROM ReportFileDefCustomer rfc LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfc.ReportID AND rfl.ReportFamily = rfc.ReportFamily <where> AND rfl.ReportID = rfc.ReportID <if test="customerId != null and customerId != ''"> and rfc.CustomerID LIKE #{customerId} </if> <if test="labelNo != null and labelNo != ''"> and rfc.ReportID LIKE #{labelNo} </if> <if test="labelType != null and labelType != ''"> and rfc.ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and rfl.Reportfile LIKE #{labelName} </if> </where> ORDER BY rfc.CustomerID ASC </select>
<!--插入客制化标签配置信息--> <insert id="insertCustomerLabelSetting" parameterType="CustomerLabelSettingData"> INSERT INTO ReportFileDefCustomer(Site, CustomerID, FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID) VALUES (#{site}, #{customerId}, '*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo}) </insert>
<!--修改客制化标签配置信息--> <update id="updateCustomerLabelSetting" parameterType="CustomerLabelSettingData"> UPDATE ReportFileDefCustomer SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark = #{remark} <where> AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*' </where> </update>
<!--删除客制化标签配置信息--> <delete id="deleteCustomerLabelSetting" parameterType="CustomerLabelSettingData"> DELETE FROM ReportFileDefCustomer <where> AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*' </where> </delete>
<!--查询标签的客制化配置信息--> <select id="getUserLabelPrinters" parameterType="UserLabelPrinterData" resultType="UserLabelPrinterData"> SELECT rfp.UserID userId, ssu.user_display userDisplay, rfp.ReportID labelNo, rfl.Reportfile labelName, rfl.ReportType labelClass, rfp.NewPrinterName printerName, rfp.IPAddress ipAddress FROM ReportFileList_UserPrinter rfp LEFT JOIN sys_user ssu ON ssu.username = rfp.UserID LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfp.ReportID <where> AND rfl.ReportID = rfp.ReportID <if test='"admin".equalsIgnoreCase(username)'>
</if> <if test='!"admin".equalsIgnoreCase(username)'> and rfp.UserID = #{username} </if> <if test="userId != null and userId != ''"> and rfp.UserID LIKE #{userId} </if> <if test="labelNo != null and labelNo != ''"> and rfp.ReportID LIKE #{labelNo} </if> <if test="labelName != null and labelName != ''"> and rfl.Reportfile LIKE #{labelName} </if> </where> ORDER BY rfp.ReportID ASC </select>
<!--按照userId 查询用户的信息--> <select id="getSysUserDataByUserId" parameterType="UserLabelPrinterData" resultType="SysUserData"> SELECT user_id, username, password, salt, email, mobile, status, create_user_id, create_time, language_default, site, user_display FROM sys_user <where> AND username = #{userId} </where> </select>
<!--插入用户的标签打印机参数--> <insert id="insertUserLabelPrinter" parameterType="UserLabelPrinterData"> INSERT INTO ReportFileList_UserPrinter(ReportID, UserID, PrinterName, IPAddress, NewPrinterName) VALUES (#{labelNo}, #{userId}, '', #{ipAddress}, #{printerName}) </insert>
<!--修改用户的标签打印机参数--> <update id="updateUserLabelPrinter" parameterType="UserLabelPrinterData"> UPDATE ReportFileList_UserPrinter SET IPAddress = #{ipAddress}, NewPrinterName = #{printerName} <where> AND ReportID = #{labelNo} AND UserID = #{userId} </where> </update>
<!--删除用户标签的打印机的信息--> <delete id="deleteUserLabelPrinter" parameterType="UserLabelPrinterData"> DELETE FROM ReportFileList_UserPrinter <where> AND ReportID = #{labelNo} AND UserID = #{userId} </where> </delete>
<!--获取标签打印参数配置信息--> <select id="getLabelParameterList" parameterType="LabelParameterData" resultType="LabelParameterData"> SELECT ReportID labelNo, ItemNo itemNo, ShowSeqNo showSeqNo, ParameterDesc parameterDesc, ParameterName parameterName, ValueType_DB valueTypeDb, ValueType valueType, OptionValue optionValue, DefaultValue defaultValue FROM ReportParameters <where> AND ReportID = #{labelNo} </where> ORDER BY ItemNo </select>
<!--插入标签的打印参数--> <insert id="insertLabelPrintParameter" parameterType="LabelParameterData"> INSERT INTO ReportParameters(ReportID, ItemNo, ShowSeqNo, ParameterDesc, ParameterName, ValueType_DB, ValueType, OptionValue, DefaultValue) VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{parameterDesc}, #{parameterName}, #{valueTypeDb}, #{valueType}, #{optionValue}, #{defaultValue}) </insert>
<!--修改标签打印参数的信息--> <update id="updateLabelPrintParameter" parameterType="LabelParameterData"> UPDATE ReportParameters SET OptionValue = #{optionValue}, DefaultValue = #{defaultValue}, ShowSeqNo = #{showSeqNo} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </update>
<!--删除标签打印参数的信息--> <delete id="deleteLabelPrintParameter" parameterType="LabelParameterData"> DELETE FROM ReportParameters <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </delete>
<!--查询标签内容定义列表--> <select id="getLabelContentList" parameterType="LabelContentData" resultType="LabelContentData"> SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup, DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue, ReportID labelNo FROM ReportContentItem <where> AND ReportID = #{labelNo} </where> ORDER BY ItemNo </select>
<!--插入标签内容定义--> <insert id="insertLabelContent" parameterType="LabelContentData"> INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval]) VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{itemDesc}, #{objectName}, #{objectGroup}, #{dbFieldName}, #{sequenceNoFlag}, #{sequenceBits}, #{intervalValue}) </insert>
<!--修改标签的打印参数--> <update id="updateLabelContent" parameterType="LabelContentData"> UPDATE ReportContentItem SET ShowSeqNo = #{showSeqNo}, ObjectName = #{objectName}, ObjectGroup = #{objectGroup}, DBFieldName = #{dbFieldName}, SequenceNoflag = #{sequenceNoFlag}, SequenceBits = #{sequenceBits}, [Interval] = #{intervalValue}, ItemDesc = #{itemDesc} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </update>
<!--删除标签打印参数的信息--> <delete id="deleteLabelContent" parameterType="LabelContentData"> DELETE FROM ReportContentItem <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </delete>
<!--查询可以复制的标签内容定义--> <select id="getCopyLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark FROM ReportFileList <where> AND ReportID != #{labelNo} AND ReportFamily = #{labelType} AND ReportType = #{labelClass} </where> ORDER BY ReportID ASC </select>
<!--首先删除原标签内容定义--> <delete id="deleteLabelAllContentsByLabelNo" parameterType="LabelSettingData"> DELETE FROM ReportContentItem <where> AND ReportID = #{labelNo} </where> </delete>
<!--复制其他标签的标签内容定义--> <insert id="copyLabelAllContentsWithOther" parameterType="LabelSettingData"> INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval]) SELECT #{labelNo}, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval] FROM ReportContentItem WHERE ReportID = #{newLabelNo} </insert>
<!--获取要用的标签内容--> <select id="getUsedLabelContent" parameterType="LabelContentData" resultType="LabelContentData"> SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup, DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue, ReportID labelNo FROM ReportContentItem <where> AND ReportID = #{labelNo} AND ItemNo != #{itemNo} </where> ORDER BY ItemNo </select>
<!--获取标签内容的流水号规则--> <select id="getLabelContentSerialRule" parameterType="LabelContentData" resultType="LabelContentSerialRuleData"> SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.SeqNo seqNo, rcs.ObjectName objectName FROM ReportContentItem_SeqRule rcs <where> AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo} </where> ORDER BY rcs.SeqNo </select>
<!--删除标签内容的流水号规则--> <delete id="deleteLabelContentSerialRule" parameterType="LabelContentSerialRuleData"> DELETE FROM ReportContentItem_SeqRule <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND SeqNo = #{seqNo} </where> </delete>
<!--获取标签内容的流水号信息--> <select id="getLabelSerialInfos" parameterType="LabelContentData" resultType="LabelContentSerialInfoData"> SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.KeyInfo keyInfo, rcs.LastSeqNo lastSeqNo FROM ReportFile_SeqInfo rcs <where> AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo} </where> </select> <select id="getPartNoRouteInMaxItemNo" resultType="java.lang.String"> SELECT MAX(ItemNo) FROM RoutingDetail WHERE site =#{site} AND partNo = #{partNo} AND revNo = #{revNo} </select>
<!--插入标签流水号信息--> <insert id="insertLabelSerialInfo" parameterType="LabelContentSerialInfoData"> INSERT INTO ReportFile_SeqInfo(ReportID, ItemNo, KeyInfo, LastSeqNo) VALUES (#{labelNo}, #{itemNo}, #{keyInfo}, #{lastSeqNo}) </insert>
<!--修改标签流水号信息--> <update id="updateLabelSerialInfo" parameterType="LabelContentSerialInfoData"> UPDATE ReportFile_SeqInfo SET KeyInfo = #{keyInfo}, LastSeqNo = #{lastSeqNo} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{oriKeyInfo} </where> </update>
<!--删除标签流水号信息--> <delete id="deleteLabelSerialInfo" parameterType="LabelContentSerialRuleData"> DELETE FROM ReportFile_SeqInfo <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{keyInfo} </where> </delete>
<insert id="saveCalendarExceptionShift">
INSERT INTO Calendar_Exception_Shift(Site, CalendarID, ShiftNo, ScheduleDate, ShiftDesc, StartExactTime, EndExactTime, StartTime, EndTime) SELECT site, #{calendarId}, ShiftNo, #{scheduledate}, ShiftDesc, StartExactTime, EndExactTime, StartTime, EndTime FROM Calendar_DateType_Shift WHERE DateType = #{datetype} AND site = #{site}
</insert> <delete id="deleteCalendarExceptionShift"> DELETE Calendar_Exception_Shift WHERE site = #{site} AND CalendarID = #{calendarId} AND scheduledate = #{scheduledate} </delete></mapper>
|