rev:修复自动叫料:同载具叫料载具占用的问题
This commit is contained in:
@@ -189,6 +189,9 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public JSONObject autoCalledMater(JSONObject form) {
|
public JSONObject autoCalledMater(JSONObject form) {
|
||||||
|
StringBuffer error = new StringBuffer();
|
||||||
|
error.append("叫料失败...");
|
||||||
|
|
||||||
JSONObject jsonFormMst = WQLObject.getWQLObject("PDM_BI_Formula").query("formula_id = '" + form.getString("formula_id") + "' and status <> '99'").uniqueResult(0);
|
JSONObject jsonFormMst = WQLObject.getWQLObject("PDM_BI_Formula").query("formula_id = '" + form.getString("formula_id") + "' and status <> '99'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonFormMst)) { throw new BadRequestException("配方已完成"); }
|
if (ObjectUtil.isEmpty(jsonFormMst)) { throw new BadRequestException("配方已完成"); }
|
||||||
JSONArray dtlArr = WQLObject.getWQLObject("PDM_BI_FormulaDtl").query("formula_id = '" + form.getString("formula_id") + "' and status <> '99' and is_need_move = '1' order by seq_no ASC").getResultJSONArray(0);
|
JSONArray dtlArr = WQLObject.getWQLObject("PDM_BI_FormulaDtl").query("formula_id = '" + form.getString("formula_id") + "' and status <> '99' and is_need_move = '1' order by seq_no ASC").getResultJSONArray(0);
|
||||||
@@ -241,7 +244,7 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
}, HashMap::putAll);
|
}, HashMap::putAll);
|
||||||
Map<String, Double> moveQty = total_move.stream().collect(HashMap::new, (map, qty) -> {
|
Map<String, Double> moveQty = total_move.stream().collect(HashMap::new, (map, qty) -> {
|
||||||
JSONObject jo = (JSONObject) qty;
|
JSONObject jo = (JSONObject) qty;
|
||||||
map.put(jo.getString("qk"), jo.getDouble("canuse_qty"));
|
map.put(jo.getString("qk"), jo.getDouble("qty"));
|
||||||
}, HashMap::putAll);
|
}, HashMap::putAll);
|
||||||
//需要移库的库存
|
//需要移库的库存
|
||||||
List<JSONObject> need_move = new ArrayList<>();
|
List<JSONObject> need_move = new ArrayList<>();
|
||||||
@@ -249,18 +252,21 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
JSONObject item = (JSONObject) o;
|
JSONObject item = (JSONObject) o;
|
||||||
String material_id = item.getString("material_id");
|
String material_id = item.getString("material_id");
|
||||||
String pcsn = item.getString("pcsn");
|
String pcsn = item.getString("pcsn");
|
||||||
//校验配粉位有没有位置没有跳过
|
|
||||||
if (g_material.contains(material_id)?g_points.size()==0:notG_points.size()==0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//3
|
//3
|
||||||
double subQty = NumberUtil.sub(item.getDoubleValue("formula_qty"), item.getDoubleValue("put_qty"));
|
double subQty = NumberUtil.sub(item.getDoubleValue("formula_qty"), item.getDoubleValue("put_qty"));
|
||||||
Double 配粉位_hasQty = hasQty.get(item.getString("material_id") + item.getString("pcsn"));
|
Double 配粉位_hasQty = hasQty.get(item.getString("material_id") + item.getString("pcsn"));
|
||||||
Double 移库种_hasQty = moveQty.get(item.getString("material_id") + item.getString("pcsn"));
|
Double 移库种_hasQty = moveQty.get(item.getString("material_id") + item.getString("pcsn"));
|
||||||
double uncla_qty = Double.parseDouble(String.valueOf(NumberUtil.sub(subQty, 配粉位_hasQty, 移库种_hasQty)));
|
double uncla_qty = Double.parseDouble(String.valueOf(NumberUtil.sub(subQty, 配粉位_hasQty, 移库种_hasQty)));
|
||||||
if (uncla_qty<=0){
|
if (uncla_qty<=0){
|
||||||
|
error.append("批次"+pcsn).append("配粉位已叫料").append(";").append("\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
//校验配粉位有没有位置没有跳过
|
||||||
|
if (g_material.contains(material_id)?g_points.size()==0:notG_points.size()==0){
|
||||||
|
error.append("批次"+pcsn).append("配粉位有没有位置").append(";").append("\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//4 库存:从小到大
|
//4 库存:从小到大
|
||||||
JSONArray 库存_qty = WQL.getWO("QMD_FORMING01")
|
JSONArray 库存_qty = WQL.getWO("QMD_FORMING01")
|
||||||
.addParam("flag", "5")
|
.addParam("flag", "5")
|
||||||
@@ -268,6 +274,7 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
.addParam("pcsn", pcsn).process()
|
.addParam("pcsn", pcsn).process()
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
if (库存_qty.size()==0){
|
if (库存_qty.size()==0){
|
||||||
|
error.append("批次"+pcsn).append("没有库存").append(";").append("\n");
|
||||||
log.info("叫料失败,此配方明细批次:"+pcsn+"/物料:"+material_id+"没有库存");
|
log.info("叫料失败,此配方明细批次:"+pcsn+"/物料:"+material_id+"没有库存");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -298,24 +305,31 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
log.info("待移库信息:{}",need_move);
|
log.info("待移库信息:{}",need_move);
|
||||||
List<JSONObject> moveForm = new ArrayList<>();
|
List<JSONObject> moveForm = new ArrayList<>();
|
||||||
if (!CollectionUtils.isEmpty(need_move)){
|
if (!CollectionUtils.isEmpty(need_move)){
|
||||||
for (JSONObject move_ivt : need_move) {
|
Map<String, List<JSONObject>> collect = need_move.stream().collect(Collectors.groupingBy(move -> move.getString("storagevehicle_code")));
|
||||||
String material_id = move_ivt.getString("material_id");
|
for (String storagevehicle_code : collect.keySet()) {
|
||||||
|
String material_id = collect.get(storagevehicle_code).get(0).getString("material_id");
|
||||||
JSONObject in_point = null;
|
JSONObject in_point = null;
|
||||||
if (g_material.contains(material_id )){
|
if (g_material.contains(material_id )){
|
||||||
if (g_points.size()>0){
|
if (g_points.size()>0){ in_point= g_points.remove(0); }
|
||||||
in_point= g_points.remove(0);
|
|
||||||
}
|
|
||||||
}else if (notG_points.size()>0){
|
}else if (notG_points.size()>0){
|
||||||
if (notG_points.size()>0){
|
if (notG_points.size()>0){ in_point= notG_points.remove(0); }
|
||||||
in_point= notG_points.remove(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (in_point==null){
|
if (in_point==null){ continue; };
|
||||||
continue;
|
|
||||||
};
|
JSONObject map = new JSONObject();
|
||||||
// 8.2 生成移库单
|
JSONArray tableData = new JSONArray();
|
||||||
JSONObject map = packageMoveForm(move_ivt, in_point);
|
map.put("bill_status", "10");
|
||||||
|
map.put("bill_type", "21");
|
||||||
|
map.put("biz_date", DateUtil.today());
|
||||||
|
map.put("stor_code", "01");
|
||||||
|
map.put("stor_id", "1473161852946092032");
|
||||||
|
map.put("stor_name", "原材料库");
|
||||||
|
map.put("tableData",tableData);
|
||||||
moveForm.add(map);
|
moveForm.add(map);
|
||||||
|
for (JSONObject item : collect.get(storagevehicle_code)) {
|
||||||
|
tableData.add(packageMoveForm(item, in_point));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
List<String> moveList = new ArrayList<>();
|
List<String> moveList = new ArrayList<>();
|
||||||
for (JSONObject map : moveForm) {
|
for (JSONObject map : moveForm) {
|
||||||
@@ -323,6 +337,8 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
moveList.add(move_id);
|
moveList.add(move_id);
|
||||||
}
|
}
|
||||||
flourworkService.asyncdown(moveList,SecurityUtils.getCurrentUserId(),SecurityUtils.getNickName());
|
flourworkService.asyncdown(moveList,SecurityUtils.getCurrentUserId(),SecurityUtils.getNickName());
|
||||||
|
}else {
|
||||||
|
throw new BadRequestException(error.toString());
|
||||||
}
|
}
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("task", moveForm.size());
|
result.put("task", moveForm.size());
|
||||||
@@ -330,14 +346,6 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject packageMoveForm(JSONObject move_ivt, JSONObject in_point) {
|
private JSONObject packageMoveForm(JSONObject move_ivt, JSONObject in_point) {
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
JSONArray tableData = new JSONArray();
|
|
||||||
map.put("bill_status", "10");
|
|
||||||
map.put("bill_type", "21");
|
|
||||||
map.put("biz_date", DateUtil.today());
|
|
||||||
map.put("stor_code", "01");
|
|
||||||
map.put("stor_id", "1473161852946092032");
|
|
||||||
map.put("stor_name", "原材料库");
|
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("edit", true);
|
param.put("edit", true);
|
||||||
param.put("is_active", move_ivt.getString("is_active"));
|
param.put("is_active", move_ivt.getString("is_active"));
|
||||||
@@ -362,9 +370,7 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|||||||
param.put("storagevehicle_code", move_ivt.getString("storagevehicle_code"));
|
param.put("storagevehicle_code", move_ivt.getString("storagevehicle_code"));
|
||||||
param.put("work_status", "10");
|
param.put("work_status", "10");
|
||||||
param.put("source_billdtl_id", move_ivt.getString("source_billdtl_id"));
|
param.put("source_billdtl_id", move_ivt.getString("source_billdtl_id"));
|
||||||
tableData.add(param);
|
return param;
|
||||||
map.put("tableData", tableData);
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
LEFT JOIN PDM_BI_FormulaDtl formdtl ON formdtl.formuladtl_id = invdtl.source_billdtl_id
|
LEFT JOIN PDM_BI_FormulaDtl formdtl ON formdtl.formuladtl_id = invdtl.source_billdtl_id
|
||||||
LEFT JOIN PDM_BI_Formula formmst ON formmst.formula_id = formdtl.formula_id
|
LEFT JOIN PDM_BI_Formula formmst ON formmst.formula_id = formdtl.formula_id
|
||||||
WHERE
|
WHERE
|
||||||
invdtl.work_status = '02'
|
invdtl.work_status in ('01','02')
|
||||||
OPTION 输入.workorder_id <> ""
|
OPTION 输入.workorder_id <> ""
|
||||||
formmst.workorder_id = 输入.workorder_id
|
formmst.workorder_id = 输入.workorder_id
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
|||||||
Struct_map.put(storagevehicle_code, row);
|
Struct_map.put(storagevehicle_code, row);
|
||||||
}
|
}
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
ids.append("','");
|
ids.append(",'");
|
||||||
}
|
}
|
||||||
ids.append(storagevehicle_code);
|
ids.append(storagevehicle_code);
|
||||||
}
|
}
|
||||||
@@ -413,6 +413,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
|||||||
jo.put("seq_no", (i + 1) + "");
|
jo.put("seq_no", (i + 1) + "");
|
||||||
jo.put("work_status", "01");
|
jo.put("work_status", "01");
|
||||||
jo.put("is_issued", "0");
|
jo.put("is_issued", "0");
|
||||||
|
|
||||||
JSONObject row = (JSONObject) Struct_map.get(jo.getString("storagevehicle_code"));
|
JSONObject row = (JSONObject) Struct_map.get(jo.getString("storagevehicle_code"));
|
||||||
String turnin_struct_id = row.getString("turnin_struct_id");
|
String turnin_struct_id = row.getString("turnin_struct_id");
|
||||||
jo.put("turnin_sect_id", row.getString("turnin_sect_id"));
|
jo.put("turnin_sect_id", row.getString("turnin_sect_id"));
|
||||||
@@ -421,6 +422,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
|||||||
jo.put("turnin_struct_id", turnin_struct_id);
|
jo.put("turnin_struct_id", turnin_struct_id);
|
||||||
jo.put("turnin_struct_code", row.getString("turnin_struct_code"));
|
jo.put("turnin_struct_code", row.getString("turnin_struct_code"));
|
||||||
jo.put("turnin_struct_name", row.getString("turnin_struct_name"));
|
jo.put("turnin_struct_name", row.getString("turnin_struct_name"));
|
||||||
|
jo.put("source_billdtl_id", row.getString("source_billdtl_id"));
|
||||||
//查询移入点位
|
//查询移入点位
|
||||||
JSONObject point = wo_Point.query("source_id='" + turnin_struct_id + "'").uniqueResult(0);
|
JSONObject point = wo_Point.query("source_id='" + turnin_struct_id + "'").uniqueResult(0);
|
||||||
if (point == null) {
|
if (point == null) {
|
||||||
|
|||||||
@@ -19,12 +19,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:whxr_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:whxr}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:whxr}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:942464Yy}
|
password: ${DB_PWD:123456}
|
||||||
# username: ${DB_USER:root}
|
|
||||||
# password: ${DB_PWD:root}
|
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ spring:
|
|||||||
freemarker:
|
freemarker:
|
||||||
check-template-location: false
|
check-template-location: false
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user