This commit is contained in:
李广豪 2022-01-01 23:16:12 +08:00
bovenliggende e0a61480eb aac7b8c080
commit 10821861aa
10 gewijzigde bestanden met toevoegingen van 164 en 47 verwijderingen

Bestand weergeven

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

Bestand weergeven

@ -15,7 +15,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author mt
* @since 2021-11-19
* @since 2021-12-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -94,7 +94,31 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
* 心部硬度检验值
*/
@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";
@ -121,6 +145,14 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
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
protected Serializable pkVal() {
return this.id;

Bestand weergeven

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

Bestand weergeven

@ -16,12 +16,16 @@
<result column="hardness" property="hardness"/>
<result column="metallography" property="metallography"/>
<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>
<!-- 通用查询结果列 -->
<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
metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three
</sql>
</mapper>

Bestand weergeven

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

Bestand weergeven

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

Bestand weergeven

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

Bestand weergeven

@ -16,7 +16,7 @@ public class ApmsCompleteOrder extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "生产单编号", required = false)
@ApiModelProperty(value = "生产单编号", required = true)
private String sheetNo;
/**
@ -31,7 +31,17 @@ public class ApmsCompleteOrder extends BaseParam {
@ApiModelProperty(value = "金相检验结果", required = true)
private String metallographic;
@ApiModelProperty(value = "心部硬度检验值", required = true)
private Float heartHardness;
@ApiModelProperty(value = "心部硬度检验值", required = false)
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;
}

Bestand weergeven

@ -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;
}

Bestand weergeven

@ -30,6 +30,7 @@ import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -81,16 +82,28 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Autowired
ApmsController apmsControl;
private void setCommon(OrderInfo communicationLog) {
communicationLog.setValid(WhetherEnum.YES.getValue());
communicationLog.setCreateTime(LocalDateTime.now());
communicationLog.setUpdateTime(LocalDateTime.now());
}
@Override
public R<String> apmsPostOrder(OrderParamForApms apmsPostOrderParam) {
OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(apmsPostOrderParam, orderInfo);
setCommonField(orderInfo);
setCommon(orderInfo);
//设定来源信息为apms
orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue());
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);
return successful("Wms接收Apms订单成功。");
return successful("Wms接收Apms订单成功。", "");
}
@Override
@ -123,7 +136,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue());
orderInfo.setInterCode("PERSONAL" + System.currentTimeMillis());
orderInfoService.save(orderInfo);
return successful("人工创建订单成功。");
return successful("人工创建订单成功。", "");
}
@Override
@ -243,27 +256,39 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
byId.setInterCode(IDGenerator.gen("DDHIS", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_HIS_CODE"));
setCommonField(byId);
orderInfoHisService.save(byId);
return successful("成功,订单状态置为完成。");
return successful("操作成功,订单状态置为完成。");
}
@Override
public R<String> voidOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId());
Assert.notNull("未找到订单信息。", byId);
byId.setUpdateTime(LocalDateTime.now());
byId.setOrderVoid(0);
orderInfoService.updateById(byId);
return successful("成功,订单状态置为作废。");
return successful("操作成功,订单状态置为作废。", "");
}
@Override
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);
if (taskDetailsByIdenCardNum.size() > 0)
{
return failed("操作失败,已经存在生产中的任务单。");
return failed(2, "操作失败,已经存在生产中的任务单。");
}
else
{
@ -273,18 +298,44 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Override
public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
//通过标识卡号与生产单号进行更新检验结果
ApmsCheckResult one = new ApmsCheckResult();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo());
one.setCreateTime(LocalDateTime.now());
one.setValid(WhetherEnum.YES.getValue());
one.setMetallography(apmsCompleteOrder.getMetallographic());
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one.setHardness(apmsCompleteOrder.getHardness());
one.setUpdateTime(LocalDateTime.now());
apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("接收检验结果成功。");
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();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo());
one.setCreateTime(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("操作成功,接收检验结果完成。", "");
}
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("操作成功,更新检验结果完成。", "");
}
}
}