|
@@ -146,143 +146,137 @@
|
|
|
<select id="getGanttDataList" resultType="com.rongwei.bsentity.vo.GanttVos">
|
|
|
SELECT
|
|
|
UUID_SHORT() as uuid,
|
|
|
- a1.ID,
|
|
|
- a1.PLANPROCESSRALL,
|
|
|
- a1.PLANSTARTDATE,
|
|
|
- a1.PLANENDDATE,
|
|
|
- a1.PROCESSWORKSHOPID,
|
|
|
- a1.PROCESSWORKSHOP,
|
|
|
- a1.PROCESSDEVICEID,
|
|
|
- a1.PROCESSDEVICE,
|
|
|
- a1.STARTINGROLL,
|
|
|
- a1.REPORTROLL,
|
|
|
- a1.CHECKOUTROLL,
|
|
|
- a1.UNFINISHROLL,
|
|
|
- a1.WORKSTATUS,
|
|
|
- a1.CONFLICTDES,
|
|
|
- a1.HASCONFLICT,
|
|
|
- a1.SOFTCONFLICTDES,
|
|
|
- a1.nextprocessesids,
|
|
|
- a1.previousprocessesids,
|
|
|
- a1.CANCELROLL,
|
|
|
- a2.ID as processid,
|
|
|
- a2.PLANINPUT AS INMATERCONDITION,
|
|
|
- a2.PROCESSSTATUS,
|
|
|
- a1.ACTUALSTARTDATE,
|
|
|
- a1.ACTUALFINISHDATE,
|
|
|
- a2.PROCESSNAME,
|
|
|
- a2.LOCKMARK,
|
|
|
- a2.PROCESSWAY,
|
|
|
- a3.ID AS blankOrderId,
|
|
|
- a3.OUTPUTORDERPRODUCT,
|
|
|
- DATE(a3.PROMISEDATESTART) AS PROMISEDATESTART,
|
|
|
- DATE(a3.PROMISEDATEEND) AS PROMISEDATEEND,
|
|
|
- DATE(a3.DELIVERYDATE) AS DELIVERYDATE,
|
|
|
- a3.PRODUCTNAME ,
|
|
|
- a6.ID AS productionorderid,
|
|
|
- a6.ORDERNO,
|
|
|
- a6.CUSTOMNAME,
|
|
|
- a6.ORDERDATE,
|
|
|
- a6.CUSTOMORDERNO,
|
|
|
- Date(a6.PROMISEDELIVERYDATE) as PROMISEDELIVERYDATE,
|
|
|
- Date(a6.SCHEDULEDELIVERYDATE) as SCHEDULEDELIVERYDATE,
|
|
|
- a7.CUSTOMERABBREVIATION as CUSTOMERABBREVIATION,
|
|
|
- a7.CUSTOMERUNIT,
|
|
|
- a3.BLANKNUMBER as blankNumber,
|
|
|
- a3.PLANHAVEMATERIALDATE as planhavematerialdate,
|
|
|
- a2.SINGLEROLLWEIGHT,
|
|
|
- a2.SINGLEROLLWEIGHT * a1.PLANPROCESSRALL as totalRollWeight,
|
|
|
- IF(IF (
|
|
|
- IFNULL(a1.BACHMATERIALPROCESS,'')=''and IFNULL(a1.DOINGBATCHNUMBER,'')=''and IFNULL(a1.REPORTBATCHNUMBER,'')='',
|
|
|
- a1.BLANKBATCHNUMBER,
|
|
|
- IF
|
|
|
- (
|
|
|
- a2.PROCESS = "小卷成退"
|
|
|
- OR a2.PROCESS = "小卷包装",
|
|
|
- CONCAT_WS(
|
|
|
- ',',
|
|
|
- SUBSTRING_INDEX( IF ( a1.BACHMATERIALPROCESS = '', NULL, trim( BOTH ',' FROM a1.BACHMATERIALPROCESS ) ), ",", 1 ),
|
|
|
- SUBSTRING_INDEX( IF ( a1.DOINGBATCHNUMBER = '', NULL, trim( BOTH ',' FROM a1.DOINGBATCHNUMBER ) ), ",", 1 ),
|
|
|
- SUBSTRING_INDEX( IF ( a1.REPORTBATCHNUMBER = '', NULL, trim( BOTH ',' FROM a1.REPORTBATCHNUMBER ) ), ",", 1 )
|
|
|
+ apope.ID,
|
|
|
+ apope.PLANPROCESSRALL,
|
|
|
+ apope.PLANSTARTDATE,
|
|
|
+ apope.PLANENDDATE,
|
|
|
+ apope.PROCESSWORKSHOPID,
|
|
|
+ apope.PROCESSWORKSHOP,
|
|
|
+ apope.PROCESSDEVICEID,
|
|
|
+ apope.PROCESSDEVICE,
|
|
|
+ apope.STARTINGROLL,
|
|
|
+ apope.REPORTROLL,
|
|
|
+ apope.CHECKOUTROLL,
|
|
|
+ apope.UNFINISHROLL,
|
|
|
+ apope.WORKSTATUS,
|
|
|
+ apope.CONFLICTDES,
|
|
|
+ apope.HASCONFLICT,
|
|
|
+ apope.SOFTCONFLICTDES,
|
|
|
+ apope.nextprocessesids,
|
|
|
+ apope.previousprocessesids,
|
|
|
+ apope.CANCELROLL,
|
|
|
+ apo.ID as processid,
|
|
|
+ apo.PLANINPUT AS INMATERCONDITION,
|
|
|
+ apo.PROCESSSTATUS,
|
|
|
+ apope.ACTUALSTARTDATE,
|
|
|
+ apope.ACTUALFINISHDATE,
|
|
|
+ apo.PROCESSNAME,
|
|
|
+ apo.LOCKMARK as processLock, -- 原工序作业的是否锁定改名
|
|
|
+ apope.LOCKMARKDETAIL as LOCKMARK, -- 增加作业明细的是否锁定字段
|
|
|
+ apo.PROCESSWAY,
|
|
|
+ abo.ID AS blankOrderId,
|
|
|
+ abo.OUTPUTORDERPRODUCT,
|
|
|
+ DATE(abo.PROMISEDATESTART) AS PROMISEDATESTART,
|
|
|
+ DATE(abo.PROMISEDATEEND) AS PROMISEDATEEND,
|
|
|
+ DATE(abo.DELIVERYDATE) AS DELIVERYDATE,
|
|
|
+ apop.PRODUCTNAME ,
|
|
|
+ apro.ID AS productionorderid,
|
|
|
+ apro.ORDERNO,
|
|
|
+ apro.CUSTOMNAME,
|
|
|
+ apro.ORDERDATE,
|
|
|
+ ifnull(apop.CUSTOMORDERNO,apro.CUSTOMORDERNO) CUSTOMORDERNO,
|
|
|
+ Date(apro.PROMISEDELIVERYDATE) as PROMISEDELIVERYDATE,
|
|
|
+ Date(apro.SCHEDULEDELIVERYDATE) as SCHEDULEDELIVERYDATE,
|
|
|
+ acm.CUSTOMERABBREVIATION as CUSTOMERABBREVIATION,
|
|
|
+ acm.CUSTOMERUNIT,
|
|
|
+ abo.BLANKNUMBER as blankNumber,
|
|
|
+ abo.PLANHAVEMATERIALDATE as planhavematerialdate,
|
|
|
+ apo.SINGLEROLLWEIGHT,
|
|
|
+ apo.SINGLEROLLWEIGHT * apope.PLANPROCESSRALL as totalRollWeight,
|
|
|
+ IF(IFNULL(apope.BACHMATERIALPROCESS,'')=''and IFNULL(apope.DOINGBATCHNUMBER,'')=''and IFNULL(apope.REPORTBATCHNUMBER,'')='',
|
|
|
+ IF(IFNULL(apope.BLANKBATCHNUMBER,'')='',SUBSTRING_INDEX(abo.PREPAREMATERIALBATCHNO, ',', 1),apope.BLANKBATCHNUMBER),
|
|
|
+ IF(apo.PROCESS = "小卷成退"OR apo.PROCESS = "小卷包装",
|
|
|
+ CONCAT_WS(',',
|
|
|
+ SUBSTRING_INDEX( trim( BOTH ',' FROM IFNULL(apope.BACHMATERIALPROCESS,'') ), ',', 1 ),
|
|
|
+ SUBSTRING_INDEX( trim( BOTH ',' FROM IFNULL(apope.DOINGBATCHNUMBER,'') ), ',', 1 ),
|
|
|
+ SUBSTRING_INDEX( trim( BOTH ',' FROM IFNULL(apope.REPORTBATCHNUMBER,'') ), ',', 1 )
|
|
|
),
|
|
|
- CONCAT_WS(
|
|
|
- ',',
|
|
|
- IF
|
|
|
- ( a1.BACHMATERIALPROCESS = '', NULL, trim( BOTH ',' FROM a1.BACHMATERIALPROCESS ) ),
|
|
|
- IF
|
|
|
- ( a1.DOINGBATCHNUMBER = '', NULL, trim( BOTH ',' FROM a1.DOINGBATCHNUMBER ) ),
|
|
|
- IF
|
|
|
- ( a1.REPORTBATCHNUMBER = '', NULL, trim( BOTH ',' FROM a1.REPORTBATCHNUMBER ) )
|
|
|
+ CONCAT_WS(',',
|
|
|
+ trim( BOTH ',' FROM IFNULL(apope.BACHMATERIALPROCESS,'') ),
|
|
|
+ trim( BOTH ',' FROM IFNULL(apope.DOINGBATCHNUMBER,'') ),
|
|
|
+ trim( BOTH ',' FROM IFNULL(apope.REPORTBATCHNUMBER,'') )
|
|
|
)
|
|
|
)
|
|
|
- )='',a2.PREVIOUSPROCESSID IS NULL AND a3.PREPAREMATERIAL = '是',a3.PREPAREMATERIALBATCHNO ) AS SHOWBATCHNUMBER
|
|
|
+ ) AS SHOWBATCHNUMBER
|
|
|
FROM
|
|
|
- (SELECT
|
|
|
- a3.*,
|
|
|
- GROUP_CONCAT( a4.PRODUCTNAME ) as PRODUCTNAME
|
|
|
+ aps_process_operation_process_equ apope
|
|
|
+ JOIN aps_process_operation apo ON apope.PROCESSID = apo.ID
|
|
|
+ join aps_blank_order abo ON apo.BLANKID = abo.ID
|
|
|
+ JOIN aps_production_order apro ON abo.PRODUCTIONORDERID = apro.ID
|
|
|
+ LEFT JOIN aps_customer_management acm ON apro.CUSTOMID = acm.ID
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ apop.BLANKID, GROUP_CONCAT( apop.PRODUCTNAME ) as PRODUCTNAME,
|
|
|
+ GROUP_CONCAT( distinct apd.CUSTOMORDERNO) as CUSTOMORDERNO
|
|
|
FROM
|
|
|
- aps_blank_order a3
|
|
|
- LEFT JOIN aps_process_output_product a4 FORCE INDEX(aps_process_output_product_idx) on a3.ID=a4.BLANKID
|
|
|
+ aps_process_output_product apop
|
|
|
+ left join aps_product_detail apd on apop.PRODUCTID = apd.id
|
|
|
WHERE
|
|
|
- a4.DELETED = '0'
|
|
|
+ apop.DELETED = '0'
|
|
|
GROUP BY
|
|
|
- a3.ID) a3
|
|
|
- LEFT JOIN aps_production_order a6 ON a3.PRODUCTIONORDERID = a6.ID
|
|
|
- LEFT JOIN aps_customer_management a7 ON a6.CUSTOMID = a7.ID
|
|
|
- LEFT JOIN aps_process_operation a2 ON a3.ID= a2.BLANKID
|
|
|
- LEFT JOIN aps_process_operation_process_equ a1 FORCE INDEX (aps_process_operation_process_equ_idx2) ON
|
|
|
- a1.PROCESSID = a2.ID
|
|
|
+ apop.BLANKID
|
|
|
+ ) apop on abo.id=apop.BLANKID
|
|
|
<where>
|
|
|
<if test="factoryId != null and factoryId != '' and factoryId != 'ALL'">
|
|
|
- a1.TENANTID = #{factoryId}
|
|
|
- and a3.TENANTID= #{factoryId}
|
|
|
+ apope.TENANTID = #{factoryId}
|
|
|
+ and abo.TENANTID= #{factoryId}
|
|
|
</if>
|
|
|
- and a3.SCHEDULINGSTATUS != '10'
|
|
|
- and a1.DELETED ='0'
|
|
|
- AND a2.DELETED = '0'
|
|
|
- AND a3.DELETED = '0'
|
|
|
- AND a6.DELETED='0'
|
|
|
- and (a1.PROCESSDEVICE is not null and a1.PROCESSDEVICE !='' )
|
|
|
- and (a1.PROCESSWORKSHOP is not null and a1.PROCESSWORKSHOP !='' )
|
|
|
+ and abo.SCHEDULINGSTATUS != '10'
|
|
|
+ and apope.DELETED = '0'
|
|
|
+ and apo.DELETED = '0'
|
|
|
+ and abo.DELETED = '0'
|
|
|
+ and apro.DELETED = '0'
|
|
|
+ and (apope.PROCESSDEVICE is not null and apope.PROCESSDEVICE !='' )
|
|
|
+ and (apope.PROCESSWORKSHOP is not null and apope.PROCESSWORKSHOP !='' )
|
|
|
<if test="ids != null and ids.size()>0">
|
|
|
- and a1.ID in
|
|
|
+ and apope.ID in
|
|
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="workshopIds != null and workshopIds.size()>0">
|
|
|
- and a1.PROCESSWORKSHOPID in
|
|
|
+ and apope.PROCESSWORKSHOPID in
|
|
|
<foreach collection="workshopIds" item="workshopId" open="(" close=")" separator=",">
|
|
|
#{workshopId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="orderNos !=null and orderNos.size()>0">
|
|
|
- and a6.ORDERNO in
|
|
|
+ and apro.ORDERNO in
|
|
|
<foreach collection="orderNos" item="orderNo" open="(" close=")" separator=",">
|
|
|
#{orderNo}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="equIds != null and equIds.size()>0">
|
|
|
- and a1.PROCESSDEVICEID in
|
|
|
+ and apope.PROCESSDEVICEID in
|
|
|
<foreach collection="equIds" item="equId" open="(" close=")" separator=",">
|
|
|
#{equId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="equName !=null and equName!=''">
|
|
|
<bind name="pattern" value="'%' + equName + '%'"/>
|
|
|
- and a1.PROCESSDEVICE like #{pattern}
|
|
|
+ and apope.PROCESSDEVICE like #{pattern}
|
|
|
</if>
|
|
|
|
|
|
<if test="startTime != null and endTime != null ">
|
|
|
- and not (a1.PLANSTARTDATE > #{endTime} or a1.PLANENDDATE < #{startTime})
|
|
|
+ and not (apope.PLANSTARTDATE > #{endTime} or apope.PLANENDDATE < #{startTime})
|
|
|
</if>
|
|
|
- <if test="processids != null ">and a1.PROCESSID in (${processids})</if>
|
|
|
+ <if test="processids != null ">and apope.PROCESSID in (${processids})</if>
|
|
|
<if test="blankNumber != null and blankNumber != ''">
|
|
|
<bind name="blankNumberPattern" value="'%' + blankNumber + '%'"/>
|
|
|
- and a3.BLANKNUMBER like #{blankNumberPattern}
|
|
|
+ and abo.BLANKNUMBER like #{blankNumberPattern}
|
|
|
</if>
|
|
|
</where>
|
|
|
- # order by a1.PROCESSWORKSHOP,a1.PROCESSDEVICE,a1.PLANSTARTDATE asc,a1.PLANENDDATE desc
|
|
|
+ # order by apope.PROCESSWORKSHOP,apope.PROCESSDEVICE,apope.PLANSTARTDATE asc,apope.PLANENDDATE desc
|
|
|
</select>
|
|
|
<select id="selectNeedUpdate" resultType="com.rongwei.bsentity.vo.CommonUpdateProductionStatusReq">
|
|
|
SELECT
|
|
@@ -483,38 +477,37 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
<select id="getWorkshopAndDeviceByFactoryId" resultType="com.rongwei.bsentity.vo.GanttVos">
|
|
|
- SELECT DISTINCTROW
|
|
|
- a1.PROCESSWORKSHOPID AS processworkshopid,
|
|
|
- a1.PROCESSWORKSHOP AS processworkshop,
|
|
|
- a1.PROCESSDEVICEID AS processdeviceid,
|
|
|
- b.CHECKITEMNAME AS processdevice,
|
|
|
+ SELECT
|
|
|
+ apope.PROCESSDEVICEID AS processdeviceid,
|
|
|
+ ifnull(aci.CHECKITEMNAME,apope.PROCESSDEVICE) AS processdevice,
|
|
|
+ ifnull(aci.USEDEPTID,apope.PROCESSWORKSHOPID) AS processworkshopid,
|
|
|
+ ifnull(aci.USEDEPTNAME,apope.PROCESSWORKSHOP) AS processworkshop,
|
|
|
+ aci.CHECKITEMTYPE,
|
|
|
ape.PRODUCTLINENAME AS productlinename,
|
|
|
- ape.productlineid AS productlineid,
|
|
|
- b.CHECKITEMTYPE
|
|
|
+ ape.productlineid AS productlineid
|
|
|
FROM
|
|
|
- aps_process_operation_process_equ a1
|
|
|
+ aps_process_operation_process_equ apope
|
|
|
+ LEFT JOIN asp_check_items aci ON apope.PROCESSDEVICEID = aci.ID
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
ape.EQUIPMENTID,
|
|
|
apl.PRODUCTLINENAME,
|
|
|
apl.ID AS productlineid
|
|
|
FROM
|
|
|
- aps_production_line apl
|
|
|
- JOIN aps_resources_equipment ape ON ape.MAINID = apl.ID
|
|
|
+ aps_resources_equipment ape
|
|
|
+ JOIN aps_production_line apl ON ape.MAINID = apl.ID
|
|
|
WHERE
|
|
|
apl.DELETED = '0'
|
|
|
AND ape.DELETED = '0'
|
|
|
- ) ape ON ape.EQUIPMENTID = a1.PROCESSDEVICEID
|
|
|
- LEFT JOIN asp_check_items b ON a1.PROCESSDEVICEID = b.ID
|
|
|
+ ) ape ON ape.EQUIPMENTID = apope.PROCESSDEVICEID
|
|
|
WHERE
|
|
|
- a1.DELETED = '0'
|
|
|
- AND a1.TENANTID = #{factoryId}
|
|
|
- AND ( a1.PROCESSDEVICE IS NOT NULL AND a1.PROCESSDEVICE != '' )
|
|
|
- AND ( a1.PROCESSWORKSHOP IS NOT NULL AND a1.PROCESSWORKSHOP != '' )
|
|
|
+ apope.DELETED = '0'
|
|
|
+ AND apope.TENANTID = #{factoryId}
|
|
|
+ AND ( apope.PROCESSDEVICEID IS NOT NULL AND apope.PROCESSDEVICEID != '' )
|
|
|
+ group BY
|
|
|
+ processdeviceid
|
|
|
ORDER BY
|
|
|
- a1.PROCESSWORKSHOP,
|
|
|
- a1.PROCESSDEVICE,
|
|
|
- b.CHECKITEMTYPE
|
|
|
+ processworkshop,processdevice,CHECKITEMTYPE
|
|
|
</select>
|
|
|
<select id="getTimeOverlapByEquId" resultType="com.rongwei.bsentity.domain.ApsProcessOperationProcessEquDo">
|
|
|
select apope.*
|