打印模板增加打印时间字段

tags/yfai-mes-ext-v1.3 yfai-mes-ext-v1.3
jun 9 months ago
parent 22157ae0eb
commit 5a5bce2767

@ -1,3 +1,4 @@
import cn.estsh.i3plus.platform.common.tool.TimeTool
import cn.estsh.i3plus.platform.plugin.datasource.DynamicDataSourceProxy
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack
@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
import org.springframework.util.CollectionUtils
import org.springframework.util.StringUtils
import javax.annotation.Resource
import java.sql.Connection
@ -65,7 +67,7 @@ class MesProductionRecordToPisces {
Map<String, MesWorkCenter> mesWorkCenterMap = new HashMap<>();
Map<String, MesWorkCell> mesWorkCellMap = new HashMap<>();
Map<String, MesProcess> mesProcessMap = new HashMap<>();
List<String> updateList = new ArrayList<>();
List<String> idList = new ArrayList<>();
List<Map<String, Object>> destData = new ArrayList<>();
for (Map<String, Object> rowMap : srcData) {
@ -77,8 +79,9 @@ class MesProductionRecordToPisces {
if (!CollectionUtils.isEmpty(dataMap) && dataMap.size() > 0) {
rowMap.put("BARCODE_ID", dataMap.iterator().next().get("ID"))
updateList.add("update mes_production_record set system_sync_status = 1 where id= " + rowMap.get("id") + " ;")
idList.add(rowMap.get("id").toString());
} else {
LOGGER.info("条码{}物料{}条码信息未同步,信息不存在", rowMap.get("product_sn"),rowMap.get("part_no"))
continue
}
String workCenterCode = String.valueOf(rowMap.get("work_center_code"));
@ -145,7 +148,9 @@ class MesProductionRecordToPisces {
}
//
if (!CollectionUtils.isEmpty(updateList) && updateList.size() > 0) {
if (!CollectionUtils.isEmpty(idList) && idList.size() > 0) {
List<String> updateList = new ArrayList<>();
updateList.add("update mes_production_record set system_sync_date_time='"+ TimeTool.getNowTime(true)+"',system_sync_status = 1 where id in (" + String.join(",",idList) + ") ;")
this.mesConn = mesDataSource.getWriteConnectionWithoutPool();
mesDataSource.executeAsBatch(updateList, mesConn)
mesDataSource.closeConnectionWithoutPoll(this.mesConn)
@ -202,4 +207,10 @@ class MesProductionRecordToPisces {
return mesProcessMap.get(processCode);
}
def saveSrcData(MesInterfaceDataMapper mapper, List<Map<String, Object>> srcData) throws Exception {
if (srcData == null || srcData.size() == 0 || StringUtils.isEmpty(mapper.getSrcTableName())) {
return srcData
}
}
}

@ -0,0 +1,44 @@
import cn.estsh.i3plus.platform.common.tool.TimeTool
import cn.estsh.i3plus.platform.plugin.datasource.DynamicDataSourceProxy
import cn.estsh.i3plus.pojo.mes.dbinterface.MesInterfaceDataMapper
import lombok.Getter
import lombok.Setter
import org.springframework.util.StringUtils
import javax.annotation.Resource
import java.sql.Connection
/**
* @Description :MES2PISCES-
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/8/5 20:19
* @Modify:
* */
class MesUpdateSrcData {
@Resource(name = "mesDataSource")
private DynamicDataSourceProxy mesDataSource;
@Getter
@Setter
private Connection mesConn;
def saveSrcData(MesInterfaceDataMapper mapper, List<Map<String, Object>> srcData) throws Exception {
if (srcData == null || srcData.size() == 0 || StringUtils.isEmpty(mapper.getSrcTableName())) {
return srcData
}
List<String> idList = new ArrayList<>();
for (Map<String, Object> data : srcData) {
idList.add(data.get("id").toString());
}
//
List<String> updateList = new ArrayList<>();
updateList.add("update " + mapper.getSrcTableName() + " set system_sync_date_time='" + TimeTool.getNowTime(true) + "',system_sync_status='1' where id in (" + String.join(",", idList) + ") ;");
this.mesConn = mesDataSource.getWriteConnectionWithoutPool();
mesDataSource.executeAsBatch(updateList, mesConn)
mesDataSource.closeConnectionWithoutPoll(this.mesConn)
}
}
Loading…
Cancel
Save