二级更新计划新增软推荐,计划录入和实绩内容添加入场钢卷号信息
This commit is contained in:
@@ -131,8 +131,6 @@ public class MessageReceiveSchedule extends BaseSchedule {
|
|||||||
ProStoppage stoppage = new ProStoppage();
|
ProStoppage stoppage = new ProStoppage();
|
||||||
stoppage.setStartDate(lowSpeedStartTime);
|
stoppage.setStartDate(lowSpeedStartTime);
|
||||||
stoppage.setDuration(BigDecimal.ZERO); // 初始为0,恢复后再更新
|
stoppage.setDuration(BigDecimal.ZERO); // 初始为0,恢复后再更新
|
||||||
stoppage.setStopType("AUTO_LOW_SPEED");
|
|
||||||
stoppage.setRemark("stripSpeed<5 自动停机");
|
|
||||||
if (proStoppageService.save(stoppage)) {
|
if (proStoppageService.save(stoppage)) {
|
||||||
currentStopId = stoppage.getStopid();
|
currentStopId = stoppage.getStopid();
|
||||||
stopRecorded = true;
|
stopRecorded = true;
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import com.fizz.business.form.CalcPdiPlanForm;
|
|||||||
import com.fizz.business.form.CrmPdiPlanForm;
|
import com.fizz.business.form.CrmPdiPlanForm;
|
||||||
import com.fizz.business.form.PlanQueryForm;
|
import com.fizz.business.form.PlanQueryForm;
|
||||||
import com.fizz.business.service.CrmPdiPlanService;
|
import com.fizz.business.service.CrmPdiPlanService;
|
||||||
|
import com.fizz.business.service.L3PickupRecommendService;
|
||||||
import com.fizz.business.vo.CrmPdiPlanVO;
|
import com.fizz.business.vo.CrmPdiPlanVO;
|
||||||
|
import com.fizz.business.vo.L3PickupRecommendVO;
|
||||||
import com.fizz.business.vo.PdiPlanSetupInfoVO;
|
import com.fizz.business.vo.PdiPlanSetupInfoVO;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
@@ -25,6 +27,9 @@ public class CrmPdiPlanController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CrmPdiPlanService crmPdiPlanService;
|
private CrmPdiPlanService crmPdiPlanService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private L3PickupRecommendService l3PickupRecommendService;
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Operation(summary ="新增计划")
|
@Operation(summary ="新增计划")
|
||||||
public R<Boolean> add(@RequestBody CrmPdiPlan crmPdiPlan) {
|
public R<Boolean> add(@RequestBody CrmPdiPlan crmPdiPlan) {
|
||||||
@@ -55,4 +60,10 @@ public class CrmPdiPlanController {
|
|||||||
return R.ok(crmPdiPlanService.listAll(form));
|
return R.ok(crmPdiPlanService.listAll(form));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/l3PickupRecommend")
|
||||||
|
@Operation(summary ="三级领料推荐")
|
||||||
|
public R<List<L3PickupRecommendVO>> l3PickupRecommend(@RequestParam(required = false, defaultValue = "10") Integer limit) {
|
||||||
|
return R.ok(l3PickupRecommendService.listPickupRecommend(limit));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public class CrmPdiPlan implements Serializable {
|
|||||||
@Schema(description = "钢卷号")
|
@Schema(description = "钢卷号")
|
||||||
private String coilid;
|
private String coilid;
|
||||||
|
|
||||||
|
@Schema(description = "入场钢卷号")
|
||||||
|
private String enterCoilNo;
|
||||||
|
|
||||||
@Schema(description = "机组号")
|
@Schema(description = "机组号")
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ public class CrmPdoExcoil implements Serializable {
|
|||||||
@Schema(description = "来料卷")
|
@Schema(description = "来料卷")
|
||||||
private String entryMatId;
|
private String entryMatId;
|
||||||
|
|
||||||
|
@Schema(description = "入场钢卷号")
|
||||||
|
private String enterCoilNo;
|
||||||
|
|
||||||
@Schema(description = "分切数")
|
@Schema(description = "分切数")
|
||||||
private Integer subId;
|
private Integer subId;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class CrmPdiPlanForm {
|
|||||||
|
|
||||||
private Integer seqid; // 主键ID
|
private Integer seqid; // 主键ID
|
||||||
private String coilid; // 钢卷号
|
private String coilid; // 钢卷号
|
||||||
|
private String enterCoilNo; // 入场钢卷号
|
||||||
private String unitCode; // 钢卷号
|
private String unitCode; // 钢卷号
|
||||||
private Integer picklingCount; // 酸洗次数
|
private Integer picklingCount; // 酸洗次数
|
||||||
private Integer dummyCoilFlag; // 虚卷标识
|
private Integer dummyCoilFlag; // 虚卷标识
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.fizz.business.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface L3PickupRecommendMapper {
|
||||||
|
|
||||||
|
@Select("SELECT action_id, coil_id, current_coil_no, priority, scan_time " +
|
||||||
|
"FROM wms_coil_pending_action " +
|
||||||
|
"WHERE action_type = 501 AND action_status = 0 AND del_flag = 0 " +
|
||||||
|
"ORDER BY priority DESC, scan_time ASC, action_id ASC LIMIT #{limit}")
|
||||||
|
List<Map<String, Object>> selectPendingActions(@Param("limit") Integer limit);
|
||||||
|
|
||||||
|
@Select("SELECT coil_id, enter_coil_no FROM wms_material_coil WHERE coil_id = #{coilId} LIMIT 1")
|
||||||
|
Map<String, Object> selectMaterialByCoilId(@Param("coilId") Long coilId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.fizz.business.service;
|
||||||
|
|
||||||
|
import com.fizz.business.vo.L3PickupRecommendVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface L3PickupRecommendService {
|
||||||
|
|
||||||
|
List<L3PickupRecommendVO> listPickupRecommend(Integer limit);
|
||||||
|
}
|
||||||
@@ -61,6 +61,9 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
*/
|
*/
|
||||||
public boolean addCrmPdiPlan(CrmPdiPlan crmPdiPlan) {
|
public boolean addCrmPdiPlan(CrmPdiPlan crmPdiPlan) {
|
||||||
crmPdiPlan.setStatus("READY");
|
crmPdiPlan.setStatus("READY");
|
||||||
|
if (StrUtil.isBlank(crmPdiPlan.getEnterCoilNo())) {
|
||||||
|
crmPdiPlan.setEnterCoilNo(crmPdiPlan.getCoilid());
|
||||||
|
}
|
||||||
|
|
||||||
return this.save(crmPdiPlan);
|
return this.save(crmPdiPlan);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ public class CrmPdoExcoilServiceImpl extends ServiceImpl<CrmPdoExcoilMapper, Crm
|
|||||||
* @return 是否添加成功
|
* @return 是否添加成功
|
||||||
*/
|
*/
|
||||||
public boolean addCrmPdoExcoil(CrmPdoExcoil crmPdoExcoil) {
|
public boolean addCrmPdoExcoil(CrmPdoExcoil crmPdoExcoil) {
|
||||||
|
if (StringUtils.isEmpty(crmPdoExcoil.getEnterCoilNo())) {
|
||||||
|
crmPdoExcoil.setEnterCoilNo(crmPdoExcoil.getEntryMatId());
|
||||||
|
}
|
||||||
return this.save(crmPdoExcoil);
|
return this.save(crmPdoExcoil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.fizz.business.service.impl;
|
||||||
|
|
||||||
|
import com.fizz.business.mapper.L3PickupRecommendMapper;
|
||||||
|
import com.fizz.business.service.L3PickupRecommendService;
|
||||||
|
import com.fizz.business.vo.L3PickupRecommendVO;
|
||||||
|
import com.ruoyi.common.annotation.DataSource;
|
||||||
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class L3PickupRecommendServiceImpl implements L3PickupRecommendService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private L3PickupRecommendMapper l3PickupRecommendMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataSource(DataSourceType.L3)
|
||||||
|
public List<L3PickupRecommendVO> listPickupRecommend(Integer limit) {
|
||||||
|
int queryLimit = (limit == null || limit <= 0) ? 10 : Math.min(limit, 50);
|
||||||
|
List<Map<String, Object>> pendingActions = l3PickupRecommendMapper.selectPendingActions(queryLimit);
|
||||||
|
List<L3PickupRecommendVO> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map<String, Object> action : pendingActions) {
|
||||||
|
L3PickupRecommendVO vo = new L3PickupRecommendVO();
|
||||||
|
vo.setActionId(toLong(action.get("action_id")));
|
||||||
|
vo.setSourceCoilId(toLong(action.get("coil_id")));
|
||||||
|
vo.setCoilId(toStringValue(action.get("current_coil_no")));
|
||||||
|
vo.setPriority(toInteger(action.get("priority")));
|
||||||
|
vo.setScanTime(toLocalDateTime(action.get("scan_time")));
|
||||||
|
|
||||||
|
Long sourceCoilId = vo.getSourceCoilId();
|
||||||
|
if (sourceCoilId != null) {
|
||||||
|
Map<String, Object> material = l3PickupRecommendMapper.selectMaterialByCoilId(sourceCoilId);
|
||||||
|
if (material != null) {
|
||||||
|
vo.setEnterCoilNo(toStringValue(material.get("enter_coil_no")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long toLong(Object value) {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof Number) return ((Number) value).longValue();
|
||||||
|
try {
|
||||||
|
return Long.parseLong(String.valueOf(value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer toInteger(Object value) {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof Number) return ((Number) value).intValue();
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(String.valueOf(value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toStringValue(Object value) {
|
||||||
|
return value == null ? null : String.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LocalDateTime toLocalDateTime(Object value) {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof LocalDateTime) return (LocalDateTime) value;
|
||||||
|
if (value instanceof Timestamp) return ((Timestamp) value).toLocalDateTime();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ public class PdoExCoilServiceImpl implements PdoExCoilService {
|
|||||||
pdoExCoilDTO.setProcessCode(SYSTEM_MODULE);
|
pdoExCoilDTO.setProcessCode(SYSTEM_MODULE);
|
||||||
pdoExCoilDTO.setExitMatId(exitCoil.getExitMatId());
|
pdoExCoilDTO.setExitMatId(exitCoil.getExitMatId());
|
||||||
pdoExCoilDTO.setEntryMatId(exitCoil.getEntryMatId());
|
pdoExCoilDTO.setEntryMatId(exitCoil.getEntryMatId());
|
||||||
|
pdoExCoilDTO.setEnterCoilNo(plan.getEnterCoilNo());
|
||||||
pdoExCoilDTO.setSubId(exitCoil.getSubNum());
|
pdoExCoilDTO.setSubId(exitCoil.getSubNum());
|
||||||
pdoExCoilDTO.setStartPosition(exitCoil.getStartPos());
|
pdoExCoilDTO.setStartPosition(exitCoil.getStartPos());
|
||||||
pdoExCoilDTO.setEndPosition(exitCoil.getEndPos());
|
pdoExCoilDTO.setEndPosition(exitCoil.getEndPos());
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ public class CrmPdiPlanVO {
|
|||||||
@Schema(description = "钢卷号")
|
@Schema(description = "钢卷号")
|
||||||
private String coilid;
|
private String coilid;
|
||||||
|
|
||||||
|
@Schema(description = "入场钢卷号")
|
||||||
|
private String enterCoilNo;
|
||||||
|
|
||||||
@Schema(description = "机组号")
|
@Schema(description = "机组号")
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.fizz.business.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "三级领料推荐")
|
||||||
|
public class L3PickupRecommendVO {
|
||||||
|
|
||||||
|
@Schema(description = "待操作主键")
|
||||||
|
private Long actionId;
|
||||||
|
|
||||||
|
@Schema(description = "当前钢卷号(回填到计划coilid)")
|
||||||
|
private String coilId;
|
||||||
|
|
||||||
|
@Schema(description = "入场钢卷号(回填到计划enterCoilNo)")
|
||||||
|
private String enterCoilNo;
|
||||||
|
|
||||||
|
@Schema(description = "L3钢卷ID")
|
||||||
|
private Long sourceCoilId;
|
||||||
|
|
||||||
|
@Schema(description = "优先级")
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
@Schema(description = "扫码时间")
|
||||||
|
private LocalDateTime scanTime;
|
||||||
|
}
|
||||||
@@ -15,5 +15,10 @@ public enum DataSourceType
|
|||||||
/**
|
/**
|
||||||
* 从库
|
* 从库
|
||||||
*/
|
*/
|
||||||
SLAVE
|
SLAVE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* L3库
|
||||||
|
*/
|
||||||
|
L3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ public class DruidConfig
|
|||||||
return druidProperties.dataSource(dataSource);
|
return druidProperties.dataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.l3")
|
||||||
|
public DataSource l3DataSource(DruidProperties druidProperties)
|
||||||
|
{
|
||||||
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean(name = "dynamicDataSource")
|
@Bean(name = "dynamicDataSource")
|
||||||
@Primary
|
@Primary
|
||||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
public DynamicDataSource dataSource(DataSource masterDataSource)
|
||||||
@@ -56,6 +64,7 @@ public class DruidConfig
|
|||||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||||
|
setDataSource(targetDataSources, DataSourceType.L3.name(), "l3DataSource");
|
||||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user