Conflicts:
	6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java
This commit is contained in:
李广豪 2022-07-08 19:56:45 +08:00
commit 835b98e486
17 changed files with 359 additions and 102 deletions

View File

@ -100,6 +100,19 @@ public abstract class BaseSupport {
protected <T> R<T> successful(String msg, T data) {
return R.ok(msg, data);
}
/**
* <p>
* 请求成功
* </p>
* @param code 正确码
* @param msg 提示内容
* @param data 数据内容
* @param <T> 对象泛型
* @return
*/
protected <T> R<T> successful(int code,String msg, T data) {
return R.ok(code,msg, data);
}
/**
* <p>

View File

@ -15,7 +15,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author mt
* @since 2021-12-29
* @since 2022-01-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -79,7 +79,7 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
private String idenCardNum;
/**
* 硬度检验结果合格不合格返工作废
* 硬度检验结果待检验合格不合格返工作废
*/
@TableField("hardness")
private String hardness;
@ -120,6 +120,90 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
@TableField("hardness_value_three")
private String hardnessValueThree;
/**
* 金相检验渗碳淬火 渗碳层深度
*/
@TableField("metallography_stch_stccsd")
private Float metallographyStchStccsd;
/**
* 金相检验渗碳淬火 表面为马氏体残余奥氏体
*/
@TableField("metallography_stch_mstost")
private String metallographyStchMstost;
/**
* 金相检验渗碳淬火 细小颗粒状碳化物
*/
@TableField("metallography_stch_xxklzthw")
private String metallographyStchXxklzthw;
/**
* 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体
*/
@TableField("metallography_stch_dtmstyltst")
private String metallographyStchDtmstyltst;
/**
* 金相检验整体淬火 基体为回火马氏体
*/
@TableField("metallography_ztch_hhmst")
private String metallographyZtchHhmst;
/**
* 金相检验整体淬火 基体为回火托式体
*/
@TableField("metallography_ztch_hhtst")
private String metallographyZtchHhtst;
/**
* 金相检验整体淬火 基体为回火素式体
*/
@TableField("metallography_ztch_hhsst")
private String metallographyZtchHhsst;
/**
* 金相检验氮化 表面亮白色的为氮化合物层深
*/
@TableField("metallography_dh_dhhwcs")
private Float metallographyDhDhhwcs;
/**
* 金相检验氮化 向内为扩散层深
*/
@TableField("metallography_dh_kscs")
private Float metallographyDhKscs;
/**
* 金相检验氮化 心部
*/
@TableField("metallography_dh_xb")
private String metallographyDhXb;
/**
* 金相检验表面淬火 表面为板条马氏体
*/
@TableField("metallography_bmch_btmst")
private String metallographyBmchBtmst;
/**
* 金相检验表面淬火 心部
*/
@TableField("metallography_bmch_xb")
private String metallographyBmchXb;
/**
* 金相检验 备注
*/
@TableField("metallography_bz")
private String metallographyBz;
/**
* 金相检验心部硬度 心部硬度检验结果
*/
@TableField("metallography_xbyd_xbydjyjg")
private Float metallographyXbydXbydjyjg;
public static final String ID = "id";
@ -153,6 +237,34 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
public static final String HARDNESS_VALUE_THREE = "hardness_value_three";
public static final String METALLOGRAPHY_STCH_STCCSD = "metallography_stch_stccsd";
public static final String METALLOGRAPHY_STCH_MSTOST = "metallography_stch_mstost";
public static final String METALLOGRAPHY_STCH_XXKLZTHW = "metallography_stch_xxklzthw";
public static final String METALLOGRAPHY_STCH_DTMSTYLTST = "metallography_stch_dtmstyltst";
public static final String METALLOGRAPHY_ZTCH_HHMST = "metallography_ztch_hhmst";
public static final String METALLOGRAPHY_ZTCH_HHTST = "metallography_ztch_hhtst";
public static final String METALLOGRAPHY_ZTCH_HHSST = "metallography_ztch_hhsst";
public static final String METALLOGRAPHY_DH_DHHWCS = "metallography_dh_dhhwcs";
public static final String METALLOGRAPHY_DH_KSCS = "metallography_dh_kscs";
public static final String METALLOGRAPHY_DH_XB = "metallography_dh_xb";
public static final String METALLOGRAPHY_BMCH_BTMST = "metallography_bmch_btmst";
public static final String METALLOGRAPHY_BMCH_XB = "metallography_bmch_xb";
public static final String METALLOGRAPHY_BZ = "metallography_bz";
public static final String METALLOGRAPHY_XBYD_XBYDJYJG = "metallography_xbyd_xbydjyjg";
@Override
protected Serializable pkVal() {
return this.id;

View File

@ -97,7 +97,7 @@ public class OrderInfo extends Model<OrderInfo> {
private String orderNo;
/**
* 原订单号APMS系统获取 返单时才存在
* 原订单号(对应原先的标识卡号)APMS系统获取 返单时才存在
*/
@TableField("old_order_no")
private String oldOrderNo;

View File

@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult;
* </p>
*
* @author mt
* @since 2021-12-29
* @since 2022-01-05
*/
public interface ApmsCheckResultMapper extends BaseMapper<ApmsCheckResult> {

View File

@ -20,12 +20,30 @@
<result column="hardness_value_one" property="hardnessValueOne"/>
<result column="hardness_value_two" property="hardnessValueTwo"/>
<result column="hardness_value_three" property="hardnessValueThree"/>
<result column="metallography_stch_stccsd" property="metallographyStchStccsd"/>
<result column="metallography_stch_mstost" property="metallographyStchMstost"/>
<result column="metallography_stch_xxklzthw" property="metallographyStchXxklzthw"/>
<result column="metallography_stch_dtmstyltst" property="metallographyStchDtmstyltst"/>
<result column="metallography_ztch_hhmst" property="metallographyZtchHhmst"/>
<result column="metallography_ztch_hhtst" property="metallographyZtchHhtst"/>
<result column="metallography_ztch_hhsst" property="metallographyZtchHhsst"/>
<result column="metallography_dh_dhhwcs" property="metallographyDhDhhwcs"/>
<result column="metallography_dh_kscs" property="metallographyDhKscs"/>
<result column="metallography_dh_xb" property="metallographyDhXb"/>
<result column="metallography_bmch_btmst" property="metallographyBmchBtmst"/>
<result column="metallography_bmch_xb" property="metallographyBmchXb"/>
<result column="metallography_bz" property="metallographyBz"/>
<result column="metallography_xbyd_xbydjyjg" property="metallographyXbydXbydjyjg"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, valid, create_time, creator_id, updater_id, update_time, version, sheet_no, iden_card_num, hardness,
metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three
metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three,
metallography_stch_stccsd, metallography_stch_mstost, metallography_stch_xxklzthw,
metallography_stch_dtmstyltst, metallography_ztch_hhmst, metallography_ztch_hhtst, metallography_ztch_hhsst,
metallography_dh_dhhwcs, metallography_dh_kscs, metallography_dh_xb, metallography_bmch_btmst,
metallography_bmch_xb, metallography_bz, metallography_xbyd_xbydjyjg
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult;
* </p>
*
* @author mt
* @since 2021-12-29
* @since 2022-01-05
*/
public interface ApmsCheckResultServiceBiz extends IService<ApmsCheckResult> {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-12-29
* @since 2022-01-05
*/
@Service
public class ApmsCheckResultServiceBizImpl extends ServiceImpl<ApmsCheckResultMapper, ApmsCheckResult> implements ApmsCheckResultServiceBiz {

View File

@ -99,5 +99,8 @@ public class R<T> implements Serializable {
public static <T> R<T> ok(String msg, T data) {
return new R<T>().msg(msg).data(data);
}
public static <T> R<T> ok(int code,String msg, T data) {
return new R<T>().code(code).msg(msg).data(data);
}
}

View File

@ -47,10 +47,9 @@ public class ApmsController extends BaseController {
@Autowired
private CommunicationLogServiceBiz communicationLogServiceBiz;
// static String Token = "eyJhbGciOiJIUzI1NiJ9.eyJkYXRlIjozMTkyNzU4NDk4ODA3LCJwbGF0Rm9ybUlkIjoyLCJhcGlLZXkiOiI3ZWU4ZjU5YmJhZWFlMjdlIiwiZXhwIjozMTkyNzU4NDk4LCJpYXQiOjE2Mzc1NTg0OTh9.RH3MRQr1dCBYW996-WXN69eXu1ZFblAQHfhZHNbTmCg";
static String Token = "";
static LocalDateTime TokenExpireTime = LocalDateTime.now();
static String ApiAddress = "http://59.110.171.25:80";
static String ApiAddress = "http://192.168.1.109:80";
@PostMapping(value = "apmsPostOrder")
@ApiOperation(value = "WMS接收APMS推送订单信息")

View File

@ -139,6 +139,10 @@ public class CurrTaskController extends BaseController {
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
Boolean apmsCreateProcessSheet=false;
String sheetNo=null;
int i=1;
R<ApmsCreateProcessSheetVo> processSheet=null;
//自动任务循环添加多条currTask
AutoExeTask autoExeTask=new AutoExeTask();
for (TaskCreateParam param:detParams
@ -168,27 +172,30 @@ public class CurrTaskController extends BaseController {
{
return failed("创建失败APMS中验证炉号" + kilnCode + "失败!");
}
if (i==1){
//通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(param.getCraftCode());
//fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>();
param.getDetParams().forEach(e -> {
CreateItem createItem = new CreateItem();
createItem.setItemCode(e.getIdenCardNum());
createItem.setQuantity(e.getQuantity().intValue());
createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem);
});
apmsCreateSheet.setStoveCode(kilnCode);
apmsCreateSheet.setItems(createItems);
processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
apmsCreateProcessSheet=processSheet.getData().getSuccess();
sheetNo=processSheet.getData().getSheetNo();
}
//通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(param.getCraftCode());
//fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>();
param.getDetParams().forEach(e -> {
CreateItem createItem = new CreateItem();
createItem.setItemCode(e.getIdenCardNum());
createItem.setQuantity(e.getQuantity().intValue());
createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem);
});
apmsCreateSheet.setStoveCode(kilnCode);
apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
if (processSheet.getData().getSuccess())
if (apmsCreateProcessSheet)
{
//apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param);
@ -227,19 +234,19 @@ public class CurrTaskController extends BaseController {
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
String sheetNo = processSheet.getData().getSheetNo();
//将返回的生产单号写入到主任务中
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
currTaskById.setSheetNo(sheetNo);
currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
return successful("创建成功,任务添加至等待执行队列。");
//return successful("创建成功,任务添加至等待执行队列。");
}
else
{
return failed("创建失败APMS报错" + processSheet.getData().getMsg());
}
i++;
}
return null;
}
@ -264,8 +271,8 @@ public class CurrTaskController extends BaseController {
@PostMapping(value = "deleteBySheetNo")
@ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)")
public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
return currTaskService.deleteBySheetNo(sheetNo);
public R<String> deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) {
return currTaskService.deleteBySheetNo(param.getSheetNo());
}
@PostMapping(value = "runTask")
@ApiOperation(value = "执行任务")

View File

@ -41,6 +41,92 @@ public class ApmsCompleteOrder extends BaseParam {
@ApiModelProperty(value = "硬度检验值3", required = false)
private String hardnessValueThree;
/**
* 金相检验渗碳淬火 渗碳层深度
*/
@ApiModelProperty(value = "金相检验渗碳淬火 渗碳层深度")
private Float metallographyStchStccsd;
/**
* 金相检验渗碳淬火 表面为马氏体残余奥氏体
*/
@ApiModelProperty(value = "金相检验渗碳淬火 表面为马氏体、残余奥氏体(级)")
private String metallographyStchMstost;
/**
* 金相检验渗碳淬火 细小颗粒状碳化物
*/
@ApiModelProperty(value = "金相检验渗碳淬火 细小颗粒状碳化物")
private String metallographyStchXxklzthw;
/**
* 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体
*/
@ApiModelProperty(value = "金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级)")
private String metallographyStchDtmstyltst;
/**
* 金相检验整体淬火 基体为回火马氏体
*/
@ApiModelProperty(value = "金相检验整体淬火 基体为回火马氏体(级)")
private String metallographyZtchHhmst;
/**
* 金相检验整体淬火 基体为回火托式体
*/
@ApiModelProperty(value = "金相检验整体淬火 基体为回火托式体(级)")
private String metallographyZtchHhtst;
/**
* 金相检验整体淬火 基体为回火素式体
*/
@ApiModelProperty(value = "金相检验整体淬火 基体为回火素式体(级)")
private String metallographyZtchHhsst;
/**
* 金相检验氮化 表面亮白色的为氮化合物层深
*/
@ApiModelProperty(value = "金相检验氮化 表面亮白色的为氮化合物层深")
private Float metallographyDhDhhwcs;
/**
* 金相检验氮化 向内为扩散层深
*/
@ApiModelProperty(value = "金相检验氮化 向内为扩散层深")
private Float metallographyDhKscs;
/**
* 金相检验氮化 心部
*/
@ApiModelProperty(value = "金相检验氮化 心部")
private String metallographyDhXb;
/**
* 金相检验表面淬火 表面为板条马氏体
*/
@ApiModelProperty(value = "金相检验表面淬火 表面为板条马氏体(级)")
private String metallographyBmchBtmst;
/**
* 金相检验表面淬火 心部
*/
@ApiModelProperty(value = "金相检验表面淬火 心部")
private String metallographyBmchXb;
/**
* 金相检验 备注
*/
@ApiModelProperty(value = "金相检验 备注")
private String metallographyBz;
/**
* 金相检验心部硬度 心部硬度检验结果
*/
@ApiModelProperty(value = "金相检验心部硬度 心部硬度检验结果")
private Float metallographyXbydXbydjyjg;
@ApiModelProperty(value = "备注", required = false)
private String remake;
}

View File

@ -23,4 +23,7 @@ public class CurrTaskQueryParam extends BasePageParam {
@ApiModelProperty(value = "车辆id")
private String vehicleId;
private String sheetNo;
}

View File

@ -76,6 +76,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
RunTaskUtils runTaskUtils;
@Autowired
AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Autowired
KilnInfoServiceBiz kilnInfoServiceBiz;
@Override
public CurrTaskVo getCurrTask(IdParam idParam) {
@ -101,11 +103,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
CurrTask currTask = new CurrTask();
BeanUtils.copyProperties(param, currTask);
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
//根据工艺号查询工艺id以及工艺plc值
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CREATOR_ID, param.getCraftCode()));
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode()));
currTask.setTargetPosition(kilnInfo.getCode());
currTask.setCraftCodeId(one.getId());
currTask.setPlcValue(one.getPlcValue());
currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE"));
currTask.setTaskCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE"));
setCommonField(currTask);
currTaskServiceBiz.save(currTask);
return successful(IdVo.builder().id(currTask.getId()).build());
@ -152,8 +158,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (apmsStartProcessR.getData().getSuccess())
{
currTaskServiceBiz.removeById(byId.getId());
currTaskDetService.deleteByCurrTaskId(byId.getId());
Long currTaskId = byId.getId();
currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
if (byId.getIsAuto()==1){
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId()));
if (currTaskList.size()==0){
autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId());
}
}
return successful("APMS生产单删除成功。");
}
else
@ -161,6 +174,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
return failed(apmsStartProcessR.getData().getMsg());
}
}
if (byId.getStatus()==2){
return failed("无法删除,任务已加工完成。");
}
return failed("无法删除,任务正在执行中。");
}

