Commit eba5d3bc by lijingjing

对进场物资逻辑调整;

parent 51f15bbb
...@@ -1454,8 +1454,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI ...@@ -1454,8 +1454,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
handleSampleBrand(ids, finalSampleBrandMap, true); handleSampleBrand(ids, finalSampleBrandMap, true);
// 针对铝成品和原铝进行发送ERP数据处理 // 针对铝成品和原铝进行发送ERP数据处理
// logger.error("{}开始执行发送ERP请求:---->ERP---", DateUtils.toYearMonthDayTime(new Date())); logger.error("{}开始执行发送ERP请求:---->ERP---", DateUtils.toYearMonthDayTime(new Date()));
// sendTestDataToErp(Arrays.asList(ids), finalSampleBrandMap); sendTestDataToErp(Arrays.asList(ids), finalSampleBrandMap);
}); });
logger.error("======================质量判定结束========================"); logger.error("======================质量判定结束========================");
......
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
<if test="null != vo.timeS and null != vo.timeE"> <if test="null != vo.timeS and null != vo.timeE">
AND EXISTS ( AND EXISTS (
select 1 from entrust_sample_item si where si.deleted = 0 and si.entrust_sample_id = s.id select 1 from entrust_sample_item si where si.deleted = 0 and si.entrust_sample_id = s.id
and to_char(si.test_time, 'YYYY-MM-dd HH24:MI:SS') BETWEEN #{vo.timeS} AND #{vo.timeE} and si.test_time BETWEEN #{vo.timeS} AND #{vo.timeE}
) )
</if> </if>
GROUP BY e.model, e.plant GROUP BY e.model, e.plant
...@@ -386,9 +386,9 @@ ...@@ -386,9 +386,9 @@
WHERE i.deleted = 0 WHERE i.deleted = 0
AND s.name like '%磷生铁%' AND s.name like '%磷生铁%'
AND i.period is not null AND i.period is not null
AND ii.test_value is not null and is_numeric(ii.test_value) AND ii.test_value is not null
<if test="null != vo.timeS and null != vo.timeE"> <if test="null != vo.timeS and null != vo.timeE">
and date(i.test_time) &gt;= date(#{vo.timeS}) AND date(i.test_time) &lt;= date(#{vo.timeE}) and i.test_time &gt;= #{vo.timeS} AND i.test_time &lt;= #{vo.timeE}
</if> </if>
GROUP BY i.company_id,i.period,i.entrust_sample_id GROUP BY i.company_id,i.period,i.entrust_sample_id
) PI ) PI
......
...@@ -647,21 +647,20 @@ ...@@ -647,21 +647,20 @@
entrust_sample s entrust_sample s
JOIN electrolyzer e on e.id = s.electrolyzer_id and e.deleted = 0 JOIN electrolyzer e on e.id = s.electrolyzer_id and e.deleted = 0
JOIN ( JOIN (
SELECT SELECT
i.entrust_sample_id, i.entrust_sample_id,
to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time" to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time"
FROM FROM
entrust_sample_item i entrust_sample_item i
WHERE WHERE
i.deleted = 0 i.deleted = 0 and to_char(i.test_time, 'yyyy-mm') = #{vo.yearMonth}
GROUP BY GROUP BY
i.entrust_sample_id i.entrust_sample_id
) i ON i.entrust_sample_id = s.ID ) i ON i.entrust_sample_id = s.ID
WHERE WHERE
s.deleted = 0 s.deleted = 0
AND s.NAME = '原铝' AND s.NAME = '原铝'
AND s.sample_grading IS NOT NULL AND s.sample_grading IS NOT NULL
AND i.test_time LIKE '${vo.yearMonth}%'
<include refid="ledger_where"/> <include refid="ledger_where"/>
ORDER BY ORDER BY
s.slot_no, i.test_time s.slot_no, i.test_time
...@@ -669,75 +668,51 @@ ...@@ -669,75 +668,51 @@
<!-- 原铝品味台账统计 --> <!-- 原铝品味台账统计 -->
<select id="selectAlGradeLedgerStats" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO"> <select id="selectAlGradeLedgerStats" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO">
SELECT SELECT
s.sample_grading "label", s.sample_grading "label",
i.test_time "day", i.test_time "day",
count(1) "value" count(1) "value"
FROM FROM
entrust_sample s entrust_sample s
JOIN electrolyzer e on e.id = s.electrolyzer_id JOIN electrolyzer e on e.id = s.electrolyzer_id
JOIN ( JOIN (
SELECT SELECT
i.entrust_sample_id, i.entrust_sample_id,
to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time" to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time"
FROM FROM
entrust_sample_item i entrust_sample_item i
WHERE WHERE
i.deleted = 0 i.deleted = 0 AND to_char(i.test_time,'yyyy-mm') = #{vo.yearMonth}
GROUP BY GROUP BY
i.entrust_sample_id i.entrust_sample_id
) i ON i.entrust_sample_id = s.ID ) i ON i.entrust_sample_id = s.ID
WHERE WHERE
s.deleted = 0 and e.deleted = 0 s.deleted = 0 and e.deleted = 0
AND s.NAME = '原铝' AND s.NAME = '原铝'
AND s.sample_grading IS NOT NULL AND s.sample_grading IS NOT NULL
AND i.test_time LIKE '${vo.yearMonth}%'
<include refid="ledger_where"/> <include refid="ledger_where"/>
GROUP BY s.sample_grading,i.test_time GROUP BY s.sample_grading,i.test_time
ORDER BY ORDER BY s.sample_grading desc, i.test_time
s.sample_grading desc, i.test_time
</select> </select>
<!-- 原铝杂质含量台账 --> <!-- 原铝杂质含量台账 -->
<select id="selectAlImpurityLedger" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO"> <select id="selectAlImpurityLedger" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO">
SELECT SELECT
s.slot_no "label", s.slot_no "label",
i.test_time "day", to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "day",
i.value SUM ( ii.test_value::NUMERIC ) "value"
FROM
entrust_sample s
JOIN electrolyzer e on e.id = s.electrolyzer_id
JOIN (
SELECT
i.entrust_sample_id,
to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time",
sum(ii.zz_value) "value"
FROM FROM
entrust_sample_item i entrust_sample s
join ( JOIN entrust_sample_item i on i.entrust_sample_id = s.id and i.deleted = 0
select JOIN entrust_sample_item_index ii on ii.entrust_sample_item_id = i.id and ii.deleted = 0
ii.entrust_sample_item_id, JOIN electrolyzer e ON e.ID = s.electrolyzer_id and e.deleted = 0
sum(cast(ii.test_value as numeric)) "zz_value"
from entrust_sample_item_index ii
where ii.deleted = 0 and is_numeric(ii.test_value)
<if test="null != vo.impurity">
and ii.name like concat('%',#{vo.impurity},'%')
</if>
group by ii.entrust_sample_item_id
) ii on ii.entrust_sample_item_id = i.id
WHERE WHERE
i.deleted = 0 s.deleted = 0
GROUP BY AND s.NAME = '原铝'
i.entrust_sample_id AND s.sample_grading IS NOT NULL
) i ON i.entrust_sample_id = s.ID AND to_char(i.test_time,'yyyy-mm') = #{vo.yearMonth}
WHERE AND TRIM(ii.test_value) ~ '^([-]?[0-9]+[.]?[0-9]*|[.][0-9]+)$'
s.deleted = 0 and e.deleted = 0 <include refid="ledger_where"/>
AND s.NAME = '原铝' GROUP BY s.id
AND s.sample_grading IS NOT NULL ORDER BY s.slot_no, "day"
AND i.test_time LIKE '${vo.yearMonth}%'
<include refid="ledger_where"/>
ORDER BY
s.slot_no, i.test_time
</select> </select>
<!--原铝含铁量台账统计 --> <!--原铝含铁量台账统计 -->
<select id="selectAlFeLedgerStats" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO"> <select id="selectAlFeLedgerStats" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO">
...@@ -783,9 +758,8 @@ ...@@ -783,9 +758,8 @@
WHERE WHERE
i.deleted = 0 i.deleted = 0
AND i.NAME IN ( '原铝Fe', '原铝Ni') AND i.NAME IN ( '原铝Fe', '原铝Ni')
AND to_char(i.test_time,'yyyy-mm-dd') LIKE '${vo.yearMonth}%' AND to_char(i.test_time,'yyyy-mm') = #{vo.yearMonth}
AND ii.test_value is not null AND (TRIM(ii.test_value) ~ '^([-]?[0-9]+[.]?[0-9]*|[.][0-9]+)$')
AND is_numeric ( ii.test_value )
GROUP BY GROUP BY
i.entrust_sample_id i.entrust_sample_id
) i ON i.entrust_sample_id = s.ID ) i ON i.entrust_sample_id = s.ID
...@@ -793,7 +767,6 @@ ...@@ -793,7 +767,6 @@
s.deleted = 0 s.deleted = 0
AND s.NAME = '原铝' AND s.NAME = '原铝'
AND s.sample_grading IS NOT NULL AND s.sample_grading IS NOT NULL
AND i.test_time LIKE '${vo.yearMonth}%'
<include refid="ledger_where"/> <include refid="ledger_where"/>
GROUP BY GROUP BY
I.test_time I.test_time
...@@ -811,39 +784,27 @@ ...@@ -811,39 +784,27 @@
FROM FROM
( (
SELECT SELECT
i."name", i."name",
to_char( i.test_time, 'yyyy-mm-dd' ) "test_time", to_char( i.test_time, 'yyyy-mm-dd' ) "test_time",
MAX ( CAST ( ii.test_value AS NUMERIC ) ) "max_val", MAX ( CAST ( ii.test_value AS NUMERIC ) ) "max_val",
MIN ( CAST ( ii.test_value AS NUMERIC ) ) "min_val", MIN ( CAST ( ii.test_value AS NUMERIC ) ) "min_val",
round( AVG ( CAST ( ii.test_value AS NUMERIC ) ), 5 ) "avg_val", ROUND( AVG ( CAST ( ii.test_value AS NUMERIC ) ), 5 ) "avg_val",
MAX ( CAST ( ii.test_value AS NUMERIC ) ) - MIN ( CAST ( ii.test_value AS NUMERIC ) ) "dif_val" MAX ( CAST ( ii.test_value AS NUMERIC ) ) - MIN ( CAST ( ii.test_value AS NUMERIC ) ) "dif_val"
FROM FROM
entrust_sample_item i entrust_sample_item i
JOIN entrust_sample_item_index ii ON ii.entrust_sample_item_id = i.ID JOIN entrust_sample s on s.id = i.entrust_sample_id and s.deleted = 0
AND ii.NAME = i.NAME JOIN entrust_sample_item_index ii ON ii.entrust_sample_item_id = i.ID AND ii.NAME = i.NAME AND ii.deleted = 0
JOIN electrolyzer e ON e.ID = s.electrolyzer_id and e.deleted = 0
WHERE WHERE
i.deleted = 0 i.deleted = 0
AND ii.deleted = 0 AND s.NAME in ('原铝','原铝散样','原铝重取')
AND i.NAME = ii.NAME AND to_char( i.test_time, 'yyyy-mm') = #{vo.yearMonth}
AND I.NAME LIKE'%原铝%' AND (TRIM(ii.test_value) ~ '^([-]?[0-9]+[.]?[0-9]+)$')
AND to_char( i.test_time, 'yyyy-mm-dd' ) like '${vo.yearMonth}%' <include refid="ledger_where"/>
AND is_numeric ( ii.test_value )
<if test="null != vo.branch or null != vo.partition or null != vo.plant">
AND EXISTS (
SELECT
1
FROM entrust_sample s
join electrolyzer e ON e.ID = s.electrolyzer_id
WHERE s.deleted = 0 and e.deleted = 0 and s.id = i.entrust_sample_id
<include refid="ledger_where"/>
)
</if>
GROUP BY GROUP BY
i.NAME, i.NAME, "test_time"
to_char( i.test_time, 'yyyy-mm-dd' )
ORDER BY ORDER BY
i.NAME, i.NAME,"test_time"
to_char( i.test_time, 'yyyy-mm-dd' )
) T order by t.name, sn, label, day ) T order by t.name, sn, label, day
</select> </select>
<!--获取检测项目委托量统计数据: 获取LIMS平台某段时间的检测项目委托总数量--> <!--获取检测项目委托量统计数据: 获取LIMS平台某段时间的检测项目委托总数量-->
......
ALTER TABLE "public"."material"
ALTER TABLE "public"."material"
ADD COLUMN "type" int2 default 0;
COMMENT ON COLUMN "public"."material"."type" IS '物资类型(0:自产,1:进场)';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment