|
|
|
|
@@ -67,26 +67,26 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMdPbClassstandardService classstandardService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsToAcsService wmsToAcsService;
|
|
|
|
|
private WmsToAcsService wmsToAcsService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserService userService;
|
|
|
|
|
private ISysUserService userService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMdMeMaterialbaseService materialbaseService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPdmBiDeviceService deviceService;
|
|
|
|
|
@Resource
|
|
|
|
|
private PdmProduceWorkorderMapper pdmProduceWorkorderMapper;
|
|
|
|
|
private PdmProduceWorkorderMapper pdmProduceWorkorderMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private IPdmProduceWorkorderrecordService reportRecordService;
|
|
|
|
|
private IPdmProduceWorkorderrecordService reportRecordService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object queryAll(WorkorderQuery query, PageQuery pageQuery) {
|
|
|
|
|
if (!StringUtils.isEmpty(query.getProduct_series())){
|
|
|
|
|
if (!StringUtils.isEmpty(query.getProduct_series())) {
|
|
|
|
|
String collect = classstandardService.getChildIdStr(query.getProduct_series())
|
|
|
|
|
.stream().collect(Collectors.joining("','"));
|
|
|
|
|
query.setProduct_series("('"+collect+"')");
|
|
|
|
|
query.setProduct_series("('" + collect + "')");
|
|
|
|
|
}
|
|
|
|
|
Page<Object> page = PageHelper.startPage(pageQuery.getPage()+1, pageQuery.getSize());
|
|
|
|
|
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
|
|
|
|
List result = pdmProduceWorkorderMapper.pageQuery(query);
|
|
|
|
|
TableDataInfo build = TableDataInfo.build(result);
|
|
|
|
|
build.setTotalElements(page.getTotal());
|
|
|
|
|
@@ -95,7 +95,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object queryAll(Map whereJson) {
|
|
|
|
|
return this.list();
|
|
|
|
|
return this.list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -112,12 +112,12 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
entity.setWorkorder_status(WorkerOrderEnum.CREATE.getCode());
|
|
|
|
|
this.save(entity);
|
|
|
|
|
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,entity.getWorkorder_id());
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, entity.getWorkorder_id());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateForm(JSONObject form) {
|
|
|
|
|
Assert.notNull(form,"参数不能为空");
|
|
|
|
|
Assert.notNull(form, "参数不能为空");
|
|
|
|
|
PdmProduceWorkorder one = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", form.getString("workorder_id")));
|
|
|
|
|
if (one == null) {
|
|
|
|
|
throw new BadRequestException("被删除或无权限,操作失败!");
|
|
|
|
|
@@ -128,48 +128,48 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
entity.setDown_name(SecurityUtils.getCurrentNickName());
|
|
|
|
|
this.updateById(entity);
|
|
|
|
|
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,entity.getWorkorder_id());
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, entity.getWorkorder_id());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map> getDtl(JSONObject param) {
|
|
|
|
|
return this.baseMapper.getworkOrderDtl(param.getString("workorder_id"));
|
|
|
|
|
return this.baseMapper.getworkOrderDtl(param.getString("workorder_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void down(List<String> ids) {
|
|
|
|
|
if (ids == null || ids.size()==0){
|
|
|
|
|
if (ids == null || ids.size() == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.update(new UpdateWrapper<PdmProduceWorkorder>()
|
|
|
|
|
.set("workorder_status",WorkerOrderEnum.SEND.getCode())
|
|
|
|
|
.set("workorder_status", WorkerOrderEnum.SEND.getCode())
|
|
|
|
|
.set("down_id", SecurityUtils.getCurrentUserId())
|
|
|
|
|
.set("down_name",SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("down_time",new Date())
|
|
|
|
|
.set("down_name", SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("down_time", new Date())
|
|
|
|
|
.in("workorder_id", ids));
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,ids.toArray(new String[0]));
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, ids.toArray(new String[0]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void unDown(List<String> ids) {
|
|
|
|
|
if (ids == null || ids.size()==0){
|
|
|
|
|
if (ids == null || ids.size() == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<PdmProduceWorkorder> list = this.list(new QueryWrapper<PdmProduceWorkorder>()
|
|
|
|
|
.ne("workorder_status", WorkerOrderEnum.SEND.getCode())
|
|
|
|
|
.in("workorder_id", ids));
|
|
|
|
|
if (list.size()>0){
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
throw new BadRequestException("只有下发状态的工单才能取消下发");
|
|
|
|
|
}
|
|
|
|
|
this.update(new UpdateWrapper<PdmProduceWorkorder>()
|
|
|
|
|
.set("workorder_status",WorkerOrderEnum.CREATE.getCode())
|
|
|
|
|
.set("workorder_status", WorkerOrderEnum.CREATE.getCode())
|
|
|
|
|
.set("down_id", SecurityUtils.getCurrentUserId())
|
|
|
|
|
.set("down_name",SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("down_time",new Date())
|
|
|
|
|
.set("down_name", SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("down_time", new Date())
|
|
|
|
|
.in("workorder_id", ids));
|
|
|
|
|
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,ids.toArray(new String[0]));
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, ids.toArray(new String[0]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -178,10 +178,10 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
//强制完成时修改工单状态
|
|
|
|
|
String workorder_id = param.getJSONObject("row").getString("workorder_id");
|
|
|
|
|
this.update(new UpdateWrapper<PdmProduceWorkorder>()
|
|
|
|
|
.set("workorder_status",WorkerOrderEnum.FORCE_COMPLETE.getCode())
|
|
|
|
|
.set("workorder_status", WorkerOrderEnum.FORCE_COMPLETE.getCode())
|
|
|
|
|
.set("update_id", SecurityUtils.getCurrentUserId())
|
|
|
|
|
.set("update_name",SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("update_time",new Date())
|
|
|
|
|
.set("update_name", SecurityUtils.getCurrentNickName())
|
|
|
|
|
.set("update_time", new Date())
|
|
|
|
|
.in("workorder_id", workorder_id));
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
JSONObject map = new JSONObject();
|
|
|
|
|
@@ -190,13 +190,13 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
array.add(map);
|
|
|
|
|
Map<String, Object> result = wmsToAcsService.orderStatusUpdate(array);
|
|
|
|
|
if (!HttpStatus.OK.equals(result.get("status"))) {
|
|
|
|
|
throw new BadRequestException((String) result.get("message"));
|
|
|
|
|
throw new BadRequestException((String) result.get("message"));
|
|
|
|
|
}
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,workorder_id);
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, workorder_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void recordWorkOrder(OptionRecord.OptionEnum optionEnum, String...ids) {
|
|
|
|
|
public void recordWorkOrder(OptionRecord.OptionEnum optionEnum, String... ids) {
|
|
|
|
|
List<PdmProduceWorkorder> workorders = this.list(new QueryWrapper<PdmProduceWorkorder>().in("workorder_id", ids));
|
|
|
|
|
for (PdmProduceWorkorder one : workorders) {
|
|
|
|
|
WorkorderRecord record = WorkorderRecord.builder()
|
|
|
|
|
@@ -209,7 +209,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
.operatetime_end(DateUtil.now())
|
|
|
|
|
.shift_type_scode(one.getShift_type_scode())
|
|
|
|
|
.product_area(one.getProduct_area()).build();
|
|
|
|
|
OptionRecord.recordAsync(optionEnum, one.getWorkorder_status(),OptionRecord.Buss.WORKORDER, one.getWorkorder_id(),record);
|
|
|
|
|
OptionRecord.recordAsync(optionEnum, one.getWorkorder_status(), OptionRecord.Buss.WORKORDER, one.getWorkorder_id(), record);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -278,7 +278,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(material)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "物料规格对应物料信息不存在,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("material_id", material.getMaterial_id());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -291,7 +291,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(idByName)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "工序名称是否正确,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("workprocedure_id", idByName.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -303,7 +303,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (StrUtil.isEmpty(col)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "工单计划数量为空,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("plan_qty", col);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -317,7 +317,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (!workprocedure_id.equals(device.getWorkprocedure_id())) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "设备与所属工序不匹配,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("device_code", device.getDevice_code());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -326,7 +326,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonUser)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "生产人员编码不存在!";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("current_produce_person_id", jsonUser.getUser_id());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -407,7 +407,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(material)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "物料规格对应物料信息不存在,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("material_id", material.getMaterial_id());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -420,7 +420,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(idByName)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "工序名称是否正确,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("workprocedure_id", idByName.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -432,7 +432,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (StrUtil.isEmpty(col)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "工单计划数量为空,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("plan_qty", col);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -454,7 +454,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (!workprocedure_id.equals(device.getWorkprocedure_id())) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "设备与所属工序不匹配,";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("device_code", device.getDevice_code());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -463,7 +463,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonUser)) {
|
|
|
|
|
is_error = "1";
|
|
|
|
|
error_message = error_message + "生产人员编码不存在!";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
param.put("current_produce_person_id", jsonUser.getUser_id());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -489,13 +489,13 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
param.put("create_type", WorkerOrderEnum.EXCELINTO.getCode());
|
|
|
|
|
param.put("planproducestart_date", produce_date + "18:30:00");
|
|
|
|
|
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(produce_date), 1);
|
|
|
|
|
param.put("planproduceend_date", DateUtil.format(dateTime,"yyyy-MM-dd") + " 07:30:00");
|
|
|
|
|
param.put("planproduceend_date", DateUtil.format(dateTime, "yyyy-MM-dd") + " 07:30:00");
|
|
|
|
|
param.put("create_id", currentUserId);
|
|
|
|
|
param.put("create_name", nickName);
|
|
|
|
|
param.put("create_time", DateUtil.now());
|
|
|
|
|
entitys.add(param.toJavaObject(PdmProduceWorkorder.class));
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(entitys)){
|
|
|
|
|
if (!CollectionUtils.isEmpty(entitys)) {
|
|
|
|
|
this.saveBatch(entitys);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -509,73 +509,78 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
//判断该工单状态
|
|
|
|
|
PdmProduceWorkorder result = this.getOne(new QueryWrapper<PdmProduceWorkorder>()
|
|
|
|
|
.eq("device_code", param.getString("device_code"))
|
|
|
|
|
.in("workorder_status","2","3","4")
|
|
|
|
|
.ne("workorder_id",param.getString("workorder_id")));
|
|
|
|
|
if(ObjectUtil.isNotEmpty(result)) {
|
|
|
|
|
.in("workorder_status", "2", "3", "4")
|
|
|
|
|
.ne("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(result)) {
|
|
|
|
|
throw new BadRequestException("已有工单选择该设备开工,请更换开工设备!");
|
|
|
|
|
}
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
result = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
JSONObject order = packageForm(result);
|
|
|
|
|
|
|
|
|
|
JSONObject order = packageForm(param);
|
|
|
|
|
array.add(order);
|
|
|
|
|
//下发acs
|
|
|
|
|
result.setWorkorder_status(WorkerOrderEnum.PRODUCTING.getCode());
|
|
|
|
|
Map<String,Object> resp = wmsToAcsService.order(array);
|
|
|
|
|
if (((int)resp.get("status")) == (HttpStatus.BAD_REQUEST.value())){
|
|
|
|
|
Map<String, Object> resp = wmsToAcsService.order(array);
|
|
|
|
|
PdmProduceWorkorder workOrder = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
workOrder.setWorkorder_status(WorkerOrderEnum.PRODUCTING.getCode());
|
|
|
|
|
if (((int) resp.get("status")) == (HttpStatus.BAD_REQUEST.value())) {
|
|
|
|
|
throw new BadRequestException(String.valueOf(resp.get("message")));
|
|
|
|
|
}
|
|
|
|
|
this.update(result,new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE,result.getWorkorder_id());
|
|
|
|
|
this.update(workOrder, new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, result.getWorkorder_id());
|
|
|
|
|
|
|
|
|
|
return RestBusinessTemplate.execute(() -> resp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
private JSONObject packageForm(PdmProduceWorkorder workOrder) {
|
|
|
|
|
private JSONObject packageForm(JSONObject param) {
|
|
|
|
|
PdmProduceWorkorder workOrder = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
JSONObject form = new JSONObject();
|
|
|
|
|
MdMeMaterialbase material = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", workOrder.getMaterial_id()));
|
|
|
|
|
PdmBiDevice device = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", workOrder.getDevice_code()));
|
|
|
|
|
form.put("workorder_id",workOrder.getWorkorder_id());
|
|
|
|
|
form.put("workorder_code",workOrder.getWorkorder_code());
|
|
|
|
|
form.put("workorder_id", workOrder.getWorkorder_id());
|
|
|
|
|
form.put("workorder_code", workOrder.getWorkorder_code());
|
|
|
|
|
form.put("qty", workOrder.getPlan_qty());
|
|
|
|
|
form.put("outupperlimit_qty",device.getOutupperlimit_qty());
|
|
|
|
|
form.put("material_id",workOrder.getMaterial_id());
|
|
|
|
|
form.put("material_name",material.getMaterial_name());
|
|
|
|
|
form.put("material_code",material.getMaterial_code());
|
|
|
|
|
form.put("material_spec",material.getMaterial_spec());
|
|
|
|
|
form.put("device_code",workOrder.getDevice_code());
|
|
|
|
|
form.put("is_needmove",workOrder.getIs_needmove());
|
|
|
|
|
form.put("outupperlimit_qty", device.getOutupperlimit_qty());
|
|
|
|
|
form.put("material_id", workOrder.getMaterial_id());
|
|
|
|
|
form.put("material_name", material.getMaterial_name());
|
|
|
|
|
form.put("material_code", material.getMaterial_code());
|
|
|
|
|
form.put("material_spec", material.getMaterial_spec());
|
|
|
|
|
form.put("device_code", workOrder.getDevice_code());
|
|
|
|
|
form.put("is_needmove", workOrder.getIs_needmove() ? 1 : 0);
|
|
|
|
|
if (param.containsKey("extra_map")) {
|
|
|
|
|
form.put("extra_map", param.getJSONObject("extra_map"));
|
|
|
|
|
}
|
|
|
|
|
return form;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public Object report(JSONObject param) {
|
|
|
|
|
Assert.notNull(new Object[]{param,param.get("report_qty"),param.get("nok_qty"),param.getBigDecimal("repare_qty")},"请求参数不能为空");
|
|
|
|
|
Assert.notNull(new Object[]{param, param.get("report_qty"), param.get("nok_qty"), param.getBigDecimal("repare_qty")}, "请求参数不能为空");
|
|
|
|
|
|
|
|
|
|
PdmProduceWorkorder workorder = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
|
|
|
|
if (workorder.getWorkorder_status().equals(WorkerOrderEnum.COMPLETE.getCode())||workorder.getWorkorder_status().equals(WorkerOrderEnum.FORCE_COMPLETE.getCode())){
|
|
|
|
|
throw new BadRequestException(param.getString("workorder_id")+"当前工单已经完工不允许报工");
|
|
|
|
|
if (workorder.getWorkorder_status().equals(WorkerOrderEnum.COMPLETE.getCode()) || workorder.getWorkorder_status().equals(WorkerOrderEnum.FORCE_COMPLETE.getCode())) {
|
|
|
|
|
throw new BadRequestException(param.getString("workorder_id") + "当前工单已经完工不允许报工");
|
|
|
|
|
}
|
|
|
|
|
PdmProduceWorkorderrecord one = reportRecordService.getOne(new QueryWrapper<PdmProduceWorkorderrecord>()
|
|
|
|
|
.eq("workorder_id", param.getString("workorder_id")).eq("report_status", ReportRecordStatus.CREATE.getCode()));
|
|
|
|
|
if ( one == null) {
|
|
|
|
|
throw new BadRequestException(param.getString("workorder_id")+"当前工单没有生成状态的报工记录");
|
|
|
|
|
if (one == null) {
|
|
|
|
|
throw new BadRequestException(param.getString("workorder_id") + "当前工单没有生成状态的报工记录");
|
|
|
|
|
}
|
|
|
|
|
workorder.setReport_qty(workorder.getReport_qty().add(param.getBigDecimal("report_qty")));
|
|
|
|
|
workorder.setNok_qty(workorder.getReport_qty().add(param.getBigDecimal("nok_qty")));
|
|
|
|
|
workorder.setRepare_qty(workorder.getReport_qty().add(param.getBigDecimal("repare_qty")));
|
|
|
|
|
if (workorder.getPlan_qty().doubleValue() <= workorder.getReport_qty().doubleValue()){
|
|
|
|
|
if (workorder.getPlan_qty().doubleValue() <= workorder.getReport_qty().doubleValue()) {
|
|
|
|
|
workorder.setWorkorder_status(WorkerOrderEnum.COMPLETE.getCode());
|
|
|
|
|
}
|
|
|
|
|
this.updateById(workorder);
|
|
|
|
|
|
|
|
|
|
reportRecordService.update(new UpdateWrapper<PdmProduceWorkorderrecord>()
|
|
|
|
|
.set("report_qty",param.getBigDecimal("report_qty"))
|
|
|
|
|
.set("nok_qty",param.getBigDecimal("nok_qty"))
|
|
|
|
|
.set("repare_qty",param.getBigDecimal("repare_qty"))
|
|
|
|
|
.set("needproduct_qty",workorder.getPlan_qty().doubleValue()-workorder.getReport_qty().doubleValue())
|
|
|
|
|
.eq("macoperate_id",one.getMacoperate_id()));
|
|
|
|
|
.set("report_qty", param.getBigDecimal("report_qty"))
|
|
|
|
|
.set("nok_qty", param.getBigDecimal("nok_qty"))
|
|
|
|
|
.set("repare_qty", param.getBigDecimal("repare_qty"))
|
|
|
|
|
.set("needproduct_qty", workorder.getPlan_qty().doubleValue() - workorder.getReport_qty().doubleValue())
|
|
|
|
|
.eq("macoperate_id", one.getMacoperate_id()));
|
|
|
|
|
return one.getMacoperate_id();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -584,7 +589,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
@Transactional
|
|
|
|
|
public void reportApprove(JSONArray param) {
|
|
|
|
|
List<PdmProduceWorkorderrecord> workreportRecords = param.toJavaList(PdmProduceWorkorderrecord.class);
|
|
|
|
|
if (!CollectionUtils.isEmpty(workreportRecords)){
|
|
|
|
|
if (!CollectionUtils.isEmpty(workreportRecords)) {
|
|
|
|
|
List<String> macoperate_ids = workreportRecords.stream().map(PdmProduceWorkorderrecord::getMacoperate_id).collect(Collectors.toList());
|
|
|
|
|
List<PdmProduceWorkorderrecord> record = reportRecordService.list(new QueryWrapper<PdmProduceWorkorderrecord>()
|
|
|
|
|
.in("macoperate_id", macoperate_ids));
|
|
|
|
|
@@ -598,7 +603,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
item.setConfirm_time(DateUtil.now());
|
|
|
|
|
});
|
|
|
|
|
List<Map> list = packageWorkorderQty(record, itemRecord);
|
|
|
|
|
this.baseMapper.batchUpdateByParam(list,entry.getKey());
|
|
|
|
|
this.baseMapper.batchUpdateByParam(list, entry.getKey());
|
|
|
|
|
reportRecordService.updateBatchById(itemRecord);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -616,19 +621,19 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
long new_report_qty = itemRecord.stream().map(PdmProduceWorkorderrecord::getReport_qty).count();
|
|
|
|
|
List<Map> list = new ArrayList<>();
|
|
|
|
|
Map<String, Object> nok_qty = new HashMap<>();
|
|
|
|
|
nok_qty.put("field","nok_qty");
|
|
|
|
|
nok_qty.put("value",Math.abs(new_nok_qty-old_nok_qty));
|
|
|
|
|
nok_qty.put("add",new_nok_qty>old_nok_qty);
|
|
|
|
|
nok_qty.put("field", "nok_qty");
|
|
|
|
|
nok_qty.put("value", Math.abs(new_nok_qty - old_nok_qty));
|
|
|
|
|
nok_qty.put("add", new_nok_qty > old_nok_qty);
|
|
|
|
|
list.add(nok_qty);
|
|
|
|
|
Map<String, Object> repare_qty = new HashMap<>();
|
|
|
|
|
repare_qty.put("field","repare_qty");
|
|
|
|
|
repare_qty.put("value",Math.abs(new_repare_qty-old_repare_qty));
|
|
|
|
|
repare_qty.put("add",new_repare_qty>old_repare_qty);
|
|
|
|
|
repare_qty.put("field", "repare_qty");
|
|
|
|
|
repare_qty.put("value", Math.abs(new_repare_qty - old_repare_qty));
|
|
|
|
|
repare_qty.put("add", new_repare_qty > old_repare_qty);
|
|
|
|
|
list.add(repare_qty);
|
|
|
|
|
Map<String, Object> report_qty = new HashMap<>();
|
|
|
|
|
report_qty.put("field","report_qty");
|
|
|
|
|
report_qty.put("value",Math.abs(new_report_qty-old_report_qty));
|
|
|
|
|
report_qty.put("add",new_report_qty>old_report_qty);
|
|
|
|
|
report_qty.put("field", "report_qty");
|
|
|
|
|
report_qty.put("value", Math.abs(new_report_qty - old_report_qty));
|
|
|
|
|
report_qty.put("add", new_report_qty > old_report_qty);
|
|
|
|
|
list.add(report_qty);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
@@ -646,16 +651,16 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|
|
|
|
produceshiftorderDto.setUpdate_name(nickName);
|
|
|
|
|
produceshiftorderDto.setUpdate_time(DateUtil.now());
|
|
|
|
|
String order_status = produceshiftorderDto.getOrder_status();
|
|
|
|
|
if(!order_status.equals("03") && !order_status.equals("01") && !order_status.equals("00")) {
|
|
|
|
|
if (!order_status.equals("03") && !order_status.equals("01") && !order_status.equals("00")) {
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
JSONObject acsObj = new JSONObject();
|
|
|
|
|
acsObj.put("order_code", produceorder_code);
|
|
|
|
|
acsObj.put("device_code", device_code);
|
|
|
|
|
array.add(acsObj);
|
|
|
|
|
Map<String,Object> resp = wmsToAcsService.replaceDevice(array);
|
|
|
|
|
Map<String, Object> resp = wmsToAcsService.replaceDevice(array);
|
|
|
|
|
String status = String.valueOf(resp.get("status"));
|
|
|
|
|
String message = (String) resp.get("message");
|
|
|
|
|
if(!status.equals("200")) {
|
|
|
|
|
if (!status.equals("200")) {
|
|
|
|
|
throw new BadRequestException(message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|