View File

@ -103,7 +103,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
}
orderInfoService.save(orderInfo);
return successful("Wms接收Apms订单成功。", "");
return successful(0,"Wms接收Apms订单成功。", "");
}
@Override
@ -165,8 +165,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param);
Assert.notNull("该订单暂无详细任务记录。", currOrderCurrTask.getRecords());
//获取车辆信息
R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam());
Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId));
//R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam());
//Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId));
//获取窑炉信息
R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam());
Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId));
@ -181,6 +181,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setKilnId(currTask.getKilnId());
orderInfo.setStartPosition(currTask.getStartPosition());
orderInfo.setTargetPosition(currTask.getTargetPosition());
orderInfo.setTaskCode(currTask.getTaskCode());
//orderInfo.setVehicleId(currTask.getVehicleId());
//获取窑炉和车辆的名称信息
if (orderInfo.getKilnId() != null)
@ -216,7 +217,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
// 考虑返工单的加工情况添加到返工统计信息中
if (Objects.nonNull(one.getOldOrderNo()))
{
List<OrderInfo> list = orderInfoService.list(new QueryWrapper<OrderInfo>().eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_NO, one.getOldOrderNo()));
List<OrderInfo> list = orderInfoService.list(new QueryWrapper<OrderInfo>().eq(OrderInfo.VALID, 1).eq(OrderInfo.IDEN_CARD_NUM, one.getOldOrderNo()));
float reQuantity = 0;
float reWeight = 0;
for (OrderInfo orderInfo : list)
@ -265,7 +266,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
byId.setUpdateTime(LocalDateTime.now());
byId.setOrderVoid(0);
orderInfoService.updateById(byId);
return successful("操作成功,订单状态置为作废。", "");
return successful(0,"操作成功,订单状态置为作废。", "");
}
@Override
@ -303,38 +304,23 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
{
//通过标识卡号与生产单号进行检验结果存储
ApmsCheckResult one = new ApmsCheckResult();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo());
BeanUtils.copyProperties(apmsCompleteOrder, one);
one.setCreateTime(LocalDateTime.now());
one.setUpdateTime(LocalDateTime.now());
one.setValid(WhetherEnum.YES.getValue());
one.setMetallography(apmsCompleteOrder.getMetallographic());
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne());
one.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo());
one.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree());
one.setHardness(apmsCompleteOrder.getHardness());
one.setUpdateTime(LocalDateTime.now());
one.setRemake(apmsCompleteOrder.getRemake());
apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("操作成功,接收检验结果完成。", "");
return successful(0,"操作成功,接收检验结果完成。", "");
}
else
{
//存在检验结果更新的情况主管或其他人员可能会更改结果
one1.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one1.setSheetNo(apmsCompleteOrder.getSheetNo());
one1.setValid(WhetherEnum.YES.getValue());
BeanUtils.copyProperties(apmsCompleteOrder, one1);
one1.setMetallography(apmsCompleteOrder.getMetallographic());
one1.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one1.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne());
one1.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo());
one1.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree());
one1.setHardness(apmsCompleteOrder.getHardness());
one1.setUpdateTime(LocalDateTime.now());
one1.setRemake(apmsCompleteOrder.getRemake());
apmsCheckResultServiceBiz.updateById(one1);
return successful("操作成功,更新检验结果完成。", "");
return successful(0,"操作成功,更新检验结果完成。", "");
}
}

