update:分拣看板增加当前工单所需物料信息;
fix:修改分拣缺料任务同时接收acs请求只会下发一条任务问题; update:修改分拣看板合格率改为百分比
This commit is contained in:
@@ -9,6 +9,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class ProductTaskVo {
|
||||
private String pointCode;
|
||||
private String device;
|
||||
private String workorderCode;
|
||||
private String team;
|
||||
|
||||
@@ -7,18 +7,16 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* 当前工单所需物料信息
|
||||
*/
|
||||
@Data
|
||||
public class WorkOrderVo {
|
||||
private String workorderCode;
|
||||
private String materialName;
|
||||
private String pointCode;
|
||||
private String pointName;
|
||||
private String materialCode;
|
||||
private String materialModel;
|
||||
private String materialSpec;
|
||||
private String planQty;
|
||||
private String planWeight;
|
||||
private String produceOrder;
|
||||
private String customer;
|
||||
private String vehicleType;
|
||||
//todo 是否有半托
|
||||
@JsonFormat(pattern ="MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String materialQty;
|
||||
private String vehicleCode;
|
||||
private String createTime;
|
||||
}
|
||||
|
||||
@@ -58,17 +58,22 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
return null;
|
||||
}
|
||||
for (ShiftProductionVo productionVo : shiftProductionList) {
|
||||
ShiftProductionVo res = cockPitMapper.selectQtByVo(productionVo);
|
||||
ShiftProductionVo res = cockPitMapper.selectQtByWorkOrder(productionVo.getWorkOrderCode(), productionVo.getPointCode());
|
||||
productionVo.setQualifiedQty(res.getQualifiedQty());
|
||||
productionVo.setUnqualifiedQty(res.getUnqualifiedQty());
|
||||
int plan = Integer.parseInt(productionVo.getPlanQty());
|
||||
int unqualified = Integer.parseInt(productionVo.getUnqualifiedQty());
|
||||
int qualified = Integer.parseInt(productionVo.getQualifiedQty());
|
||||
int all = unqualified + qualified;
|
||||
int lastQty = plan - unqualified - qualified;
|
||||
productionVo.setLastQty(String.valueOf(Math.max(lastQty, 0)));
|
||||
BigDecimal planBig = new BigDecimal(plan);
|
||||
BigDecimal allBig = new BigDecimal(all);
|
||||
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;
|
||||
}, pool);
|
||||
@@ -91,7 +96,27 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
});
|
||||
// 4、生产任务
|
||||
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 -> {
|
||||
map.put("ProductionTask", result);
|
||||
}).exceptionally((e) -> {
|
||||
@@ -160,7 +185,7 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
resultMap.put("stackingList", null);
|
||||
return null;
|
||||
});
|
||||
//查询剩余工单列表
|
||||
//当前工单货架物料信息
|
||||
CompletableFuture<List<WorkOrderVo>> lastWorkOrderCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getLastWorkOrderList(), pool);
|
||||
lastWorkOrderCompletableFuture.thenAccept(res -> {
|
||||
@@ -685,7 +710,13 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String substring = "FJ01CDW01".substring(0, 4);
|
||||
System.out.println(substring);
|
||||
BigDecimal bigDecimal = new BigDecimal(600);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.cockpit.service.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.cockpit.service.dao.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,9 +17,11 @@ public interface CockPitMapper {
|
||||
List<ShiftProductionVo> getShiftProductionList();
|
||||
|
||||
List<PressOrderVo> getPressOrderVoList();
|
||||
|
||||
List<ProductTaskVo> getProductionTaskList();
|
||||
|
||||
List<SortingLineVo> getSortingLine();
|
||||
|
||||
List<RgSortingLineVo> getRgSortingLineVo();
|
||||
|
||||
List<StackVo> getUnstackingList();
|
||||
@@ -42,6 +45,7 @@ public interface CockPitMapper {
|
||||
InOutKilnVo selectOutKilnInfo();
|
||||
|
||||
KilnVo selectKilnInfo();
|
||||
|
||||
List<KilnMaterialInfo> selectKilnMaterialInfo();
|
||||
|
||||
|
||||
@@ -69,7 +73,7 @@ public interface CockPitMapper {
|
||||
|
||||
FjPintInfoVo selectFJJXSMaterialInfo(String pointCode);
|
||||
|
||||
ShiftProductionVo selectQtByVo(ShiftProductionVo productionVo);
|
||||
ShiftProductionVo selectQtByWorkOrder(@Param("workOrderCode") String workOrderCode, @Param("pointCode") String pointCode);
|
||||
|
||||
List<KilnInfoVo> selectInKilnBoard();
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
GROUP BY m.order_number
|
||||
</select>
|
||||
<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.team,
|
||||
m.material_code as materialName,
|
||||
@@ -137,24 +138,21 @@
|
||||
</select>
|
||||
|
||||
<select id="getLastWorkOrderList" resultType="org.nl.wms.cockpit.service.dao.WorkOrderVo">
|
||||
SELECT w.workorder_code as workorderCode,
|
||||
m.material_code as materialName,
|
||||
m.material_spec as materialSpec,
|
||||
w.plan_qty as planQty,
|
||||
w.plan_weight as planWeight,
|
||||
m.order_number as produceOrder,
|
||||
c.cust_name as customer,
|
||||
(SELECT label
|
||||
FROM sys_dict s
|
||||
WHERE CODE = 'vehicle_type'
|
||||
AND s.`value` = w.vehicle_type) AS vehicleType,
|
||||
w.create_time as createTime
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id
|
||||
WHERE w.region_code in ('FJ', 'RGFJ')
|
||||
AND w.workorder_status <![CDATA[ <> ]]> '5'
|
||||
ORDER BY w.create_time
|
||||
SELECT g.point_code AS pointCode,
|
||||
g.point_name AS pointName,
|
||||
g.material_qty AS materialQty,
|
||||
g.update_time AS createTime,
|
||||
g.vehicle_code AS vehicleCode,
|
||||
m.material_code AS materialCode,
|
||||
m.material_model AS materialModel,
|
||||
m.material_spec AS materialSpec
|
||||
FROM sch_base_vehiclematerialgroup g
|
||||
LEFT JOIN md_base_material m ON m.material_id = g.material_id
|
||||
WHERE g.point_code IN (SELECT point_code FROM sch_base_point WHERE region_code = 'HCHJ')
|
||||
and g.material_id in
|
||||
(select material_id from pdm_bd_workorder where region_code = 'FJ' and workorder_status = '3')
|
||||
AND g.group_bind_material_status = '2'
|
||||
ORDER BY g.point_code
|
||||
</select>
|
||||
|
||||
<select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo">
|
||||
@@ -371,7 +369,7 @@
|
||||
WHERE p.workorder_status = '3'
|
||||
and p.point_code = #{pointCode} limit 1
|
||||
</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,
|
||||
COUNT(CASE WHEN is_qualified = '0' THEN 1 END) AS unqualifiedQty
|
||||
FROM md_base_brick_info
|
||||
|
||||
@@ -204,7 +204,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (ObjectUtil.isEmpty(workOrder)) {
|
||||
throw new BadRequestException("工单不能为空!");
|
||||
}
|
||||
if ("FJ".equals(basePoint.getRegion_code())){
|
||||
if ("FJ".equals(basePoint.getRegion_code())) {
|
||||
// 从所选区域中,选择满料位、无锁、可用的点位
|
||||
List<String> regin = new ArrayList<>();
|
||||
regin.add("HCHJ");
|
||||
@@ -219,7 +219,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
if ("YZ".equals(basePoint.getRegion_code())){
|
||||
if ("YZ".equals(basePoint.getRegion_code())) {
|
||||
List<String> regin = new ArrayList<>();
|
||||
regin.add("KL");
|
||||
MdBaseMaterial material = materialService.getById(workOrder.getMaterial_id());
|
||||
@@ -236,6 +236,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
} else {
|
||||
throw new BadRequestException("其他设备占用锁,等待结束!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
@@ -352,8 +354,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
/**
|
||||
* mark: 特殊处理
|
||||
*
|
||||
* @param regionCode 区域
|
||||
* @param param 参数
|
||||
* @param param 参数
|
||||
* @return 数字
|
||||
* 在申请任务后引用
|
||||
* handling = specialHandling(basePoint.getRegion_code(), param);
|
||||
@@ -612,13 +615,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return this.isStandingFinish(baseRequest);
|
||||
// 如果是入窑口就是记录数据
|
||||
case GeneralDefinition.GZY:
|
||||
return this.recordKilnTime(baseRequest,GeneralDefinition.GZY);
|
||||
return this.recordKilnTime(baseRequest, GeneralDefinition.GZY);
|
||||
// 入窑缓存线
|
||||
case GeneralDefinition.RYHCX:
|
||||
return this.recordKilnTime(baseRequest,GeneralDefinition.RYHCX);
|
||||
return this.recordKilnTime(baseRequest, GeneralDefinition.RYHCX);
|
||||
// 出窑缓存线
|
||||
case GeneralDefinition.CYHCX:
|
||||
return this.recordKilnTime(baseRequest,GeneralDefinition.CYHCX);
|
||||
return this.recordKilnTime(baseRequest, GeneralDefinition.CYHCX);
|
||||
default:
|
||||
taskResponse.setMessage("参数错误!");
|
||||
taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
@@ -718,7 +721,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
* 扫码成功申请 - 入窑记录时间
|
||||
*/
|
||||
@Override
|
||||
public ApplyTaskResponse recordKilnTime(ApplyTaskRequest baseRequest,String type) {
|
||||
public ApplyTaskResponse recordKilnTime(ApplyTaskRequest baseRequest, String type) {
|
||||
log.info("扫码成功申请 - 出入窑记录时间的参数: {}", baseRequest);
|
||||
if (ObjectUtil.isEmpty(baseRequest.getVehicle_code())) {
|
||||
throw new BadRequestException("载具编码不能为空");
|
||||
@@ -739,7 +742,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 如果已经记录就跳过
|
||||
return ApplyTaskResponse.responseOk(baseRequest.getRequestNo());
|
||||
}
|
||||
recordInOrOutKilnTime(groupInfo, basePoint,type);
|
||||
recordInOrOutKilnTime(groupInfo, basePoint, type);
|
||||
if (ObjectUtil.isNotEmpty(basePoint)) {
|
||||
// 记录当前位置
|
||||
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)) {
|
||||
groupInfo.setInto_kiln_time(DateUtil.now());
|
||||
}
|
||||
@@ -998,7 +1000,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 载具编码从点位中获取
|
||||
// 组盘,返回组盘标识,设置待绑定,搬运结束就设置已绑定
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
if (StringUtils.isEmpty(vehicle_code)){
|
||||
if (StringUtils.isEmpty(vehicle_code)) {
|
||||
return BaseResponse.responseError(requestNo, "载具号为空!");
|
||||
}
|
||||
String vehicleCode = TaskUtils.defaultVehicleCode(vehicle_code);
|
||||
@@ -1008,7 +1010,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
// 砖块数量
|
||||
Integer qty = param.getInteger("qty");
|
||||
if (ObjectUtil.isEmpty(qty)){
|
||||
if (ObjectUtil.isEmpty(qty)) {
|
||||
return BaseResponse.responseError(requestNo, "砖块数量为空!");
|
||||
}
|
||||
String vehicleType = workOrder.getVehicle_type();
|
||||
@@ -1052,9 +1054,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Override
|
||||
public JSONObject errorDeviceRecord(JSONObject param) {
|
||||
DasDeviceErrorRecord dasDeviceErrorRecord = new DasDeviceErrorRecord();
|
||||
dasDeviceErrorRecord.setDevice_code( param.getString("device_code"));
|
||||
dasDeviceErrorRecord.setDevice_code(param.getString("device_code"));
|
||||
dasDeviceErrorRecord.setError(param.getString("error"));
|
||||
dasDeviceErrorRecordService.create(dasDeviceErrorRecord);
|
||||
dasDeviceErrorRecordService.create(dasDeviceErrorRecord);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", org.springframework.http.HttpStatus.OK.value());
|
||||
result.put("message", "故障上报完成!");
|
||||
|
||||
Reference in New Issue
Block a user