rev:木箱重量异常通知飞书
This commit is contained in:
@@ -21,6 +21,7 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
|||||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
|
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||||
|
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||||
import org.nl.wms.pda.st.service.ProductInstorService;
|
import org.nl.wms.pda.st.service.ProductInstorService;
|
||||||
import org.nl.wms.sch.tasks.CutConveyorTask;
|
import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||||
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||||
@@ -31,6 +32,7 @@ import org.redisson.api.RedissonClient;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -59,6 +61,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
|
|
||||||
private final WmsToAcsService wmsToAcsService;
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
|
private final LmsToMesService lmsToMesService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject boxQuery(JSONObject whereJson) {
|
public JSONObject boxQuery(JSONObject whereJson) {
|
||||||
String box_no = whereJson.getString("box_no");
|
String box_no = whereJson.getString("box_no");
|
||||||
@@ -194,6 +198,25 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
throw new BadRequestException("二期仓库木箱,请进行虚拟入库!");
|
throw new BadRequestException("二期仓库木箱,请进行虚拟入库!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重量阈值系统参数
|
||||||
|
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
|
||||||
|
// 木箱系统重量
|
||||||
|
double box_weight = sub_jo.getDoubleValue("box_weight");
|
||||||
|
// 木箱实称重重量
|
||||||
|
double real_weight = sub_jo.getDoubleValue("real_weight");
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(sub_jo.getString("real_weight"))) {
|
||||||
|
throw new BadRequestException("请先进行木箱称重校验!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断木箱毛重是否超标
|
||||||
|
if (NumberUtil.sub(box_weight, weight_sys) <= real_weight && NumberUtil.add(box_weight, weight_sys) >= real_weight) {
|
||||||
|
} else {
|
||||||
|
// 将木箱重量告知飞书
|
||||||
|
notifyMes(sub_jo);
|
||||||
|
throw new BadRequestException("重量不合格!系统重量浮动超过"+weight_sys+"KG,当前木称重重量:"+real_weight);
|
||||||
|
}
|
||||||
|
|
||||||
//判断是该包装计划是否存在长宽高
|
//判断是该包装计划是否存在长宽高
|
||||||
Double box_length = sub_jo.getDoubleValue("box_length");
|
Double box_length = sub_jo.getDoubleValue("box_length");
|
||||||
Double box_width = sub_jo.getDoubleValue("box_width");
|
Double box_width = sub_jo.getDoubleValue("box_width");
|
||||||
@@ -292,6 +315,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
throw new BadRequestException("请扫描内包间入库点位!");
|
throw new BadRequestException("请扫描内包间入库点位!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建二楼去一楼的任务
|
//创建二楼去一楼的任务
|
||||||
JSONObject form = new JSONObject();
|
JSONObject form = new JSONObject();
|
||||||
form.put("point_code1", point_code);
|
form.put("point_code1", point_code);
|
||||||
@@ -574,19 +598,71 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
|
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
|
||||||
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
|
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
|
||||||
|
|
||||||
// 获取系统参数
|
// 获取系统参数1
|
||||||
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
|
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
|
||||||
|
// 获取系统参数2
|
||||||
|
double weight_sys_2 = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys_2").getValue());
|
||||||
|
|
||||||
// 查询子卷包装关系
|
// 查询子卷包装关系
|
||||||
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
|
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
|
||||||
double box_weight = jsonSub.getDoubleValue("box_weight");
|
double box_weight = jsonSub.getDoubleValue("box_weight");
|
||||||
|
|
||||||
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {
|
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {
|
||||||
|
// 校验重量上下付浮动是否超过2
|
||||||
|
if (NumberUtil.sub(box_weight, weight_sys_2) <= weight_now && NumberUtil.add(box_weight, weight_sys_2) >= weight_now) {
|
||||||
jo.put("message", "重量合格!当前称重重量:"+weight_now);
|
jo.put("message", "重量合格!当前称重重量:"+weight_now);
|
||||||
} else {
|
} else {
|
||||||
jo.put("message", "重量不合格!当前称重重量:"+weight_now);
|
jo.put("message", "重量警告!系统重量浮动超过"+weight_sys_2+"KG,当前称重重量:"+weight_now);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
jo.put("message", "重量不合格!系统重量浮动超过"+weight_sys+"KG,当前称重重量:"+weight_now);
|
||||||
|
|
||||||
|
}
|
||||||
|
// 更新当前木箱实际重量
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("real_weight",weight_now);
|
||||||
|
subTab.update(json,"package_box_sn = '"+box_no+"'");
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成输送任务时通知木箱重量不合格
|
||||||
|
* @param sub_jo {子卷包装关系对象}
|
||||||
|
*/
|
||||||
|
private void notifyMes(JSONObject sub_jo) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
|
||||||
|
// 飞书用户集合
|
||||||
|
JSONArray UserList = new JSONArray();
|
||||||
|
// 系统参数
|
||||||
|
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU_2").getValue();
|
||||||
|
|
||||||
|
String[] split = userList.split(",");
|
||||||
|
if (split.length > 0) {
|
||||||
|
for (String s : split) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("User", s);
|
||||||
|
UserList.add(jo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("User", "");
|
||||||
|
UserList.add(jo);
|
||||||
|
}
|
||||||
|
param.put("UserList", UserList);
|
||||||
|
// 标签code
|
||||||
|
param.put("Code", "ctp_AA65DNXr3svo");
|
||||||
|
|
||||||
|
// 组织标签内容
|
||||||
|
JSONObject content = new JSONObject();
|
||||||
|
double box_weight = NumberUtil.round(sub_jo.getDoubleValue("box_weight"), 2).doubleValue();
|
||||||
|
double real_weight = NumberUtil.round(sub_jo.getDoubleValue("real_weight"), 2).doubleValue();
|
||||||
|
|
||||||
|
content.put("title", "【LMS通知】木箱超重警告");
|
||||||
|
content.put("Message", "木箱号:"+sub_jo.getString("package_box_sn")+",系统木箱重量:"+box_weight+"KG,实际木箱重量:"+real_weight+"KG");
|
||||||
|
param.put("card", content);
|
||||||
|
|
||||||
|
// 调用mes接口
|
||||||
|
lmsToMesService.proudDayData(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user