View File

@ -132,7 +132,7 @@ public class AsynRunTaskService extends BaseService {
//执行成功,托盘进炉
if (status==1){
// TODO: 2022/7/7 开始记录能源消耗
//asynStartRecordConsume(currTaskId,currTask.getKilnId());
asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
@ -148,7 +148,7 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工单开始
//apmsStartProcess(currTask);
apmsStartProcess(currTask);
}else {
runTask.setStatus(3);
@ -217,7 +217,7 @@ public class AsynRunTaskService extends BaseService {
//执行成功,托盘进炉
if (status==1){
// TODO: 2022/7/7
//asynStartRecordConsume(currTaskId,currTask.getKilnId());
asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
@ -244,7 +244,7 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms生产单开始加工
//apmsStartProcess(currTask);
apmsStartProcess(currTask);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
@ -417,7 +417,7 @@ public class AsynRunTaskService extends BaseService {
if (status==1){
// TODO: 2022/7/7 加工完成记录结束时能源消耗
//asynEndRecordConsume(currTaskId,currTask.getKilnId());
asynEndRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
@ -436,8 +436,9 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工完成
/* ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单等所有加工步骤都完成后上报apms完成生产单
logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单");
ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
apmsEndProcess.setEndTime(LocalDateTime.now().toString());
apmsEndProcess.setEndUser("QJJP03");
apmsEndProcess.setSheetNo(currTask.getSheetNo());
@ -458,6 +459,7 @@ public class AsynRunTaskService extends BaseService {
return;
}
}
logger.info("任务:"+currTask.getTaskCode()+"开始上报apms完成生产单");
ApmsFinishProcessSheet apmsFinishProcessSheet=new ApmsFinishProcessSheet();
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().toString());
@ -477,7 +479,7 @@ public class AsynRunTaskService extends BaseService {
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
if (apmsFinishProcessSheetVoR.getCode()!=0){
logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败");
}*/
}
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
@ -581,7 +583,7 @@ public class AsynRunTaskService extends BaseService {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote();
String nameSpaceNote = nameSpace.getName();
switch (kilnInfo.getType()){
//加工炉
case 1:
@ -600,7 +602,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue);
parTemValue.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -615,7 +617,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue);
parEleValue.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
@ -626,7 +628,7 @@ public class AsynRunTaskService extends BaseService {
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue);
parRotSpeedValue.setCreateTime(LocalDateTime.now());
parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
@ -649,7 +651,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue);
parGasValue.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue);
break;
//回火炉
@ -663,7 +665,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2);
parTemValue2.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue2);
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
@ -678,7 +680,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2);
parEleValue2.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue2);
break;
//氮化炉
@ -701,7 +703,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3);
parTemValue3.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue3);
//电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -716,7 +718,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3);
parEleValue3.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue3);
//实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
@ -741,7 +743,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3);
parGasValue3.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue3);
break;
//清洗炉
@ -759,7 +761,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4);
parEleValue4.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue4);
break;
default:
@ -773,7 +775,7 @@ public class AsynRunTaskService extends BaseService {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote();
String nameSpaceNote = nameSpace.getName();
switch (kilnInfo.getType()){
//加工炉
case 1:
@ -792,7 +794,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue);
parTemValue.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -807,7 +809,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue);
parEleValue.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
@ -818,7 +820,7 @@ public class AsynRunTaskService extends BaseService {
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue);
parRotSpeedValue.setCreateTime(LocalDateTime.now());
parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
@ -841,7 +843,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue);
parGasValue.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue);
break;
//回火炉
@ -855,7 +857,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2);
parTemValue2.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue2);
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
@ -870,7 +872,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2);
parEleValue2.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue2);
break;
//氮化炉
@ -893,7 +895,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3);
parTemValue3.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue3);
//电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -908,7 +910,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3);
parEleValue3.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue3);
//实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
@ -933,7 +935,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3);
parGasValue3.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue3);
break;
//清洗炉
@ -951,7 +953,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4);
parEleValue4.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue4);
break;
default:

