fix: 优化输送线搬运任务与手持工单显示
This commit is contained in:
@@ -27,6 +27,8 @@ public class FjOrderVo {
|
|||||||
private String material_name;
|
private String material_name;
|
||||||
/** 物料规格 */
|
/** 物料规格 */
|
||||||
private String material_spec;
|
private String material_spec;
|
||||||
|
/** 砖型 */
|
||||||
|
private String material_model;
|
||||||
private String ext_data;
|
private String ext_data;
|
||||||
/** 订单号 */
|
/** 订单号 */
|
||||||
private String order_no;
|
private String order_no;
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
for (FjOrderVo order : orders) {
|
for (FjOrderVo order : orders) {
|
||||||
String extData = order.getExt_data();
|
String extData = order.getExt_data();
|
||||||
if (ObjectUtil.isNotEmpty(extData)) {
|
if (ObjectUtil.isNotEmpty(extData)) {
|
||||||
JSONObject object = JSONObject.parseObject(extData);
|
JSONObject object = TaskUtils.parseObject(extData, "客户/订单信息");
|
||||||
order.setOrder_no(ObjectUtil.isNotEmpty(object.getString("order_no"))
|
order.setOrder_no(ObjectUtil.isNotEmpty(object.getString("order_no"))
|
||||||
? object.getString("order_no") : "-");
|
? object.getString("order_no") : "-");
|
||||||
order.setCuster_no(ObjectUtil.isNotEmpty(object.getString("custer_no"))
|
order.setCuster_no(ObjectUtil.isNotEmpty(object.getString("custer_no"))
|
||||||
@@ -505,7 +505,7 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
workorderService.updateById(order);
|
workorderService.updateById(order);
|
||||||
// 创建任务
|
// 创建任务
|
||||||
JSONObject taskParam = new JSONObject();
|
JSONObject taskParam = new JSONObject();
|
||||||
taskParam.put("device_code", "RGCDW01");
|
taskParam.put("device_code", "RGMDW01");
|
||||||
taskParam.put("config_code", "RGBZTask");
|
taskParam.put("config_code", "RGBZTask");
|
||||||
taskParam.put("vehicle_code", vehicleCode);
|
taskParam.put("vehicle_code", vehicleCode);
|
||||||
taskParam.put("vehicle_type", vehicleType);
|
taskParam.put("vehicle_type", vehicleType);
|
||||||
|
|||||||
@@ -170,6 +170,7 @@
|
|||||||
,ma.material_name
|
,ma.material_name
|
||||||
,ma.material_code
|
,ma.material_code
|
||||||
,ma.material_spec
|
,ma.material_spec
|
||||||
|
,ma.material_model
|
||||||
,ma.half_material_code
|
,ma.half_material_code
|
||||||
FROM pdm_bd_workorder wo
|
FROM pdm_bd_workorder wo
|
||||||
LEFT JOIN md_base_material ma ON ma.material_id = wo.material_id
|
LEFT JOIN md_base_material ma ON ma.material_id = wo.material_id
|
||||||
|
|||||||
@@ -107,10 +107,9 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
|||||||
entity.setUpdate_id(currentUserId);
|
entity.setUpdate_id(currentUserId);
|
||||||
entity.setUpdate_name(nickName);
|
entity.setUpdate_name(nickName);
|
||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
// 如果是分拣(并且点位不是分拣输送线),就特殊处理
|
// 如果是分拣,就特殊处理
|
||||||
if (GeneralDefinition.AREA_FJ.equals(entity.getRegion_code())
|
if (GeneralDefinition.AREA_FJ.equals(entity.getRegion_code())) {
|
||||||
&& !"6".equals(point.getPoint_type())) {
|
toCalculatePlannedQuantity(entity, point);
|
||||||
toCalculatePlannedQuantity(entity);
|
|
||||||
}
|
}
|
||||||
pdmBdWorkorderMapper.insert(entity);
|
pdmBdWorkorderMapper.insert(entity);
|
||||||
}
|
}
|
||||||
@@ -120,33 +119,36 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
|||||||
*
|
*
|
||||||
* @param entity
|
* @param entity
|
||||||
*/
|
*/
|
||||||
private void toCalculatePlannedQuantity(PdmBdWorkorder entity) {
|
private void toCalculatePlannedQuantity(PdmBdWorkorder entity, SchBasePoint point) {
|
||||||
// 获取物料
|
// (点位不是分拣输送线)
|
||||||
MdBaseMaterial material = materialService.getById(entity.getMaterial_id());
|
if (!"6".equals(point.getPoint_type())) {
|
||||||
if (ObjectUtil.isEmpty(material.getPack_method()) || ObjectUtil.isEmpty(material.getPack_palletspec())) {
|
// 获取物料
|
||||||
throw new BadRequestException("创建工单失败,物料[" + entity.getMaterial_id() + "]包装规格为空,请维护!");
|
MdBaseMaterial material = materialService.getById(entity.getMaterial_id());
|
||||||
|
if (ObjectUtil.isEmpty(material.getPack_method()) || ObjectUtil.isEmpty(material.getPack_palletspec())) {
|
||||||
|
throw new BadRequestException("创建工单失败,物料[" + entity.getMaterial_id() + "]包装规格为空,请维护!");
|
||||||
|
}
|
||||||
|
// 计划量
|
||||||
|
int orderSubnum = entity.getOrder_subnum();
|
||||||
|
// 已经包装数
|
||||||
|
int guadansum = entity.getGuadansum();
|
||||||
|
// 剩余数
|
||||||
|
int residueNum = orderSubnum - guadansum;
|
||||||
|
int multiply = TaskUtils.convertMultiply(entity.getPack_method());
|
||||||
|
// 计算需要多少木托
|
||||||
|
int ceil = (int) Math.ceil(residueNum / multiply);
|
||||||
|
// 获取此物料在库存中有多少
|
||||||
|
int inventoryQty = vehiclematerialgroupService.getInventoryQtyByMaterialId(entity.getMaterial_id());
|
||||||
|
// 查看库存能有多少托
|
||||||
|
int inventoryCeil = (int) Math.ceil(inventoryQty / multiply);
|
||||||
|
entity.setPlan_qty(ceil > inventoryCeil ? BigDecimal.valueOf(inventoryCeil) : BigDecimal.valueOf(ceil));
|
||||||
|
entity.setPlan_weight(ceil > inventoryCeil ? BigDecimal.valueOf(inventoryQty) : BigDecimal.valueOf(residueNum)); // 对于分拣就是计划钢托盘上的砖数量
|
||||||
|
entity.setProduce_order(entity.getOrder_no());
|
||||||
}
|
}
|
||||||
// 计划量
|
|
||||||
int orderSubnum = entity.getOrder_subnum();
|
|
||||||
// 已经包装数
|
|
||||||
int guadansum = entity.getGuadansum();
|
|
||||||
// 剩余数
|
|
||||||
int residueNum = orderSubnum - guadansum;
|
|
||||||
int multiply = TaskUtils.convertMultiply(entity.getPack_method());
|
|
||||||
// 计算需要多少木托
|
|
||||||
int ceil = (int) Math.ceil(residueNum / multiply);
|
|
||||||
// 获取此物料在库存中有多少
|
|
||||||
int inventoryQty = vehiclematerialgroupService.getInventoryQtyByMaterialId(entity.getMaterial_id());
|
|
||||||
// 查看库存能有多少托
|
|
||||||
int inventoryCeil = (int) Math.ceil(inventoryQty / multiply);
|
|
||||||
// 工单号和客户编码存放json
|
// 工单号和客户编码存放json
|
||||||
JSONObject res = new JSONObject();
|
JSONObject res = new JSONObject();
|
||||||
res.put("order_no", entity.getOrder_no());
|
res.put("order_no", entity.getOrder_no());
|
||||||
res.put("custer_no", entity.getCuster_no());
|
res.put("custer_no", entity.getCuster_no());
|
||||||
entity.setPlan_qty(ceil > inventoryCeil ? BigDecimal.valueOf(inventoryCeil) : BigDecimal.valueOf(ceil));
|
|
||||||
entity.setExt_data(res.toJSONString());
|
entity.setExt_data(res.toJSONString());
|
||||||
entity.setPlan_weight(ceil > inventoryCeil ? BigDecimal.valueOf(inventoryQty) : BigDecimal.valueOf(residueNum)); // 对于分拣就是计划钢托盘上的砖数量
|
|
||||||
entity.setProduce_order(entity.getOrder_no());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||||
@@ -223,4 +224,19 @@ public class TaskUtils {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换JSONObject
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject parseObject(String param, String tip) {
|
||||||
|
JSONObject jsonObject;
|
||||||
|
try {
|
||||||
|
jsonObject = JSONObject.parseObject(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BadRequestException("转化JSON错误, " + tip + ":{" + param + "}");
|
||||||
|
}
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user