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.
323 lines
13 KiB
323 lines
13 KiB
<?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.heai.modules.taskmanage.dao.TaskDetailDao">
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
<resultMap type="com.heai.modules.taskmanage.entity.TaskDetailEntity" id="taskListMap">
|
|
<result property="id" column="id"/>
|
|
<result property="department" column="department"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createdDate" column="created_date"/>
|
|
<result property="createdBy" column="created_by"/>
|
|
<result property="updatedDate" column="updated_date"/>
|
|
<result property="updatedBy" column="updated_by"/>
|
|
</resultMap>
|
|
<select id="taskDetailList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
|
|
|
|
select td.id
|
|
, tl.project
|
|
, tl.customer
|
|
, isnull(u2.username,tl.task_initiator) task_initiator
|
|
, tl.task_description
|
|
, td.department
|
|
, tl.required_completion_date
|
|
, td.status
|
|
, td.final_status
|
|
, tl.task_start_date
|
|
, tl.created_date
|
|
, tl.created_by
|
|
, tl.updated_date
|
|
, tl.updated_by
|
|
, tl.task_header
|
|
, u.username responsible_person
|
|
,( u.department + ' | ' + u.username) as dep_user_name
|
|
, td.task_id
|
|
, dbo.Get_chat_LastType(td.site,td.id,td.created_by) chatLastType
|
|
,tl.AllowCloseByHand,tl.OrderRef1,tl.OrderRef2,
|
|
tl.OrderRef3,tl.OrderRefType,tl.OrderRef4
|
|
from task_detail td
|
|
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
|
|
left join users u on td.site = u.site and u.userId = td.responsible_person
|
|
left join users u2 on td.site = u2.site and u2.userId = tl.task_initiator
|
|
LEFT JOIN report_mapping_ipaddress rmi on rmi.department = u.department
|
|
<where>
|
|
td.site = #{site}
|
|
and tl.created_date>DATEADD(dd, -60, GetDate())
|
|
and (tl.created_by=td.responsible_person OR dbo.Get_chat_LastType(td.site,td.id,td.created_by)!='有新回复')
|
|
<if test="ipAddress != null and ipAddress != ''">
|
|
and rmi.ipaddress like #{ipAddress}
|
|
</if>
|
|
<if test="taskInitiator != null and taskInitiator != ''">
|
|
and tl.created_by like #{taskInitiator}
|
|
</if>
|
|
<if test="department != null and department != ''">
|
|
and u.department like #{department}
|
|
</if>
|
|
<if test="customer != null and customer != ''">
|
|
and tl.customer like #{customer}
|
|
</if>
|
|
<if test="project != null and project != ''">
|
|
and tl.project like #{project}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
and td.status = #{status}
|
|
</if>
|
|
<if test="finalStatus != null and finalStatus != ''">
|
|
and td.final_status = #{finalStatus}
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
and UPPER(td.responsible_person) like UPPER(#{responsiblePerson})
|
|
</if>
|
|
<if test="startDate !=null ">
|
|
and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
|
|
</if>
|
|
<if test="endDate !=null ">
|
|
and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
|
|
</if>
|
|
<if test="finishStartDate != null ">
|
|
and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
|
|
</if>
|
|
<if test="finishEndDate != null ">
|
|
and tl.required_completion_date <![CDATA[ <= ]]> #{finishEndDate}
|
|
</if>
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="taskDetailListPC" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
|
|
|
|
select td.id
|
|
, tl.project
|
|
, tl.customer
|
|
, isnull(u2.username,tl.task_initiator) task_initiator
|
|
, tl.task_description
|
|
, td.department
|
|
, tl.required_completion_date
|
|
, td.status
|
|
, td.final_status
|
|
, tl.task_start_date
|
|
, tl.created_date
|
|
, tl.created_by
|
|
, tl.updated_date
|
|
, tl.updated_by
|
|
, tl.task_header
|
|
, u.username responsible_person
|
|
,( u.department + ' | ' + u.username) as dep_user_name
|
|
, td.task_id
|
|
, dbo.Get_chat_LastType(td.site,td.id,td.created_by) chatLastType
|
|
,tl.AllowCloseByHand,tl.OrderRef1,tl.OrderRef2,
|
|
tl.OrderRef3,tl.OrderRefType,tl.OrderRef4,tl.taskType,tl.oldSpec,tl.newSpec
|
|
from task_detail td
|
|
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
|
|
left join users u on td.site = u.site and u.userId = td.responsible_person
|
|
left join users u2 on td.site = u2.site and u2.userId = tl.task_initiator
|
|
LEFT JOIN report_mapping_ipaddress rmi on rmi.department = u.department
|
|
<where>
|
|
td.site = #{site}
|
|
|
|
<if test="ipAddress != null and ipAddress != ''">
|
|
and rmi.ipaddress like #{ipAddress}
|
|
</if>
|
|
<if test="taskInitiator != null and taskInitiator != ''">
|
|
and tl.created_by like #{taskInitiator}
|
|
</if>
|
|
<if test="department != null and department != ''">
|
|
and u.department like #{department}
|
|
</if>
|
|
<if test="customer != null and customer != ''">
|
|
and tl.customer like #{customer}
|
|
</if>
|
|
<if test="taskType != null and taskType != ''">
|
|
and tl.taskType like #{taskType}
|
|
</if>
|
|
<if test="oldSpec != null and oldSpec != ''">
|
|
and tl.oldSpec like #{oldSpec}
|
|
</if>
|
|
<if test="newSpec != null and newSpec != ''">
|
|
and tl.newSpec like #{newSpec}
|
|
</if>
|
|
<if test="project != null and project != ''">
|
|
and tl.project like #{project}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
and td.status = #{status}
|
|
</if>
|
|
<if test="finalStatus != null and finalStatus != ''">
|
|
and td.final_status = #{finalStatus}
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
and UPPER(td.responsible_person) like UPPER(#{responsiblePerson})
|
|
</if>
|
|
<if test="startDate !=null ">
|
|
and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
|
|
</if>
|
|
<if test="endDate !=null ">
|
|
and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
|
|
</if>
|
|
<if test="finishStartDate != null ">
|
|
and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
|
|
</if>
|
|
<if test="finishEndDate != null ">
|
|
and tl.required_completion_date <![CDATA[ <= ]]> #{finishEndDate}
|
|
</if>
|
|
</where>
|
|
|
|
</select>
|
|
<select id="taskDetailReportList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
|
|
select td.id
|
|
, tl.project
|
|
, tl.customer
|
|
, tl.task_initiator
|
|
, tl.task_description
|
|
, td.department
|
|
, tl.required_completion_date
|
|
, td.status
|
|
, tl.final_status
|
|
, tl.task_start_date
|
|
, tl.created_date
|
|
, tl.created_by
|
|
, tl.updated_date
|
|
, tl.updated_by
|
|
, tl.task_header
|
|
, u.username as responsible_person
|
|
, td.task_id
|
|
from task_detail td
|
|
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
|
|
left join users u on td.site = u.site and u.userId = td.responsible_person
|
|
<where>
|
|
td.site = #{site}
|
|
<if test="department != null and department != ''">
|
|
and tl.department like #{department}
|
|
</if>
|
|
<if test="customer != null and customer != ''">
|
|
and tl.customer like #{customer}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
and tl.status = #{status}
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
and td.responsible_person like #{responsiblePerson}
|
|
</if>
|
|
<if test="startDate !=null ">
|
|
and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
|
|
</if>
|
|
<if test="endDate !=null ">
|
|
and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
|
|
</if>
|
|
<if test="finishStartDate != null ">
|
|
and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
|
|
</if>
|
|
<if test="finishEndDate != null ">
|
|
and tl.required_completion_date <![CDATA[ <= ]]>#{finishEndDate}
|
|
</if>
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="queryPartInventory" resultType="com.heai.modules.board.entity.Inventory">
|
|
Select T.Site,
|
|
T.PartNo,
|
|
P.PartDescription,
|
|
P.Spec,
|
|
<if test="summaryType != null and summaryType >= 1">
|
|
T.WarehouseID,
|
|
</if>
|
|
P.UMID,
|
|
<if test="summaryType != null and summaryType >= 2">
|
|
T.LocationID,
|
|
</if>
|
|
<if test="summaryType != null and summaryType >= 3">
|
|
T.BatchNo,
|
|
</if>
|
|
min(T.FirstInDate) as FirstInDate,
|
|
max(T.LatestCountDate) as LatestCountDate,
|
|
min(T.Freezeflag) as Freezeflag,
|
|
P.PartType,
|
|
P.FamilyID,
|
|
dbo.Get_PartFamilyDesc(P.Site, P.FamilyID) as FamilyName,
|
|
P.GroupID,
|
|
dbo.Get_PartGroupDesc(T.Site, P.GroupID) as PartGroup,
|
|
max(T.LatestOutDate) as LatestOutDate,
|
|
max(T.LatestInDate) as LatestInDate,
|
|
max(T.ActiveDate) as ActiveDate,
|
|
max(T.PartnerID) as PartnerID,
|
|
max(T.PartnerType) as PartnerType,
|
|
min(T.ManufactureDate) as ManufactureDate,
|
|
max(T.ExpiredDate) as ExpiredDate,
|
|
sum(Round(T.QtyOnHand, 3)) as QtyOnHand,
|
|
sum(Round(isnull(T.QtyReserved, 0), 3)) as QtyReserved,
|
|
sum(Round(isnull(T.InStandardValue, 0), 4) - Round(isnull(T.OutStandardValue, 0), 4)) as StandartStockValue,
|
|
sum(Round(isnull(T.InActualValue, 0), 4) - Round(isnull(T.OutActualValue, 0), 4)) as ActualStockValue,
|
|
max(T.DemandPartnerType) as DemandPartnerType,
|
|
max(T.DemandPartnerID) as DemandPartnerID,
|
|
max(T.DemandPartnerName) as DemandPartnerName
|
|
from InventoryStock as T,
|
|
Part as P
|
|
where T.Site = P.Site
|
|
and T.PartNo = P.PartNo
|
|
and T.Site in (Select Site from AccessSite where upper(UserID) = #{loginUser})
|
|
<if test="partNo != null and partNo != ''">
|
|
and T.PartNo like #{partNo}
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
and P.PartDescription like #{partDescription}
|
|
</if>
|
|
<if test="spec != null and spec != ''">
|
|
and P.Spec like #{spec}
|
|
</if>
|
|
<if test="site != null and site != ''">
|
|
and T.Site = #{site}
|
|
</if>
|
|
<if test="partType != null and partType != ''">
|
|
and P.PartType like #{partType}
|
|
</if>
|
|
<if test="warehouseId != null and warehouseId != ''">
|
|
and T.WarehouseID = #{warehouseId}
|
|
</if>
|
|
<if test="locationId != null and locationId != '' and summaryType != null and summaryType >= 2">
|
|
and T.LocationID = #{locationId}
|
|
</if>
|
|
<if test="batchNo != null and batchNo != '' and summaryType != null and summaryType >= 3">
|
|
and T.BatchNo = #{batchNo}
|
|
</if>
|
|
<if test="familyId != null and familyId != ''">
|
|
and P.FamilyID like #{familyId}
|
|
</if>
|
|
<if test="familyName != null and familyName != ''">
|
|
and dbo.Get_PartFamilyDesc(P.Site, P.FamilyID) like #{familyName}
|
|
</if>
|
|
<if test="startFirstInDate != null">
|
|
and T.FirstInDate >= #{startFirstInDate}
|
|
</if>
|
|
<if test="endFirstInDate != null">
|
|
and #{endFirstInDate} >= T.FirstInDate
|
|
</if>
|
|
<if test="startExpiredDate != null">
|
|
and T.ExpiredDate >= #{startExpiredDate}
|
|
</if>
|
|
<if test="endExpiredDate != null">
|
|
and #{endExpiredDate} >= T.ExpiredDate
|
|
</if>
|
|
group by
|
|
T.Site,
|
|
T.PartNo,
|
|
P.PartDescription,
|
|
P.Spec,
|
|
<if test="summaryType != null and summaryType >= 1">
|
|
T.WarehouseID,
|
|
</if>
|
|
P.UMID,
|
|
<if test="summaryType != null and summaryType >= 2">
|
|
T.LocationID,
|
|
</if>
|
|
<if test="summaryType != null and summaryType >= 3">
|
|
T.BatchNo,
|
|
</if>
|
|
P.Site,
|
|
P.FamilyID,
|
|
P.GroupID,
|
|
P.PartType
|
|
</select>
|
|
|
|
</mapper>
|