View File

@ -203,7 +203,7 @@ public class RunTaskUtils {
} else {
//当前加工步骤不为第一步
int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
if (secondCount == 2) {
if (secondCount == 1) {
//当前为自动任务第二步
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
//该自动任务的工艺类型为2还有第三步

View File

@ -123,7 +123,7 @@ public class ScheduledTask extends BaseService {
/**
* 正在加工的加工任务详情
*/
//@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000*60)
public void screen() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
@ -148,15 +148,15 @@ public class ScheduledTask extends BaseService {
//剩余时间
Integer remainingTime=0;
if (kilnInfo.getType()!=4){
remainingTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramTimeRemain"));
remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
}
if(kilnInfo.getType()==1||kilnInfo.getType()==3){
//运行时间
Integer runTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramRunTime"));
Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
setupTime=runTime+remainingTime;
}
if (kilnInfo.getType()==2){
setupTime=Integer.parseInt(readPlcToString(nameSpace, "SetTime"));
setupTime=readPlc(nameSpace, "SetTime").intValue();
}
nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime);
@ -212,8 +212,9 @@ public class ScheduledTask extends BaseService {
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集高频数据能源消耗暂定30秒
//@Scheduled(fixedDelay = 1000*30)
@Scheduled(fixedDelay = 1000*30)
public void getFastValue(){
logger.info("==采集高频能耗数据开始==");
//加工炉列表
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
for (KilnInfo kilnInfo:kilnInfoList
@ -230,6 +231,10 @@ public class ScheduledTask extends BaseService {
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
if (currTaskId==0){
logger.info("==当前加工的为手动加工任务,不记录能耗==");
continue;
}
//加工炉
if (kilnInfo.getType()==1){
//一号油搅拌转速
@ -295,14 +300,16 @@ public class ScheduledTask extends BaseService {
parGasValue3.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue3);
}
}
}
logger.info("==采集高频能耗数据结束==");
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集低频数据能源消耗暂定3分钟一次
//@Scheduled(fixedDelay = 1000*60*3)
@Scheduled(fixedDelay = 1000*60*3)
public void getSlowValue(){
System.out.println("开始采集数据");
logger.info("==开始采集低频数据==");
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList
) {
@ -317,6 +324,10 @@ public class ScheduledTask extends BaseService {
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
if (currTaskId==0){
logger.info("==当前加工的为手动加工任务,不记录能耗==");
continue;
}
//加工炉
if (kilnInfo.getType()==1){
//实际温度
@ -439,7 +450,7 @@ public class ScheduledTask extends BaseService {
}
}
}
System.out.println("采集完成");
logger.info("==结束采集低频数据==");
}
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务
@ -491,9 +502,10 @@ public class ScheduledTask extends BaseService {
}
//遍历正在工作炉子的报警变量记录报警
//@Scheduled(fixedDelay = 1000*30)
@Scheduled(fixedDelay = 1000*60)
public void listenKilnAlarm(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
logger.info("==开始查询炉子是否有报警==");
for (KilnInfo kilnInfo:kilnInfoList
) {
PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
@ -545,7 +557,7 @@ public class ScheduledTask extends BaseService {
}
}
}
logger.info("==结束查询炉子是否有报警==");
}
//监听车辆是否在线暂时不用