pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/QueryVo.java
@@ -2,8 +2,12 @@ import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import com.baomidou.mybatisplus.annotation.TableField; import com.dy.common.webUtil.QueryConditionVo; import jakarta.validation.constraints.NotNull; import lombok.*; import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) @@ -14,15 +18,68 @@ public class QueryVo { @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long id; /** * 用户实体编号 */ @NotNull(message="[用户实体编号]不能为空") public String userId; /** * 生产线实体编号 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long lineId; /** * 工站实体编号 */ @NotNull(message="[工站实体编号]不能为空") public String stationId; /** * 组装生产任务实体编号 */ @NotNull(message="[组装生产任务实体编号]不能为空") @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long planId; /** * 生产流程实体编号 */ @NotNull(message="[生产流程实体编号]不能为空") @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long processId; /** * 生产流程节点实体编号 */ @NotNull(message="[生产流程节点实体编号]不能为空") @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long nodeId; /** * 任务认领时间 */ public Date dt; /** * 状态:正常(1)、结束(0) */ public Integer status; /** * 开始时间 */ public Date startTime; /** * 结束时间 */ public Date endTime; /** * 辅助人员:辅助员工id,以逗号隔开 */ public String assistants; } pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java
@@ -3,9 +3,11 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoPlt.PltProductionLine; import com.dy.pmsGlobal.pojoPlt.PltStation; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -68,6 +70,21 @@ List<PrAssemblyPlan> list = sv.selectList(params); return BaseResponseUtils.buildSuccess(list); }*/ /** * 查询全部执行中的组装任务清单 * @param * @return */ @PostMapping(path="save") public BaseResponse<Boolean> save(@RequestBody @Valid QueryVo last){ int count = sv.save(last); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } else { return BaseResponseUtils.buildSuccess(true); } } @GetMapping(path = "test") public BaseResponse test() { log.info("test"); pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -13,14 +13,17 @@ import com.dy.pmsGlobal.dyFile.FileRestVo; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoOth.OthFile; import com.dy.pmsGlobal.pojoPlt.PltProductionLine; import com.dy.pmsGlobal.pojoPlt.PltStation; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction; import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -176,5 +179,45 @@ ins.orgName = file.orgName; ins.extName = file.extName; } } @Transactional public int save(QueryVo last) { //先check PltStation stationInfo = null; BaUser userInfo = null; //工站103 if(last.getStationId().startsWith("103")){ stationInfo = getStationInfo(last.getStationId()); }else{ userInfo = getUserInfo(last.getStationId()); } if(last.getUserId().startsWith("103")){ stationInfo = getStationInfo(last.getUserId()); }else{ userInfo = getUserInfo(last.getUserId()); } if(userInfo == null && stationInfo == null){ throw new RuntimeException("员工编码:"+ last.getUserId() + "和工站编码:" + last.getStationId() + "不正确,请检查"); }else if(userInfo == null){ throw new RuntimeException("员工编码:"+ last.getUserId() + "不正确,请检查"); }else if(stationInfo == null){ throw new RuntimeException("工站编码:" + last.getStationId() + "不正确,请检查"); } //校验planId processId nodeId PrAssemblyPlan params = new PrAssemblyPlan(); params.setStatus(1); params.setId(last.getPlanId()); params.setProcessId(last.getProcessId()); List<PrAssemblyPlan> list = selectAssyPlanList(params); list.stream().filter(process -> { process.nodes.stream().filter(node -> node.id == last.getNodeId()); return false; }); last.setLineId(stationInfo.getLineId()); StaAssemblyWorkLast staLast = new StaAssemblyWorkLast(); BeanUtils.copyProperties(last,staLast); staLast.setUserId(userInfo.getId()); staLast.setStationId(stationInfo.getId()); int count = assemblyWorkLastDao.insertSelective(staLast); return count; } }