Merge remote-tracking branch 'origin/master'

master
mengjiao 6 months ago
commit 1fe9b03f0f

@ -233,6 +233,46 @@ public class BaseProductDTO extends BaseEntity {
/** 其它 */
@Excel(name = "其它")
private String other;
/**标准模板**/
private String mvgr5;
/**单位**/
private String meins;
//转换分子
private String umrez;
//转换分母
private String umren;
public String getUmren() {
return umren;
}
public void setUmren(String umren) {
this.umren = umren;
}
public String getUmrez() {
return umrez;
}
public void setUmrez(String umrez) {
this.umrez = umrez;
}
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public String getMvgr5() {
return mvgr5;
}
public void setMvgr5(String mvgr5) {
this.mvgr5 = mvgr5;
}
public void setCategory(String category) {
this.category = category;

@ -75,16 +75,16 @@
<if test="price != null ">and price = #{price}</if>
<if test="monitorSubset != null and monitorSubset != ''">
and (report_point_water.monitor_id = #{monitorSubset} OR report_point_water.monitor_id IN
(SELECT t.monitor_id FROM base_monitor_info t WHERE FIND_IN_SET(#{monitorSubset}, ancestors)))
(SELECT t.monitor_id FROM base_monitor_info t WHERE dbo.FIND_IN_SET(#{monitorSubset}, ancestors) > 0))
</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and begin_time between #{params.beginBeginTime} and #{params.endBeginTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
</if>
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and begin_time between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and begin_time between #{params.beginCollectTime} and #{params.endCollectTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="beginTime != null ">and begin_time = #{beginTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
@ -116,9 +116,9 @@
where report_point_water.objid = #{objid}
</select>
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
select ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
select ert.pointTime, sum(isnull(ert.expend,0)) expend
from (
select left(rpd.begin_time, #{timeSub}) pointTime, rpd.expend
select left(left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10), #{timeSub}) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -134,7 +134,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(rpd.begin_time, 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -144,7 +144,7 @@
<select id="energyConsumptionAnalysisDetails" resultType="java.util.Map">
select ert.monitor_id, ert.monitor_name, ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
from (
select rpd.monitor_id, m.monitor_name, left(rpd.begin_time, 10) pointTime, rpd.expend
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -158,7 +158,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(rpd.begin_time, 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -168,21 +168,21 @@
<select id="datePointWaterList" parameterType="ReportPointWaterDTO" resultMap="ReportPointWaterDTOResult">
select ert.monitor_id,
ert.monitor_name,
CASE
CAST( CASE
WHEN #{params.timeSub} = 10 THEN ert.pointTime
WHEN #{params.timeSub} = 7 THEN concat(ert.pointTime, '-01')
WHEN #{params.timeSub} = 4 THEN concat(ert.pointTime, '-01-01')
END AS begin_time,
CASE
END AS datetime) AS begin_time,
CAST( CASE
WHEN #{params.timeSub} = 10 THEN ert.pointTime
WHEN #{params.timeSub} = 7 THEN LAST_DAY(concat(ert.pointTime, '-01'))
WHEN #{params.timeSub} = 4 THEN LAST_DAY(concat(ert.pointTime, '-12-01'))
END AS end_time,
sum(if(ert.expend is null, 0, ert.expend)) expend,
WHEN #{params.timeSub} = 7 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-01')))
WHEN #{params.timeSub} = 4 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-12-01')))
END AS datetime) AS end_time,
sum(isnull(ert.expend,0)) expend,
max(ert.meter_value) meter_value,
max(ert.monitor_addr) address
from (
select rpd.monitor_id, m.monitor_name, left(rpd.begin_time, #{params.timeSub}) pointTime, rpd.expend,
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
rpd.meter_value,m.monitor_addr
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
@ -209,9 +209,8 @@
rpd.monitor_id monitorId,
m.monitor_name monitorName,
m.monitor_addr address,
sum(if(rpd.expend is null, 0, rpd.expend)) expend,
sum(isnull(rpd.expend,0)) expend,
max(rpd.meter_value) meterValue,
GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
m.monitor_hierarchy monitorHierarchy,
m.grade
@ -232,7 +231,7 @@
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="monitorIdList != null and monitorIdList.size > 0">
and rpd.monitor_id IN

@ -12,6 +12,7 @@ import com.op.system.api.domain.DataSourcePropertyDTO;
import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.quality.QcCheckTaskProduceDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -250,4 +251,9 @@ public class OpenController extends BaseController {
public AjaxResult getDeliveryNoteDetail(@RequestBody Map paramMap) {
return openService.getDeliveryNoteDetail(paramMap);
}
//给oa提供的物料建议标准更新
@PostMapping("/sendProductCheckNo")
public AjaxResult sendProductCheckNo(@RequestBody List<BaseProductDTO> dots) {
return openService.sendProductCheckNo(dots);
}
}

@ -5,10 +5,7 @@ import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.device.DeviceRepairOrder;
import com.op.system.api.domain.device.EquEquipmentDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.mes.MesReportWorkConsumeDTO;
import com.op.system.api.domain.mes.MesReportWorkDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.mes.*;
import com.op.system.api.domain.quality.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -94,5 +91,10 @@ public interface OpenMapper {
List<SysNoticeGroup> getNotices(SysNoticeGroup noticeQo);
List<String> getExsitCodes(List<String> codes);
int updateProductNoBatchs(@Param("list") List<BaseProductDTO> updates);
int addProductNoBatchs(@Param("list")List<BaseProductDTO> everyList);
}

@ -5,6 +5,7 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.mes.MesReportWorkDTO;
import com.op.system.api.domain.quality.QcCheckTaskDTO;
import com.op.system.api.domain.quality.QcCheckTaskProduceDTO;
@ -43,4 +44,6 @@ public interface OpenService {
AjaxResult sendWeChartMessage(List<WechartDTO> wechartDTO);
AjaxResult getDeliveryNoteDetail(Map paramMap);
AjaxResult sendProductCheckNo(List<BaseProductDTO> dots);
}

@ -21,8 +21,11 @@ import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.quality.*;
import com.op.system.api.domain.sap.SapCustom;
import com.op.system.api.domain.sap.SapSupplier;
import org.apache.commons.lang.StringUtils;
import java.text.SimpleDateFormat;
@ -615,7 +618,7 @@ public class OpenServiceImpl implements OpenService {
@Override
public AjaxResult sendWeChartMessage(List<WechartDTO> dtos) {
try {
logger.info(JSONObject.toJSONString("open企业微信发送参数"+dtos));
logger.info("open企业微信发送参数"+JSONObject.toJSONString(dtos));
String result = HttpUtils.sendPostWechart(weChartUrl, JSON.toJSONString(dtos));
return success(result);
} catch (Exception e) {
@ -624,7 +627,75 @@ public class OpenServiceImpl implements OpenService {
}
}
/**
* factoryCode 1000
* +productCode
* +productDescZh
* +productGroup
* +productGroupName
* +meins
* +productModel
* +umrez
* UMREZ+umren
* + mvgr5
* \0+ grossWeight
* volume
* **/
@Override
public AjaxResult sendProductCheckNo(List<BaseProductDTO> dtos) {
try {
logger.info("oa更新检验标准发送参数"+JSONObject.toJSONString(dtos));
if(CollectionUtils.isEmpty(dtos)){
return error("oa更新检验标准发送参数为空");
}
DynamicDataSourceContextHolder.push("ds_"+dtos.get(0).getFactoryCode());
//sap返回的产品编码
List<String> codes = dtos.stream().map(BaseProductDTO::getProductCode).collect(Collectors.toList());
//sap返回的客户编码-本地已存在
List<String> exsitCodes = openMapper.getExsitCodes(codes);
//sap返回的产品编码-本地不存在// 差集 (list2 - list1)
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());
List<BaseProductDTO> updates = new ArrayList<>();
for (String exsitCode : exsitCodes) {
List<BaseProductDTO> updates0 = dtos.stream().filter(dto -> dto.getProductCode().equals(exsitCode)).collect(Collectors.toList());
updates.addAll(updates0);
}
if (!CollectionUtils.isEmpty(updates)) {
int m = openMapper.updateProductNoBatchs(updates);
System.out.println("oa产品更新成功条数" + m);
}
List<BaseProductDTO> adds = new ArrayList<>();
for (String noExsitCode : noExsitCodes) {
List<BaseProductDTO> adds0 = dtos.stream().filter(dto -> dto.getProductCode().equals(noExsitCode)).collect(Collectors.toList());
adds.addAll(adds0);
}
if (!CollectionUtils.isEmpty(adds)) {
int allsize = adds.size();
int inserttimes = allsize / 100 + 1;
for (int m = 0; m < inserttimes; m++) {
List<BaseProductDTO> everyList;
if (m < (inserttimes - 1)) {
everyList = adds.subList(m * 100, (m + 1) * 100);
} else {
everyList = adds.subList(m * 100, allsize);
}
if (everyList.size() > 0) {
openMapper.addProductNoBatchs(everyList);
}
}
System.out.println("oa产品新增成功条数" + allsize);
}
return success();
} catch (Exception e) {
e.printStackTrace();
return error(e.getMessage());
}
}
protected Boolean oneMinHas(Date lastData){
if(lastData != null){

@ -27,6 +27,27 @@
<update id="updateWorkOrderStatus">
update pro_order_workorder set status = #{status} where belong_work_order = #{workorderCode}
</update>
<update id="updateProductNoBatchs">
<foreach collection="list" item="item" separator=";">
update base_product
set
product_code = #{item.productCode},
product_desc_zh = #{item.productDescZh},
product_group = #{item.productGroup},
product_group_name = #{item.productGroupName},
meins = #{item.meins},
product_model = #{item.productModel},
umrez = #{item.umrez},
umren = #{item.umren},
mvgr5 = #{item.mvgr5},
gross_weight = #{item.grossWeight},
volume = #{item.volume},
update_by = 'oa',
update_time = GETDATE()
where
product_code = #{item.productCode}
</foreach>
</update>
<!--获取在邦rfid 工单的信息-->
<select id="getRfidInfo" resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
@ -385,6 +406,22 @@
)
</foreach>
</insert>
<insert id="addProductNoBatchs">
insert into base_product(
product_code,product_desc_zh,product_group,product_group_name,
meins,product_model,umrez,umren,mvgr5,
gross_weight,volume
,create_by,create_time
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.productCode},#{item.productDescZh},#{item.productGroup},#{item.productGroupName},
#{item.meins},#{item.productModel},#{item.umrez},#{item.umren},#{item.mvgr5},
#{item.grossWeight},#{item.volume},
'oa',GETDATE()
)
</foreach>
</insert>
<select id="getNoticesGroup" resultType="com.op.system.api.domain.SysNoticeGroup">
select sng.notice_id noticeId,
@ -412,5 +449,11 @@
from sys_notice sn
where sn.notice_id = #{noticeId}
</select>
<select id="getExsitCodes" resultType="java.lang.String">
select product_code from base_product where product_code in
<foreach collection="list" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</select>
</mapper>

@ -7,10 +7,7 @@ import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -309,11 +306,11 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
}
logger.info("质检检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
CompletableFuture.runAsync(() -> {
System.out.println("异步执行企业微信发送");
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("质检检验企业微信提醒结果:" + JSONObject.toJSONString(result));
}).start();
});
}
//发企业微信--------------------结束
}

Loading…
Cancel
Save