This commit is contained in:
李广豪 2022-01-01 23:16:12 +08:00
commit 10821861aa
10 changed files with 164 additions and 47 deletions

View File

@ -106,8 +106,7 @@ public class MyGenerator {
@Test @Test
public void generateCodeWithInjectConfigForAllTable() { public void generateCodeWithInjectConfigForAllTable() {
generateByTablesWithInjectConfig(new String[]{"t_curr_task"}); generateByTablesWithInjectConfig(new String[]{"t_apms_check_result"});
generateByTablesWithInjectConfig(new String[]{"t_task_his"});
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -15,7 +15,7 @@ import java.time.LocalDateTime;
* </p> * </p>
* *
* @author mt * @author mt
* @since 2021-11-19 * @since 2021-12-29
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -94,7 +94,31 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
* 心部硬度检验值 * 心部硬度检验值
*/ */
@TableField("heart_hardness") @TableField("heart_hardness")
private Float heartHardness; private String heartHardness;
/**
* 备注特殊注释等
*/
@TableField("remake")
private String remake;
/**
* 硬度检验结果1
*/
@TableField("hardness_value_one")
private String hardnessValueOne;
/**
* 硬度检验结果2
*/
@TableField("hardness_value_two")
private String hardnessValueTwo;
/**
* 硬度检验结果3
*/
@TableField("hardness_value_three")
private String hardnessValueThree;
public static final String ID = "id"; public static final String ID = "id";
@ -121,6 +145,14 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
public static final String HEART_HARDNESS = "heart_hardness"; public static final String HEART_HARDNESS = "heart_hardness";
public static final String REMAKE = "remake";
public static final String HARDNESS_VALUE_ONE = "hardness_value_one";
public static final String HARDNESS_VALUE_TWO = "hardness_value_two";
public static final String HARDNESS_VALUE_THREE = "hardness_value_three";
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
return this.id; return this.id;

View File

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

View File

@ -16,12 +16,16 @@
<result column="hardness" property="hardness"/> <result column="hardness" property="hardness"/>
<result column="metallography" property="metallography"/> <result column="metallography" property="metallography"/>
<result column="heart_hardness" property="heartHardness"/> <result column="heart_hardness" property="heartHardness"/>
<result column="remake" property="remake"/>
<result column="hardness_value_one" property="hardnessValueOne"/>
<result column="hardness_value_two" property="hardnessValueTwo"/>
<result column="hardness_value_three" property="hardnessValueThree"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, valid, create_time, creator_id, updater_id, update_time, version, sheet_no, iden_card_num, hardness, id, valid, create_time, creator_id, updater_id, update_time, version, sheet_no, iden_card_num, hardness,
metallography, heart_hardness metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three
</sql> </sql>
</mapper> </mapper>

View File

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

View File

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

View File

@ -58,24 +58,26 @@ public class ApmsController extends BaseController {
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS推送订单信息"); communicationLog.setLogName("WMS接收APMS推送订单信息");
communicationLog.setContent(apmsPostOrderParam.toString());
communicationLog.setType(3); communicationLog.setType(3);
setCommonField(communicationLog); setCommonField(communicationLog);
R<String> stringR = orderInfoService.apmsPostOrder(apmsPostOrderParam);
communicationLog.setContent("param:" + apmsPostOrderParam.toString() + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
return orderInfoService.apmsPostOrder(apmsPostOrderParam); return stringR;
} }
@PostMapping(value = "apmsVoidOrder") @PostMapping(value = "apmsVoidOrder")
@ApiOperation(value = "WMS接收APMS作废订单信息") @ApiOperation(value = "WMS接收APMS作废订单信息")
public R<String> apmsVoidOrder(@Validated @RequestBody String idenCardNum) { public R<String> apmsVoidOrder(@Validated @RequestBody Iden idenCardNum) {
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS作废订单信息"); communicationLog.setLogName("WMS接收APMS作废订单信息");
communicationLog.setType(3); communicationLog.setType(3);
communicationLog.setContent(idenCardNum);
setCommonField(communicationLog); setCommonField(communicationLog);
R<String> stringR = orderInfoService.apmsVoidOrder(idenCardNum.getIdenCardNum());
communicationLog.setContent("param:" + idenCardNum + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
return orderInfoService.apmsVoidOrder(idenCardNum); return stringR;
} }
@PostMapping(value = "apmsCompleteOrder") @PostMapping(value = "apmsCompleteOrder")
@ -85,11 +87,12 @@ public class ApmsController extends BaseController {
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS加工单检验结果"); communicationLog.setLogName("WMS接收APMS加工单检验结果");
communicationLog.setType(3); communicationLog.setType(3);
communicationLog.setContent(apmsCompleteOrder.toString());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
//APMS完成订单,返回检验结果更新结果和后续处理 //APMS完成订单,返回检验结果更新结果和后续处理
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder); R<String> stringR = orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
communicationLog.setContent("param:" + apmsCompleteOrder + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog);
return stringR;
} }
@ -100,7 +103,7 @@ public class ApmsController extends BaseController {
* @return 删除结果 * @return 删除结果
*/ */
@PostMapping(value = "deleteBySheetNo") @PostMapping(value = "deleteBySheetNo")
@ApiOperation(value = "通知APMS删除生产单") @ApiOperation(value = "通知APMS删除生产单", hidden = true)
public R<ApmsEndProcessVo> deleteBySheetNo(@Validated @RequestBody String sheetNo) { public R<ApmsEndProcessVo> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
checkToken(); checkToken();
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
@ -118,7 +121,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "createProcessSheet") @PostMapping(value = "createProcessSheet")
@ApiOperation(value = "通知APMS创建生产单接口") @ApiOperation(value = "通知APMS创建生产单接口", hidden = true)
public R<ApmsCreateProcessSheetVo> createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) { public R<ApmsCreateProcessSheetVo> createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsCreateProcess); String paramJson = JSONUtil.toJsonStr(apmsCreateProcess);
@ -135,7 +138,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "startProcess") @PostMapping(value = "startProcess")
@ApiOperation(value = "通知APMS生产单开始处理") @ApiOperation(value = "通知APMS生产单开始处理", hidden = true)
public R<ApmsStartProcess> startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) { public R<ApmsStartProcess> startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsStartProcess); String paramJson = JSONUtil.toJsonStr(apmsStartProcess);
@ -152,7 +155,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "endProcess") @PostMapping(value = "endProcess")
@ApiOperation(value = "通知APMS生产单结束处理") @ApiOperation(value = "通知APMS生产单结束处理", hidden = true)
public R<ApmsEndProcessVo> endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) { public R<ApmsEndProcessVo> endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsEndProcess); String paramJson = JSONUtil.toJsonStr(apmsEndProcess);
@ -169,7 +172,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "finishProcessSheet") @PostMapping(value = "finishProcessSheet")
@ApiOperation(value = "通知APMS完成生产单接口") @ApiOperation(value = "通知APMS完成生产单接口", hidden = true)
public R<ApmsFinishProcessSheetVo> finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) { public R<ApmsFinishProcessSheetVo> finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet); String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet);
@ -186,7 +189,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "getApmsToken") @PostMapping(value = "getApmsToken")
@ApiOperation(value = "获取APMS Token") @ApiOperation(value = "获取APMS Token", hidden = true)
public R<String> getApmsToken() { public R<String> getApmsToken() {
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("apiKey", "7ee8f59bbaeae27e"); paramMap.put("apiKey", "7ee8f59bbaeae27e");
@ -208,7 +211,7 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "getStoveCodeByWorkShopCode") @PostMapping(value = "getStoveCodeByWorkShopCode")
@ApiOperation(value = "WMS通过APMS使用车间编码获取炉号信息") @ApiOperation(value = "WMS通过APMS使用车间编码获取炉号信息", hidden = true)
public R<ApmsStoveVo> getStoveCodeByWorkShopCode(String workShopCode) { public R<ApmsStoveVo> getStoveCodeByWorkShopCode(String workShopCode) {
checkToken(); checkToken();
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();

View File

@ -16,7 +16,7 @@ public class ApmsCompleteOrder extends BaseParam {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "生产单编号", required = false) @ApiModelProperty(value = "生产单编号", required = true)
private String sheetNo; private String sheetNo;
/** /**
@ -31,7 +31,17 @@ public class ApmsCompleteOrder extends BaseParam {
@ApiModelProperty(value = "金相检验结果", required = true) @ApiModelProperty(value = "金相检验结果", required = true)
private String metallographic; private String metallographic;
@ApiModelProperty(value = "心部硬度检验值", required = true) @ApiModelProperty(value = "心部硬度检验值", required = false)
private Float heartHardness; private String heartHardness;
@ApiModelProperty(value = "硬度检验值1", required = false)
private String hardnessValueOne;
@ApiModelProperty(value = "硬度检验值2", required = false)
private String hardnessValueTwo;
@ApiModelProperty(value = "硬度检验值3", required = false)
private String hardnessValueThree;
@ApiModelProperty(value = "备注", required = false)
private String remake;
} }

View File

@ -0,0 +1,18 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Apms作废生产单", description = "Apms作废生产单")
public class Iden extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
}

View File

@ -30,6 +30,7 @@ import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo; import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo; import com.mt.wms.empty.vo.OrderInfoVo;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -81,16 +82,28 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Autowired @Autowired
ApmsController apmsControl; ApmsController apmsControl;
private void setCommon(OrderInfo communicationLog) {
communicationLog.setValid(WhetherEnum.YES.getValue());
communicationLog.setCreateTime(LocalDateTime.now());
communicationLog.setUpdateTime(LocalDateTime.now());
}
@Override @Override
public R<String> apmsPostOrder(OrderParamForApms apmsPostOrderParam) { public R<String> apmsPostOrder(OrderParamForApms apmsPostOrderParam) {
OrderInfo orderInfo = new OrderInfo(); OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(apmsPostOrderParam, orderInfo); BeanUtils.copyProperties(apmsPostOrderParam, orderInfo);
setCommonField(orderInfo); setCommon(orderInfo);
//设定来源信息为apms //设定来源信息为apms
orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue()); orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue());
orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE")); orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE"));
//检查是否为重复的单号
OrderInfo one = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.ORDER_NO, apmsPostOrderParam.getOrderNo()).eq(OrderInfo.IDEN_CARD_NUM, apmsPostOrderParam.getIdenCardNum()));
if (one != null)
{
return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
}
orderInfoService.save(orderInfo); orderInfoService.save(orderInfo);
return successful("Wms接收Apms订单成功。"); return successful("Wms接收Apms订单成功。", "");
} }
@Override @Override
@ -123,7 +136,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue()); orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue());
orderInfo.setInterCode("PERSONAL" + System.currentTimeMillis()); orderInfo.setInterCode("PERSONAL" + System.currentTimeMillis());
orderInfoService.save(orderInfo); orderInfoService.save(orderInfo);
return successful("人工创建订单成功。"); return successful("人工创建订单成功。", "");
} }
@Override @Override
@ -243,27 +256,39 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
byId.setInterCode(IDGenerator.gen("DDHIS", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_HIS_CODE")); byId.setInterCode(IDGenerator.gen("DDHIS", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_HIS_CODE"));
setCommonField(byId); setCommonField(byId);
orderInfoHisService.save(byId); orderInfoHisService.save(byId);
return successful("成功,订单状态置为完成。"); return successful("操作成功,订单状态置为完成。");
} }
@Override @Override
public R<String> voidOrder(IdParam idParam) { public R<String> voidOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId()); OrderInfo byId = orderInfoService.getById(idParam.getId());
Assert.notNull("未找到订单信息。", byId);
byId.setUpdateTime(LocalDateTime.now()); byId.setUpdateTime(LocalDateTime.now());
byId.setOrderVoid(0); byId.setOrderVoid(0);
orderInfoService.updateById(byId); orderInfoService.updateById(byId);
return successful("成功,订单状态置为作废。"); return successful("操作成功,订单状态置为作废。", "");
} }
@Override @Override
public R<String> apmsVoidOrder(String idenCardNum) { public R<String> apmsVoidOrder(String idenCardNum) {
OrderInfo byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum)); OrderInfo byId = null;
try
{
byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
}
catch (TooManyResultsException e)
{
e.printStackTrace();
return failed(4, "操作失败,数据库存在重复订单!");
}
if (byId == null)
{
return failed(3, "未找到该标识卡:" + idenCardNum + "下的订单信息!");
}
//确定是否有订单在生产 //确定是否有订单在生产
List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum); List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum);
if (taskDetailsByIdenCardNum.size() > 0) if (taskDetailsByIdenCardNum.size() > 0)
{ {
return failed("操作失败,已经存在生产中的任务单。"); return failed(2, "操作失败,已经存在生产中的任务单。");
} }
else else
{ {
@ -273,7 +298,10 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Override @Override
public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) { public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
//通过标识卡号与生产单号进行更新检验结果 ApmsCheckResult one1 = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo()));
if (one1 == null)
{
//通过标识卡号与生产单号进行检验结果存储
ApmsCheckResult one = new ApmsCheckResult(); ApmsCheckResult one = new ApmsCheckResult();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo()); one.setSheetNo(apmsCompleteOrder.getSheetNo());
@ -281,10 +309,33 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
one.setValid(WhetherEnum.YES.getValue()); one.setValid(WhetherEnum.YES.getValue());
one.setMetallography(apmsCompleteOrder.getMetallographic()); one.setMetallography(apmsCompleteOrder.getMetallographic());
one.setHeartHardness(apmsCompleteOrder.getHeartHardness()); one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne());
one.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo());
one.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree());
one.setHardness(apmsCompleteOrder.getHardness()); one.setHardness(apmsCompleteOrder.getHardness());
one.setUpdateTime(LocalDateTime.now()); one.setUpdateTime(LocalDateTime.now());
one.setRemake(apmsCompleteOrder.getRemake());
apmsCheckResultServiceBiz.save(one); apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms //订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("接收检验结果成功。"); return successful("操作成功,接收检验结果完成。", "");
}
else
{
//存在检验结果更新的情况主管或其他人员可能会更改结果
one1.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one1.setSheetNo(apmsCompleteOrder.getSheetNo());
one1.setValid(WhetherEnum.YES.getValue());
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("操作成功,更新检验结果完成。", "");
}
} }
} }