update:分拣看板增加当前工单所需物料信息;

fix:修改分拣缺料任务同时接收acs请求只会下发一条任务问题;
update:修改分拣看板合格率改为百分比
This commit is contained in:
songxiaopeng
2024-04-28 16:29:36 +08:00
parent 7f048a74eb
commit 188162203b
6 changed files with 86 additions and 52 deletions

View File

@@ -9,6 +9,7 @@ import lombok.Data;
*/ */
@Data @Data
public class ProductTaskVo { public class ProductTaskVo {
private String pointCode;
private String device; private String device;
private String workorderCode; private String workorderCode;
private String team; private String team;

View File

@@ -7,18 +7,16 @@ import java.util.Date;
/** /**
* @author Administrator * @author Administrator
* 当前工单所需物料信息
*/ */
@Data @Data
public class WorkOrderVo { public class WorkOrderVo {
private String workorderCode; private String pointCode;
private String materialName; private String pointName;
private String materialCode;
private String materialModel;
private String materialSpec; private String materialSpec;
private String planQty; private String materialQty;
private String planWeight; private String vehicleCode;
private String produceOrder; private String createTime;
private String customer;
private String vehicleType;
//todo 是否有半托
@JsonFormat(pattern ="MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
} }

View File

@@ -58,17 +58,22 @@ public class CockpitServiceImpl implements CockpitService {
return null; return null;
} }
for (ShiftProductionVo productionVo : shiftProductionList) { for (ShiftProductionVo productionVo : shiftProductionList) {
ShiftProductionVo res = cockPitMapper.selectQtByVo(productionVo); ShiftProductionVo res = cockPitMapper.selectQtByWorkOrder(productionVo.getWorkOrderCode(), productionVo.getPointCode());
productionVo.setQualifiedQty(res.getQualifiedQty()); productionVo.setQualifiedQty(res.getQualifiedQty());
productionVo.setUnqualifiedQty(res.getUnqualifiedQty()); productionVo.setUnqualifiedQty(res.getUnqualifiedQty());
int plan = Integer.parseInt(productionVo.getPlanQty()); int plan = Integer.parseInt(productionVo.getPlanQty());
int unqualified = Integer.parseInt(productionVo.getUnqualifiedQty()); int unqualified = Integer.parseInt(productionVo.getUnqualifiedQty());
int qualified = Integer.parseInt(productionVo.getQualifiedQty()); int qualified = Integer.parseInt(productionVo.getQualifiedQty());
int all = unqualified + qualified;
int lastQty = plan - unqualified - qualified; int lastQty = plan - unqualified - qualified;
productionVo.setLastQty(String.valueOf(Math.max(lastQty, 0))); productionVo.setLastQty(String.valueOf(Math.max(lastQty, 0)));
BigDecimal planBig = new BigDecimal(plan); BigDecimal allBig = new BigDecimal(all);
BigDecimal quaBig = new BigDecimal(qualified); BigDecimal quaBig = new BigDecimal(qualified);
productionVo.setQualifyRate(String.valueOf(quaBig.divide(planBig, 2, RoundingMode.HALF_UP))); if (all == 0) {
productionVo.setQualifyRate("0.00");
} else {
productionVo.setQualifyRate(String.valueOf(quaBig.multiply(new BigDecimal(100)).divide(allBig, 2, RoundingMode.HALF_UP)));
}
} }
return shiftProductionList; return shiftProductionList;
}, pool); }, pool);
@@ -91,7 +96,27 @@ public class CockpitServiceImpl implements CockpitService {
}); });
// 4、生产任务 // 4、生产任务
CompletableFuture<List<ProductTaskVo>> listProductionTaskFuture = CompletableFuture.supplyAsync( CompletableFuture<List<ProductTaskVo>> listProductionTaskFuture = CompletableFuture.supplyAsync(
() -> cockPitMapper.getProductionTaskList(), pool); () -> {
List<ProductTaskVo> productionTaskList = cockPitMapper.getProductionTaskList();
if (productionTaskList.isEmpty()) {
return null;
}
for (ProductTaskVo productionVo : productionTaskList) {
ShiftProductionVo res = cockPitMapper.selectQtByWorkOrder(productionVo.getWorkorderCode(), productionVo.getPointCode());
productionVo.setUnqualifiedQty(res.getUnqualifiedQty());
int qualified = Integer.parseInt(res.getQualifiedQty());
int unQualified = Integer.parseInt(res.getUnqualifiedQty());
int all = unQualified + qualified;
BigDecimal allBig = new BigDecimal(all);
BigDecimal quaBig = new BigDecimal(qualified);
if (all == 0) {
productionVo.setQualifiedRate("0.00");
} else {
productionVo.setQualifiedRate(String.valueOf(quaBig.multiply(new BigDecimal(100)).divide(allBig, 2, RoundingMode.HALF_UP)));
}
}
return productionTaskList;
}, pool);
listProductionTaskFuture.thenAccept(result -> { listProductionTaskFuture.thenAccept(result -> {
map.put("ProductionTask", result); map.put("ProductionTask", result);
}).exceptionally((e) -> { }).exceptionally((e) -> {
@@ -160,7 +185,7 @@ public class CockpitServiceImpl implements CockpitService {
resultMap.put("stackingList", null); resultMap.put("stackingList", null);
return null; return null;
}); });
//查询剩余工单列表 //当前工单货架物料信息
CompletableFuture<List<WorkOrderVo>> lastWorkOrderCompletableFuture = CompletableFuture.supplyAsync( CompletableFuture<List<WorkOrderVo>> lastWorkOrderCompletableFuture = CompletableFuture.supplyAsync(
() -> cockPitMapper.getLastWorkOrderList(), pool); () -> cockPitMapper.getLastWorkOrderList(), pool);
lastWorkOrderCompletableFuture.thenAccept(res -> { lastWorkOrderCompletableFuture.thenAccept(res -> {
@@ -685,7 +710,13 @@ public class CockpitServiceImpl implements CockpitService {
} }
public static void main(String[] args) { public static void main(String[] args) {
String substring = "FJ01CDW01".substring(0, 4); BigDecimal bigDecimal = new BigDecimal(600);
System.out.println(substring); BigDecimal bigDecimal1 = new BigDecimal(77);
BigDecimal add = bigDecimal.add(bigDecimal1);
BigDecimal divide = bigDecimal.divide(add, 2, BigDecimal.ROUND_HALF_UP);
System.out.println(bigDecimal);
System.out.println(bigDecimal1);
System.out.println(add);
System.out.println(divide);
} }
} }

View File

@@ -1,6 +1,7 @@
package org.nl.wms.cockpit.service.mapper; package org.nl.wms.cockpit.service.mapper;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.cockpit.service.dao.*; import org.nl.wms.cockpit.service.dao.*;
import java.util.List; import java.util.List;
@@ -16,9 +17,11 @@ public interface CockPitMapper {
List<ShiftProductionVo> getShiftProductionList(); List<ShiftProductionVo> getShiftProductionList();
List<PressOrderVo> getPressOrderVoList(); List<PressOrderVo> getPressOrderVoList();
List<ProductTaskVo> getProductionTaskList(); List<ProductTaskVo> getProductionTaskList();
List<SortingLineVo> getSortingLine(); List<SortingLineVo> getSortingLine();
List<RgSortingLineVo> getRgSortingLineVo(); List<RgSortingLineVo> getRgSortingLineVo();
List<StackVo> getUnstackingList(); List<StackVo> getUnstackingList();
@@ -42,6 +45,7 @@ public interface CockPitMapper {
InOutKilnVo selectOutKilnInfo(); InOutKilnVo selectOutKilnInfo();
KilnVo selectKilnInfo(); KilnVo selectKilnInfo();
List<KilnMaterialInfo> selectKilnMaterialInfo(); List<KilnMaterialInfo> selectKilnMaterialInfo();
@@ -69,7 +73,7 @@ public interface CockPitMapper {
FjPintInfoVo selectFJJXSMaterialInfo(String pointCode); FjPintInfoVo selectFJJXSMaterialInfo(String pointCode);
ShiftProductionVo selectQtByVo(ShiftProductionVo productionVo); ShiftProductionVo selectQtByWorkOrder(@Param("workOrderCode") String workOrderCode, @Param("pointCode") String pointCode);
List<KilnInfoVo> selectInKilnBoard(); List<KilnInfoVo> selectInKilnBoard();

View File

@@ -45,7 +45,8 @@
GROUP BY m.order_number GROUP BY m.order_number
</select> </select>
<select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo"> <select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo">
SELECT w.point_name AS device, SELECT w.point_code as pointCode,
w.point_name AS device,
w.workorder_code as workorderCode, w.workorder_code as workorderCode,
w.team, w.team,
m.material_code as materialName, m.material_code as materialName,
@@ -137,24 +138,21 @@
</select> </select>
<select id="getLastWorkOrderList" resultType="org.nl.wms.cockpit.service.dao.WorkOrderVo"> <select id="getLastWorkOrderList" resultType="org.nl.wms.cockpit.service.dao.WorkOrderVo">
SELECT w.workorder_code as workorderCode, SELECT g.point_code AS pointCode,
m.material_code as materialName, g.point_name AS pointName,
m.material_spec as materialSpec, g.material_qty AS materialQty,
w.plan_qty as planQty, g.update_time AS createTime,
w.plan_weight as planWeight, g.vehicle_code AS vehicleCode,
m.order_number as produceOrder, m.material_code AS materialCode,
c.cust_name as customer, m.material_model AS materialModel,
(SELECT label m.material_spec AS materialSpec
FROM sys_dict s FROM sch_base_vehiclematerialgroup g
WHERE CODE = 'vehicle_type' LEFT JOIN md_base_material m ON m.material_id = g.material_id
AND s.`value` = w.vehicle_type) AS vehicleType, WHERE g.point_code IN (SELECT point_code FROM sch_base_point WHERE region_code = 'HCHJ')
w.create_time as createTime and g.material_id in
FROM pdm_bd_workorder w (select material_id from pdm_bd_workorder where region_code = 'FJ' and workorder_status = '3')
LEFT JOIN md_base_material m ON m.material_id = w.material_id AND g.group_bind_material_status = '2'
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id ORDER BY g.point_code
WHERE w.region_code in ('FJ', 'RGFJ')
AND w.workorder_status <![CDATA[ <> ]]> '5'
ORDER BY w.create_time
</select> </select>
<select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo"> <select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo">
@@ -371,7 +369,7 @@
WHERE p.workorder_status = '3' WHERE p.workorder_status = '3'
and p.point_code = #{pointCode} limit 1 and p.point_code = #{pointCode} limit 1
</select> </select>
<select id="selectQtByVo" resultType="org.nl.wms.cockpit.service.dao.ShiftProductionVo"> <select id="selectQtByWorkOrder" resultType="org.nl.wms.cockpit.service.dao.ShiftProductionVo">
SELECT COUNT(CASE WHEN is_qualified = '1' THEN 1 END) AS qualifiedQty, SELECT COUNT(CASE WHEN is_qualified = '1' THEN 1 END) AS qualifiedQty,
COUNT(CASE WHEN is_qualified = '0' THEN 1 END) AS unqualifiedQty COUNT(CASE WHEN is_qualified = '0' THEN 1 END) AS unqualifiedQty
FROM md_base_brick_info FROM md_base_brick_info

View File

@@ -204,7 +204,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isEmpty(workOrder)) { if (ObjectUtil.isEmpty(workOrder)) {
throw new BadRequestException("工单不能为空!"); throw new BadRequestException("工单不能为空!");
} }
if ("FJ".equals(basePoint.getRegion_code())){ if ("FJ".equals(basePoint.getRegion_code())) {
// 从所选区域中,选择满料位、无锁、可用的点位 // 从所选区域中,选择满料位、无锁、可用的点位
List<String> regin = new ArrayList<>(); List<String> regin = new ArrayList<>();
regin.add("HCHJ"); regin.add("HCHJ");
@@ -219,7 +219,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return response; return response;
} }
} }
if ("YZ".equals(basePoint.getRegion_code())){ if ("YZ".equals(basePoint.getRegion_code())) {
List<String> regin = new ArrayList<>(); List<String> regin = new ArrayList<>();
regin.add("KL"); regin.add("KL");
MdBaseMaterial material = materialService.getById(workOrder.getMaterial_id()); MdBaseMaterial material = materialService.getById(workOrder.getMaterial_id());
@@ -236,6 +236,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 组织参数 // 组织参数
param.put("config_code", configCode); param.put("config_code", configCode);
taskService.apply(param); taskService.apply(param);
} else {
throw new BadRequestException("其他设备占用锁,等待结束!");
} }
} finally { } finally {
if (tryLock) { if (tryLock) {
@@ -352,8 +354,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
/** /**
* mark: 特殊处理 * mark: 特殊处理
*
* @param regionCode 区域 * @param regionCode 区域
* @param param 参数 * @param param 参数
* @return 数字 * @return 数字
* 在申请任务后引用 * 在申请任务后引用
* handling = specialHandling(basePoint.getRegion_code(), param); * handling = specialHandling(basePoint.getRegion_code(), param);
@@ -612,13 +615,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return this.isStandingFinish(baseRequest); return this.isStandingFinish(baseRequest);
// 如果是入窑口就是记录数据 // 如果是入窑口就是记录数据
case GeneralDefinition.GZY: case GeneralDefinition.GZY:
return this.recordKilnTime(baseRequest,GeneralDefinition.GZY); return this.recordKilnTime(baseRequest, GeneralDefinition.GZY);
// 入窑缓存线 // 入窑缓存线
case GeneralDefinition.RYHCX: case GeneralDefinition.RYHCX:
return this.recordKilnTime(baseRequest,GeneralDefinition.RYHCX); return this.recordKilnTime(baseRequest, GeneralDefinition.RYHCX);
// 出窑缓存线 // 出窑缓存线
case GeneralDefinition.CYHCX: case GeneralDefinition.CYHCX:
return this.recordKilnTime(baseRequest,GeneralDefinition.CYHCX); return this.recordKilnTime(baseRequest, GeneralDefinition.CYHCX);
default: default:
taskResponse.setMessage("参数错误!"); taskResponse.setMessage("参数错误!");
taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST); taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST);
@@ -718,7 +721,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
* 扫码成功申请 - 入窑记录时间 * 扫码成功申请 - 入窑记录时间
*/ */
@Override @Override
public ApplyTaskResponse recordKilnTime(ApplyTaskRequest baseRequest,String type) { public ApplyTaskResponse recordKilnTime(ApplyTaskRequest baseRequest, String type) {
log.info("扫码成功申请 - 出入窑记录时间的参数: {}", baseRequest); log.info("扫码成功申请 - 出入窑记录时间的参数: {}", baseRequest);
if (ObjectUtil.isEmpty(baseRequest.getVehicle_code())) { if (ObjectUtil.isEmpty(baseRequest.getVehicle_code())) {
throw new BadRequestException("载具编码不能为空"); throw new BadRequestException("载具编码不能为空");
@@ -739,7 +742,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 如果已经记录就跳过 // 如果已经记录就跳过
return ApplyTaskResponse.responseOk(baseRequest.getRequestNo()); return ApplyTaskResponse.responseOk(baseRequest.getRequestNo());
} }
recordInOrOutKilnTime(groupInfo, basePoint,type); recordInOrOutKilnTime(groupInfo, basePoint, type);
if (ObjectUtil.isNotEmpty(basePoint)) { if (ObjectUtil.isNotEmpty(basePoint)) {
// 记录当前位置 // 记录当前位置
groupInfo.setPoint_code(basePoint.getPoint_code()); // 当前位置 groupInfo.setPoint_code(basePoint.getPoint_code()); // 当前位置
@@ -759,8 +762,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
private void recordInOrOutKilnTime(SchBaseVehiclematerialgroup groupInfo, SchBasePoint basePoint, String type) {
private void recordInOrOutKilnTime(SchBaseVehiclematerialgroup groupInfo, SchBasePoint basePoint,String type) {
if (GeneralDefinition.RYHCX.equals(type)) { if (GeneralDefinition.RYHCX.equals(type)) {
groupInfo.setInto_kiln_time(DateUtil.now()); groupInfo.setInto_kiln_time(DateUtil.now());
} }
@@ -998,7 +1000,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 载具编码从点位中获取 // 载具编码从点位中获取
// 组盘,返回组盘标识,设置待绑定,搬运结束就设置已绑定 // 组盘,返回组盘标识,设置待绑定,搬运结束就设置已绑定
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
if (StringUtils.isEmpty(vehicle_code)){ if (StringUtils.isEmpty(vehicle_code)) {
return BaseResponse.responseError(requestNo, "载具号为空!"); return BaseResponse.responseError(requestNo, "载具号为空!");
} }
String vehicleCode = TaskUtils.defaultVehicleCode(vehicle_code); String vehicleCode = TaskUtils.defaultVehicleCode(vehicle_code);
@@ -1008,7 +1010,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
// 砖块数量 // 砖块数量
Integer qty = param.getInteger("qty"); Integer qty = param.getInteger("qty");
if (ObjectUtil.isEmpty(qty)){ if (ObjectUtil.isEmpty(qty)) {
return BaseResponse.responseError(requestNo, "砖块数量为空!"); return BaseResponse.responseError(requestNo, "砖块数量为空!");
} }
String vehicleType = workOrder.getVehicle_type(); String vehicleType = workOrder.getVehicle_type();
@@ -1052,9 +1054,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public JSONObject errorDeviceRecord(JSONObject param) { public JSONObject errorDeviceRecord(JSONObject param) {
DasDeviceErrorRecord dasDeviceErrorRecord = new DasDeviceErrorRecord(); DasDeviceErrorRecord dasDeviceErrorRecord = new DasDeviceErrorRecord();
dasDeviceErrorRecord.setDevice_code( param.getString("device_code")); dasDeviceErrorRecord.setDevice_code(param.getString("device_code"));
dasDeviceErrorRecord.setError(param.getString("error")); dasDeviceErrorRecord.setError(param.getString("error"));
dasDeviceErrorRecordService.create(dasDeviceErrorRecord); dasDeviceErrorRecordService.create(dasDeviceErrorRecord);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("status", org.springframework.http.HttpStatus.OK.value()); result.put("status", org.springframework.http.HttpStatus.OK.value());
result.put("message", "故障上报完成!"); result.put("message", "故障上报完成!");