|
|
@ -6,44 +6,61 @@ import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.b_lms.storage_manage.md.dao.MdMeMaterialBase; |
|
|
|
import org.nl.b_lms.storage_manage.md.service.MaterialbaseService; |
|
|
|
import org.nl.b_lms.storage_manage.st.dao.StIvtIostordaily; |
|
|
|
import org.nl.b_lms.storage_manage.st.dao.StIvtStructattr; |
|
|
|
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt; |
|
|
|
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivtflow; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtIostordailyService; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtStructattrService; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtStructivtService; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtStructivtflowService; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
|
import org.nl.modules.wql.WQL; |
|
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
|
import org.nl.wms.st.inbill.service.StorPublicService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
/** |
|
|
|
* PC端出入库新增 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Slf4j |
|
|
|
public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
|
|
|
|
/** 货位库存表 */ |
|
|
|
@Autowired |
|
|
|
private StIvtStructivtService structivtService; |
|
|
|
@Autowired |
|
|
|
private MaterialbaseService materialbaseService; |
|
|
|
@Autowired |
|
|
|
private StIvtStructivtflowService stIvtStructivtflowService; |
|
|
|
@Autowired |
|
|
|
private StIvtIostordailyService stIvtIostordailyService; |
|
|
|
@Autowired |
|
|
|
private StIvtStructattrService structattrService; |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
void createStor(JSONObject from) { |
|
|
|
// 货位库存表
|
|
|
|
WQLObject wql_StructIvt = WQLObject.getWQLObject("ST_IVT_StructIvt"); |
|
|
|
// 查询货位信息
|
|
|
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01") |
|
|
|
.addParam("flag", "1") |
|
|
|
.addParam("id", from.getString("struct_id")) |
|
|
|
.process().uniqueResult(0); |
|
|
|
JSONObject jo = structivtService.getStorageInfoByStrId(from.getString("struct_id")); |
|
|
|
if (jo == null) { |
|
|
|
throw new BadRequestException("仓位不存在或者未启用:" + from.getString("struct_id")); |
|
|
|
} |
|
|
|
// 查询物料信息
|
|
|
|
JSONObject jo_WMSMaterial = WQL.getWO("ST_PUB_QUERY_01") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("material_id", from.getString("material_id")) |
|
|
|
.process() |
|
|
|
.uniqueResult(0); |
|
|
|
MdMeMaterialBase jo_WMSMaterial = materialbaseService.getOne(new LambdaUpdateWrapper<MdMeMaterialBase>() |
|
|
|
.eq(MdMeMaterialBase::getMaterial_id, from.getString("material_id")) |
|
|
|
.eq(MdMeMaterialBase::getIs_used, "1") |
|
|
|
.eq(MdMeMaterialBase::getIs_delete, "0")); |
|
|
|
if (ObjectUtil.isEmpty(jo_WMSMaterial)) { |
|
|
|
throw new BadRequestException("物料不存在或者未启用:" + from.getString("material_id")); |
|
|
|
} |
|
|
@ -53,7 +70,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
from.put("stor_id", jo.getString("stor_id")); |
|
|
|
from.put("stor_name", jo.getString("stor_name")); |
|
|
|
from.put("instorage_time", DateUtil.now()); |
|
|
|
wql_StructIvt.insert(from); |
|
|
|
structivtService.save(from.toJavaObject(StIvtStructivt.class)); |
|
|
|
// 更新库存变动日志
|
|
|
|
from.put("result_qty", from.getDoubleValue("ivt_qty")); |
|
|
|
from.put("stor_code", jo.getString("stor_code")); |
|
|
@ -62,10 +79,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
void createStructIvtFlow(JSONObject from) { |
|
|
|
// 仓位库存变动记录表
|
|
|
|
WQLObject wql_StructIvtFlow = WQLObject.getWQLObject("ST_IVT_StructIvtFlow"); |
|
|
|
// 库区物流日表
|
|
|
|
WQLObject wql_IOSectDaily = WQLObject.getWQLObject("ST_IVT_IOStorDaily"); |
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
|
|
|
@ -76,8 +90,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
|
|
|
|
String change_type_scode = from.getString("change_type_scode"); |
|
|
|
String bill_code = from.getString("bill_code"); |
|
|
|
|
|
|
|
wql_StructIvtFlow.insert(from); |
|
|
|
stIvtStructivtflowService.save(from.toJavaObject(StIvtStructivtflow.class)); |
|
|
|
//拆拼盘不汇总到日表,库存变动记录还是要有记录
|
|
|
|
if (bill_code.startsWith("YK") || bill_code.startsWith("CPP")) { |
|
|
|
return; |
|
|
@ -85,22 +98,25 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if ("22,23,33,21,24,25,34".contains(change_type_scode)) { |
|
|
|
String sect_date = DateUtil.today(); |
|
|
|
// 出查询更新条件
|
|
|
|
String sql_where = "stor_id = '" + from.getString("stor_id") + |
|
|
|
"' and sect_date = '" + sect_date + |
|
|
|
"' and material_id = '" + from.getString("material_id") + |
|
|
|
"' and pcsn = '" + from.getString("pcsn") + |
|
|
|
"' and quality_scode = '" + from.getString("quality_scode") + "'"; |
|
|
|
JSONObject jo = wql_IOSectDaily.query(sql_where).uniqueResult(0); |
|
|
|
LambdaQueryWrapper<StIvtIostordaily> lam = new LambdaQueryWrapper<>(); |
|
|
|
lam.eq(StIvtIostordaily::getStor_id, from.getString("stor_id")) |
|
|
|
.eq(StIvtIostordaily::getSect_date, sect_date) |
|
|
|
.eq(StIvtIostordaily::getMaterial_id, from.getString("material_id")) |
|
|
|
.eq(StIvtIostordaily::getPcsn, from.getString("pcsn")) |
|
|
|
.eq(StIvtIostordaily::getQuality_scode, from.getString("quality_scode")); |
|
|
|
StIvtIostordaily jo = stIvtIostordailyService.getOne(lam); |
|
|
|
if (jo == null) {// 新增
|
|
|
|
String sql_where_before = "stor_id = '" + from.getString("stor_id") + |
|
|
|
"' and material_id = '" + from.getString("material_id") + |
|
|
|
"' and pcsn = '" + from.getString("pcsn") + |
|
|
|
"' and quality_scode = '" + from.getString("quality_scode") + "'"; |
|
|
|
JSONObject jo_before = wql_IOSectDaily.query(sql_where_before, "sect_date desc").uniqueResult(0); |
|
|
|
LambdaQueryWrapper<StIvtIostordaily> lam2 = new LambdaQueryWrapper<>(); |
|
|
|
lam2.eq(StIvtIostordaily::getStor_id, from.getString("stor_id")) |
|
|
|
.eq(StIvtIostordaily::getMaterial_id, from.getString("material_id")) |
|
|
|
.eq(StIvtIostordaily::getPcsn, from.getString("pcsn")) |
|
|
|
.eq(StIvtIostordaily::getQuality_scode, from.getString("quality_scode")) |
|
|
|
.orderByDesc(StIvtIostordaily::getSect_date); |
|
|
|
StIvtIostordaily jo_before = stIvtIostordailyService.getOne(lam2, false); |
|
|
|
if (jo_before == null) { |
|
|
|
from.put("start_num", "0"); |
|
|
|
} else { |
|
|
|
from.put("start_num", jo_before.getDoubleValue("end_num")); |
|
|
|
from.put("start_num", jo_before.getEnd_num().doubleValue()); |
|
|
|
} |
|
|
|
from.put("sect_date", sect_date); |
|
|
|
if ("22,33".contains(change_type_scode)) { |
|
|
@ -129,24 +145,24 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
from.put("less_num", from.getDoubleValue("change_qty")); |
|
|
|
} |
|
|
|
|
|
|
|
from.put("stordaily_id", IdUtil.getSnowflake(1, 1).nextId() + ""); |
|
|
|
wql_IOSectDaily.insert(from); |
|
|
|
from.put("stordaily_id", org.nl.common.utils.IdUtil.getStringId()); |
|
|
|
stIvtIostordailyService.save(from.toJavaObject(StIvtIostordaily.class)); |
|
|
|
} else {// 更新
|
|
|
|
HashMap<String, String> map = new HashMap<String, String>(); |
|
|
|
StIvtIostordaily updateDaily = new StIvtIostordaily(); |
|
|
|
if ("22,33".contains(change_type_scode)) { |
|
|
|
map.put("in_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("in_num")) + ""); |
|
|
|
map.put("end_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("end_num")) + ""); |
|
|
|
updateDaily.setIn_num(BigDecimal.valueOf((from.getDoubleValue("change_qty") + jo.getIn_num().doubleValue()))); |
|
|
|
updateDaily.setEnd_num(BigDecimal.valueOf((from.getDoubleValue("change_qty") + jo.getEnd_num().doubleValue()))); |
|
|
|
} else if ("21,25,34".contains(change_type_scode)) { |
|
|
|
map.put("out_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("out_num")) + ""); |
|
|
|
map.put("end_num", (jo.getDoubleValue("end_num") - from.getDoubleValue("change_qty")) + ""); |
|
|
|
updateDaily.setOut_num(BigDecimal.valueOf((from.getDoubleValue("change_qty") + jo.getOut_num().doubleValue()))); |
|
|
|
updateDaily.setEnd_num(BigDecimal.valueOf((jo.getEnd_num().doubleValue() - from.getDoubleValue("change_qty")))); |
|
|
|
} else if ("24".contains(change_type_scode)) { |
|
|
|
map.put("less_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("less_num")) + ""); |
|
|
|
map.put("end_num", (jo.getDoubleValue("end_num") - from.getDoubleValue("change_qty")) + ""); |
|
|
|
updateDaily.setLess_num(BigDecimal.valueOf(from.getDoubleValue("change_qty") + jo.getLess_num().doubleValue())); |
|
|
|
updateDaily.setEnd_num(BigDecimal.valueOf(jo.getEnd_num().doubleValue() - from.getDoubleValue("change_qty"))); |
|
|
|
} else if ("23".contains(change_type_scode)) { |
|
|
|
map.put("more_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("more_num")) + ""); |
|
|
|
map.put("end_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("end_num")) + ""); |
|
|
|
updateDaily.setMore_num(BigDecimal.valueOf(from.getDoubleValue("change_qty") + jo.getMore_num().doubleValue())); |
|
|
|
updateDaily.setEnd_num(BigDecimal.valueOf(from.getDoubleValue("change_qty") + jo.getEnd_num().doubleValue())); |
|
|
|
} |
|
|
|
wql_IOSectDaily.update(map, sql_where); |
|
|
|
stIvtIostordailyService.update(updateDaily, lam); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -154,14 +170,12 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void IOStor(JSONObject from, String change_type_scode) { |
|
|
|
// 仓位库存表
|
|
|
|
WQLObject wql = WQLObject.getWQLObject("ST_IVT_StructIvt"); |
|
|
|
String struct_id_In = ""; |
|
|
|
String material_id_In = ""; |
|
|
|
String pcsn_In = ""; |
|
|
|
String struct_id_In; |
|
|
|
String material_id_In; |
|
|
|
String pcsn_In; |
|
|
|
String storagevehicle_code = from.getString("storagevehicle_code"); |
|
|
|
String quality_scode_In = ""; |
|
|
|
double change_qty = 0; |
|
|
|
String quality_scode_In; |
|
|
|
double change_qty; |
|
|
|
if (ObjectUtil.isEmpty(from)) { |
|
|
|
throw new BadRequestException("输入from异常,请检查"); |
|
|
|
} |
|
|
@ -189,20 +203,12 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (change_qty <= 0) { |
|
|
|
throw new BadRequestException("变动数异常,请检查"); |
|
|
|
} |
|
|
|
/*"struct_id = '" + struct_id_In + |
|
|
|
"' and material_id = '" + material_id_In + |
|
|
|
"' and pcsn = '" + pcsn_In + |
|
|
|
"' and quality_scode = '" + quality_scode_In + "'";*/ |
|
|
|
// 查询条件
|
|
|
|
StringBuffer sql_where = new StringBuffer("struct_id = '"); |
|
|
|
sql_where.append(struct_id_In); |
|
|
|
sql_where.append("' and material_id = '"); |
|
|
|
sql_where.append(material_id_In); |
|
|
|
sql_where.append("' and pcsn = '"); |
|
|
|
sql_where.append(pcsn_In); |
|
|
|
sql_where.append("' and quality_scode = '"); |
|
|
|
sql_where.append(quality_scode_In); |
|
|
|
sql_where.append("'"); |
|
|
|
LambdaQueryWrapper<StIvtStructivt> sql_where = new LambdaQueryWrapper<>(); |
|
|
|
sql_where.eq(StIvtStructivt::getStruct_id, struct_id_In) |
|
|
|
.eq(StIvtStructivt::getMaterial_id, material_id_In) |
|
|
|
.eq(StIvtStructivt::getPcsn, pcsn_In) |
|
|
|
.eq(StIvtStructivt::getQuality_scode, quality_scode_In); |
|
|
|
|
|
|
|
JSONObject map = new JSONObject(); |
|
|
|
map.put("flag", "1"); |
|
|
@ -216,7 +222,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取仓位物料信息
|
|
|
|
JSONObject jo_in = WQL.getWO("QST_IVT_STORPUBLIC").addParamMap(map).process().uniqueResult(0); |
|
|
|
JSONObject jo_in = structivtService.getStorageMaterialInfo(map); |
|
|
|
switch (change_type_scode) { |
|
|
|
case "11": //11加冻结、减可用:出库分配、移库移出
|
|
|
|
if (jo_in != null) { |
|
|
@ -232,8 +238,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (Double.compare(ivt_num_now, ivt_qty) != 0) { |
|
|
|
throw new BadRequestException("输入数据异常,请检查"); |
|
|
|
} |
|
|
|
|
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -251,7 +256,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("frozen_qty") < 0) { |
|
|
|
throw new BadRequestException("库存冻结数异常,请联系管理员分析处理单据!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -272,7 +277,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("frozen_qty") < 0) { |
|
|
|
throw new BadRequestException("冻结数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -287,7 +292,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (Double.compare(ivt_num_now, ivt_qty) != 0) { |
|
|
|
throw new BadRequestException("输入数据异常,请检查"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
from.put("canuse_qty", "0"); |
|
|
|
from.put("ivt_qty", change_qty); |
|
|
@ -309,7 +314,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("canuse_qty") < 0) { |
|
|
|
throw new BadRequestException("可用数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
from.put("canuse_qty", change_qty); |
|
|
|
from.put("ivt_qty", change_qty); |
|
|
@ -335,7 +340,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("canuse_qty") < 0) { |
|
|
|
throw new BadRequestException("可用数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -343,7 +348,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
case "31": //31加待入:入库分配、移库移入
|
|
|
|
if (jo_in != null) { |
|
|
|
jo_in.put("warehousing_qty", jo_in.getDoubleValue("warehousing_qty") + change_qty); |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
from.put("canuse_qty", "0"); |
|
|
|
from.put("ivt_qty", "0"); |
|
|
@ -358,7 +363,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("warehousing_qty") < 0) { |
|
|
|
throw new BadRequestException("待入数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -377,7 +382,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("warehousing_qty") < 0) { |
|
|
|
throw new BadRequestException("待入数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -399,7 +404,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (jo_in.getDoubleValue("canuse_qty") < 0) { |
|
|
|
throw new BadRequestException("可用数不允许为负数!"); |
|
|
|
} |
|
|
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'"); |
|
|
|
structivtService.updateById(jo_in.toJavaObject(StIvtStructivt.class)); |
|
|
|
} else { |
|
|
|
throw new BadRequestException(pcsn_In + "子卷仓位库存异常,请检查"); |
|
|
|
} |
|
|
@ -409,7 +414,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
} |
|
|
|
if (jo_in != null) { |
|
|
|
if (jo_in.getDoubleValue("ivt_qty") == 0 && jo_in.getDoubleValue("canuse_qty") == 0 && jo_in.getDoubleValue("warehousing_qty") == 0) { |
|
|
|
wql.delete(sql_where.toString()); |
|
|
|
structivtService.remove(sql_where); |
|
|
|
} |
|
|
|
// 更新库存变动日志
|
|
|
|
jo_in.put("result_qty", jo_in.getDoubleValue("ivt_qty")); |
|
|
@ -420,10 +425,7 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
jo_in.put("bill_table", from.getString("bill_table")); |
|
|
|
jo_in.put("change_qty", from.getString("change_qty")); |
|
|
|
// 查询货位信息
|
|
|
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01") |
|
|
|
.addParam("flag", "1") |
|
|
|
.addParam("id", from.getString("struct_id")) |
|
|
|
.process().uniqueResult(0); |
|
|
|
JSONObject jo = structivtService.getStorageInfoByStrId(from.getString("struct_id")); |
|
|
|
if (jo == null) { |
|
|
|
throw new BadRequestException("仓位不存在或者未启用:" + from.getString("struct_id")); |
|
|
|
} |
|
|
@ -570,12 +572,6 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateStructAndPointTwo(JSONObject from) { |
|
|
|
//货位表
|
|
|
|
WQLObject wo_Struct = WQLObject.getWQLObject("ST_IVT_StructAttr"); |
|
|
|
//点位表
|
|
|
|
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point"); |
|
|
|
//载具表
|
|
|
|
WQLObject wo_Storage = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo"); |
|
|
|
String struct_id = from.getString("struct_id"); |
|
|
|
String point_code = from.getString("point_code"); |
|
|
|
//锁定类型
|
|
|
@ -589,49 +585,44 @@ public class StorPublicServiceImpl implements StorPublicService { |
|
|
|
if (StrUtil.isEmpty(lock_type)) { |
|
|
|
throw new BadRequestException("点位仓位更新出入参数异常!"); |
|
|
|
} |
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
if ("1".equals(lock_type)) {//解锁
|
|
|
|
map.put("lock_type", lock_type); |
|
|
|
map.put("task_code", ""); |
|
|
|
map.put("inv_type", ""); |
|
|
|
map.put("inv_id", ""); |
|
|
|
map.put("inv_code", ""); |
|
|
|
map.put("point_status", "1"); |
|
|
|
map.put("storagevehicle_code", ""); |
|
|
|
map.put("vehicle_code", ""); |
|
|
|
LambdaUpdateWrapper<StIvtStructattr> saUpLam = new LambdaUpdateWrapper<>(); |
|
|
|
if ("1".equals(lock_type)) { |
|
|
|
//解锁
|
|
|
|
saUpLam.set(StIvtStructattr::getLock_type, lock_type) |
|
|
|
.set(StIvtStructattr::getTask_code, "") |
|
|
|
.set(StIvtStructattr::getInv_type, "") |
|
|
|
.set(StIvtStructattr::getInv_id, "") |
|
|
|
.set(StIvtStructattr::getInv_code, "") |
|
|
|
.set(StIvtStructattr::getStoragevehicle_code, ""); |
|
|
|
if (from.containsKey("is_free") && !"1".equals(from.getString("is_free")) && StrUtil.isNotEmpty(storagevehicle_code)) { |
|
|
|
map.put("storagevehicle_code", storagevehicle_code); |
|
|
|
map.put("storagevehicle_qty", "1"); |
|
|
|
map.put("vehicle_code", storagevehicle_code); |
|
|
|
map.put("point_status", "01"); |
|
|
|
saUpLam.set(StIvtStructattr::getStoragevehicle_code, storagevehicle_code) |
|
|
|
.set(StIvtStructattr::getStoragevehicle_qty, "1"); |
|
|
|
} |
|
|
|
if ("1".equals(from.getString("is_overdue")) && StrUtil.isNotEmpty(is_overdue)) { |
|
|
|
map.put("storagevehicle_code", storagevehicle_code); |
|
|
|
saUpLam.set(StIvtStructattr::getStoragevehicle_code, storagevehicle_code); |
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(from.getString("bill_type"))) { |
|
|
|
if (from.getString("bill_type").equals("1011")){ |
|
|
|
map.put("storagevehicle_code", storagevehicle_code); |
|
|
|
saUpLam.set(StIvtStructattr::getStoragevehicle_code, storagevehicle_code); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
wo_Struct.update(map, "struct_id = '" + struct_id + "'"); |
|
|
|
} else {//锁定
|
|
|
|
map.put("lock_type", lock_type); |
|
|
|
map.put("taskdtl_type", from.getString("task_type")); |
|
|
|
map.put("taskdtl_id", from.getString("task_id")); |
|
|
|
map.put("task_code", from.getString("task_code")); |
|
|
|
map.put("inv_type", from.getString("inv_type")); |
|
|
|
map.put("inv_id", from.getString("inv_id")); |
|
|
|
map.put("inv_code", from.getString("inv_code")); |
|
|
|
} else { |
|
|
|
//锁定
|
|
|
|
saUpLam.set(StIvtStructattr::getLock_type, lock_type) |
|
|
|
.set(StIvtStructattr::getTaskdtl_type, from.getString("task_type")) |
|
|
|
.set(StIvtStructattr::getTaskdtl_id, from.getString("task_id")) |
|
|
|
.set(StIvtStructattr::getTask_code, from.getString("task_code")) |
|
|
|
.set(StIvtStructattr::getInv_type, from.getString("inv_type")) |
|
|
|
.set(StIvtStructattr::getInv_id, from.getString("inv_id")) |
|
|
|
.set(StIvtStructattr::getInv_code, from.getString("inv_code")); |
|
|
|
if (StrUtil.isNotEmpty(storagevehicle_code)) { |
|
|
|
map.put("storagevehicle_code", storagevehicle_code); |
|
|
|
map.put("storagevehicle_qty", "1"); |
|
|
|
map.put("vehicle_code", storagevehicle_code); |
|
|
|
map.put("point_status", "01"); |
|
|
|
saUpLam.set(StIvtStructattr::getStoragevehicle_code, storagevehicle_code) |
|
|
|
.set(StIvtStructattr::getStoragevehicle_qty, "1"); |
|
|
|
} |
|
|
|
} |
|
|
|
wo_Struct.update(map, "struct_id = '" + struct_id + "'"); |
|
|
|
saUpLam.eq(StIvtStructattr::getStruct_id, struct_id); |
|
|
|
structattrService.update(saUpLam); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|