add 改切出库、销售出库测试

This commit is contained in:
ls
2025-08-20 09:56:31 +08:00
parent 7fa68a2341
commit 8b16c31548
10 changed files with 346 additions and 17 deletions

View File

@@ -185,7 +185,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
// 有订单号: 找相同物料、订单号的库存,并根据仓位分组、即木箱分组
// mark: likeMaterOrderMap -> 同物料、同订单号的库存信息key(仓位编码) value(库存实体),也就是一个仓位对应所有的子卷
Map<String, List<JSONObject>> likeMaterOrderMap = ivtList.stream()
.filter(row -> row.getString("material_id").equals(dtlDao.getMaterial_id().toString()) &&
.filter(row -> row.getString("material_id").equals(dtlDao.getMaterial_id()) &&
row.getString("sale_order_name").equals(dtlDao.getSource_bill_code()))
.collect(Collectors.groupingBy(row -> row.getString("struct_code")));

View File

@@ -1,5 +1,6 @@
package org.nl.b_lms.storage_manage.md.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
@@ -15,7 +16,8 @@ public class MdPbMeasureunit implements Serializable {
/**
* 计量单位标识
*/
private Long measure_unit_id;
@TableId
private String measure_unit_id;
/**
* 编码

View File

@@ -11,7 +11,9 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.wms.basedata.st.service.dto.ProductStoreDownDto;
import org.nl.wms.basedata.st.service.dto.ProductStoreParam;
import org.nl.wms.basedata.st.service.vo.ProductStoreVo;
import org.nl.wms.st.outbill.service.dto.OutBillStIvtStructivtDto;
import org.nl.wms.st.outbill.service.dto.StockMaterialQueryParam;
import org.nl.wms.st.outbill.service.vo.OutBillStIvtStructivtVo;
import org.nl.wms.st.outbill.service.vo.OutBillTaskVo;
import org.nl.wms.st.outbill.service.vo.StockMaterialVo;
import org.nl.wms.stat.service.dto.PastStructPageParam;
@@ -52,4 +54,6 @@ public interface StIvtStructivtMapper extends BaseMapper<StIvtStructivt> {
JSONObject getStorageMaterialInfo(JSONObject map);
JSONObject getStorageInfoByStrId(String structId);
List<OutBillStIvtStructivtVo> selectByPcsnAndStructId(@Param("param") OutBillStIvtStructivtDto param);
}

View File

@@ -965,4 +965,25 @@
AND struct.struct_id = #{structId}
</if>
</select>
<select id="selectByPcsnAndStructId" resultType="org.nl.wms.st.outbill.service.vo.OutBillStIvtStructivtVo"
parameterType="org.nl.wms.st.outbill.service.dto.OutBillStIvtStructivtDto">
SELECT
ivt.*,
attr.storagevehicle_code AS box_no,
mater.base_unit_id AS qty_unit_id,
unit.unit_name AS qty_unit_name
FROM
ST_IVT_StructIvt ivt
LEFT JOIN ST_IVT_StructAttr attr ON ivt.struct_id = attr.struct_id
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id
WHERE
ivt.pcsn = #{param.pcsn}
<if test="param.struct_id != '' and param.struct_id != null">
AND ivt.struct_id = #{param.struct_id}
</if>
</select>
</mapper>

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -13,12 +14,19 @@ import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
import org.nl.b_lms.storage_manage.md.dao.MdMeMaterialBase;
import org.nl.b_lms.storage_manage.md.dao.MdPbMeasureunit;
import org.nl.b_lms.storage_manage.md.dao.mapper.MdMeMaterialBaseMapper;
import org.nl.b_lms.storage_manage.md.dao.mapper.MdPbMeasureunitMapper;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.sap.service.SapToLmsService;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
import org.nl.wms.st.instor.service.RecutPlanService;
import org.nl.wms.st.outbill.service.CheckOutBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -34,9 +42,20 @@ public class SapToLmsServiceImpl implements SapToLmsService {
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper;
private final CheckOutBillService checkOutBillService;
private final RawAssistIStorService rawAssistIStorService;
private final RecutPlanService recutPlanService;
@Resource
private IStIvtIostorinvOutService iStIvtIostorinvOutService;
@Autowired
private MdMeMaterialBaseMapper mdMeMaterialBaseMapper;
@Autowired
private MdPbMeasureunitMapper mdPbMeasureunitMapper;
@Override
public JSONObject getReCutInfo(JSONObject json) {
log.info("getReCutInfo的输入参数为------------------------" + json.toString());
@@ -240,8 +259,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
public JSONObject getDeliveryInfo(JSONObject jo) {
log.info("getDeliveryInfo的输入参数为------------------------" + jo.toString());
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
WQLObject unitTab = WQLObject.getWQLObject("md_pb_measureunit"); // 基础单位表
// WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
// WQLObject unitTab = WQLObject.getWQLObject("md_pb_measureunit"); // 基础单位表
JSONObject result = new JSONObject();
try {
@@ -310,15 +329,22 @@ public class SapToLmsServiceImpl implements SapToLmsService {
// 明细
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
// JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
MdMeMaterialBase mdMeMaterialBase = mdMeMaterialBaseMapper.selectOne(new QueryWrapper<MdMeMaterialBase>().eq("material_code", json.getString("MATNR")));
if (ObjectUtil.isEmpty(mdMeMaterialBase)) {
throw new BadRequestException("此物料不存在" + json.getString("MATNR"));
}
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
// JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
jsonDtl.put("material_id", jsonMater.getString("material_id"));
jsonDtl.put("qty_unit_id", jsonMater.getLongValue("base_unit_id"));
jsonDtl.put("qty_unit_name", jsonUnit.getString("unit_name"));
MdPbMeasureunit baseUnitId = mdPbMeasureunitMapper.selectOne(new QueryWrapper<MdPbMeasureunit>().eq("measure_unit_id", mdMeMaterialBase.getBase_unit_id()));
jsonDtl.put("material_id", mdMeMaterialBase.getMaterial_id());
jsonDtl.put("qty_unit_id", mdMeMaterialBase.getBase_unit_id());
jsonDtl.put("qty_unit_name", baseUnitId.getUnit_name());
jsonDtl.put("plan_qty", json.getDoubleValue("LFIMG"));
jsonDtl.put("source_bill_code", json.getString("VGBEL-VGPOS"));
jsonDtl.put("vbeln", json.getString("VBELN")); // 来源交货单
@@ -351,8 +377,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
throw new BadRequestException("子卷幅宽不能为空!");
}
// 明细
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
MdMeMaterialBase mdMeMaterialBase = mdMeMaterialBaseMapper.selectOne(new QueryWrapper<MdMeMaterialBase>().eq("material_code", json.getString("MATNR")));
if (ObjectUtil.isEmpty(mdMeMaterialBase)) {
throw new BadRequestException("此物料不存在" + json.getString("MATNR"));
}
@@ -367,7 +393,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
sub_jo.put("customer_name", json.getString("KUNNR"));
sub_jo.put("customer_description", json.getString("NAMEM"));
sub_jo.put("product_name", json.getString("MATNR"));
sub_jo.put("product_description", jsonMater.getString("material_name"));
sub_jo.put("product_description", mdMeMaterialBase.getMaterial_name());
sub_jo.put("container_name", sap_pcsn);
sub_jo.put("width", width);
sub_jo.put("net_weight", json.getString("LFIMG"));
@@ -414,9 +440,30 @@ public class SapToLmsServiceImpl implements SapToLmsService {
}
// 发货出库
if (StrUtil.equals(lfart, "ZLF")) {
jsonMst.put("tableData", tableData);
// 调用出库新增并分配
String iostorinv_id = checkOutBillService.insertDtl2(jsonMst);
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinv_id", iostorinv_id);
}
// 分拣出库
if (StrUtil.equals(lfart, "ZJS")) {
jsonMst.put("buss_type", "1011");
jsonMst.put("bill_type", "1011");
jsonMst.put("tableData", tableData);
// 调用出库新增并分配
String iostorinv_id = checkOutBillService.insertDtl2(jsonMst);
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinv_id", iostorinv_id);
}
// 退货入库
if (StrUtil.equals(lfart, "ZLR")) {
jsonMst.put("tableData", box_rows);
//创建退货入库单
jsonMst.put("bill_type", "0002");
jsonMst.put("biz_date", DateUtil.now());
jsonMst.put("bill_status", "10");
rawAssistIStorService.insertDtl(jsonMst);
}
}

View File

@@ -193,4 +193,17 @@ public class CheckOutBillController {
// checkOutBillService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneCancel")
@Log("出库单全部取消")
public ResponseEntity<Object> oneCancel(@RequestBody JSONObject whereJson) {
iStIvtIostorinvOutService.cancelDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -128,4 +128,12 @@ public interface CheckOutBillService {
* @param whereJson /
*/
void issueTask(JSONObject whereJson);
/**
* 发货出库用
*
* @param whereJson /
*/
String insertDtl2(JSONObject whereJson);
}

View File

@@ -0,0 +1,9 @@
package org.nl.wms.st.outbill.service.dto;
import lombok.Data;
@Data
public class OutBillStIvtStructivtDto {
private String struct_id;
private String pcsn;
}

View File

@@ -36,12 +36,16 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvMapper;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvdtlMapper;
import org.nl.b_lms.storage_manage.md.dao.MdCsCustomerBase;
import org.nl.b_lms.storage_manage.md.dao.MdCsTransportationBase;
import org.nl.b_lms.storage_manage.md.service.IMdCsCustomerBaseService;
import org.nl.b_lms.storage_manage.md.service.IMdCsTransportationBaseService;
import org.nl.b_lms.storage_manage.st.dao.StIvtBsrealstorattr;
import org.nl.b_lms.storage_manage.st.dao.StIvtSectattr;
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.mapper.StIvtStructattrMapper;
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtStructivtMapper;
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService;
import org.nl.b_lms.storage_manage.st.service.StIvtSectattrService;
@@ -51,15 +55,15 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.StringDealUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.basedata.st.service.StructattrService;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.outbill.service.CheckOutBillService;
import org.nl.wms.st.outbill.service.dto.*;
import org.nl.wms.st.outbill.service.vo.OutBillDtlVo;
import org.nl.wms.st.outbill.service.vo.OutBillTaskVo;
import org.nl.wms.st.outbill.service.vo.OutManageExportVo;
import org.nl.wms.st.outbill.service.vo.StockMaterialVo;
import org.nl.wms.st.outbill.service.vo.*;
import org.nl.wms.stat.service.enums.OutBillTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -112,6 +116,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
@Autowired
private IschBaseTaskService ischBaseTaskService;
@Autowired
private StIvtIostorinvdtlMapper stIvtIostorinvdtlMapper;
@Autowired
private StIvtStructattrMapper stIvtStructattrMapper;
@Override
public List<OutBillDtlVo> getOutBillDtl(OutBillDtlQueryParam param) {
return iostorinvdtlService.getOutBillDtl(param);
@@ -1241,4 +1253,202 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public String insertDtl2(JSONObject map) {
// WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
//明细另一种写法
JSONArray rows = map.getJSONArray("tableData");
map.remove("tableData");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String user = map.getString("user");
if (ObjectUtil.isNotEmpty(user)) {
if ("mes".equals(user)) {
currentUserId = "2";
nickName = "mes用户";
}
if ("sap".equals(user)) {
currentUserId = "3";
nickName = "sap用户";
}
}
String now = DateUtil.now();
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
// JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0);
StIvtBsrealstorattr stIvtBsrealstorattr = bsrealstorattrService.getOne(new LambdaQueryWrapper<StIvtBsrealstorattr>().eq(StIvtBsrealstorattr::getStor_id, map.getString("stor_id")));
map.put("iostorinv_id", iostorinv_id);
map.put("bill_code", bill_code);
map.put("biz_date", map.getString("biz_date").substring(0, 10));
String bill_type = (String) map.get("bill_type");
map.put("buss_type", bill_type.substring(0, 4));
map.put("io_type", "1");
map.put("detail_count", rows.size() + "");
map.put("create_mode", "01");
map.put("stor_code", stIvtBsrealstorattr.getStor_code());
map.put("stor_name", stIvtBsrealstorattr.getStor_name());
map.put("input_optid", currentUserId + "");
map.put("input_optname", nickName);
map.put("input_time", now);
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
map.put("update_time", now);
map.put("is_delete", "0");
map.put("is_upload", "0");
if (ObjectUtil.isNotEmpty(user)) {
if (!"mes".equals(user) || "sap".equals(user)) {
Long deptId = SecurityUtils.getDeptId();
map.put("sysdeptid", deptId);
map.put("syscompanyid", deptId);
}
}
double qty = 0.0; // 主表重量
int num = rows.size(); // 明细数
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
// 校验计划数量不能为零
double plan_qty = row.getDoubleValue("plan_qty");
if (Double.compare(plan_qty, 0) == 0) {
throw new BadRequestException("数量不能为0");
}
// JSONObject jsonDtl = new JSONObject();
// jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
// jsonDtl.put("iostorinv_id", iostorinv_id);
// jsonDtl.put("seq_no", (i + 1) + "");
// jsonDtl.put("material_id", row.getString("material_id"));
// jsonDtl.put("pcsn", row.getString("pcsn"));
// jsonDtl.put("box_no", row.getString("box_no"));
// jsonDtl.put("quality_scode", "01");
// jsonDtl.put("bill_status", "10");
// jsonDtl.put("qty_unit_id", row.get("qty_unit_id"));
// jsonDtl.put("qty_unit_name", row.getString("qty_unit_name"));
// jsonDtl.put("plan_qty", row.get("plan_qty"));
// jsonDtl.put("remark", row.getString("remark"));
// jsonDtl.put("source_bill_code", row.getString("source_bill_code"));
// jsonDtl.put("assign_qty", "0");
// jsonDtl.put("unassign_qty", row.get("plan_qty"));
// jsonDtl.put("vbeln", row.getString("vbeln"));
// jsonDtl.put("posnr", row.getString("posnr"));
// jsonDtl.put("width", row.getString("width"));
StIvtIostorinvdtl stIvtIostorinvdtl = new StIvtIostorinvdtl();
stIvtIostorinvdtl.setIostorinvdtl_id(IdUtil.getSnowflake(1, 1).nextId()+"");
stIvtIostorinvdtl.setIostorinv_id(iostorinv_id);
stIvtIostorinvdtl.setSeq_no(new BigDecimal(i + 1));
stIvtIostorinvdtl.setMaterial_id(row.getString("material_id"));
stIvtIostorinvdtl.setPcsn(row.getString("pcsn"));
stIvtIostorinvdtl.setBox_no(row.getString("box_no"));
stIvtIostorinvdtl.setQuality_scode("01");
stIvtIostorinvdtl.setBill_status("10");
stIvtIostorinvdtl.setQty_unit_id((String) row.get("qty_unit_id"));
stIvtIostorinvdtl.setQty_unit_name(row.getString("qty_unit_name"));
stIvtIostorinvdtl.setPlan_qty(new BigDecimal(row.get("plan_qty").toString()));
stIvtIostorinvdtl.setRemark(row.getString("remark"));
stIvtIostorinvdtl.setSource_bill_code(row.getString("source_bill_code"));
stIvtIostorinvdtl.setAssign_qty(new BigDecimal("0"));
stIvtIostorinvdtl.setUnassign_qty(new BigDecimal(row.get("plan_qty").toString()));
stIvtIostorinvdtl.setVbeln(row.getString("vbeln"));
stIvtIostorinvdtl.setPosnr(row.getString("posnr"));
stIvtIostorinvdtl.setWidth(row.getString("width"));
// WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
stIvtIostorinvdtlMapper.insert(stIvtIostorinvdtl);
qty += stIvtIostorinvdtl.getPlan_qty().doubleValue();
// 判断此明细子卷是否存在,存在则将此木箱下的子卷全部生成明细
String pcsn = row.getString("pcsn");
String box_no = row.getString("box_no");
//查询该箱子所在货位
// JSONObject struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + box_no + "'").uniqueResult(0);
StIvtStructattr struct_jo = stIvtStructattrMapper.selectOne(new LambdaQueryWrapper<StIvtStructattr>().eq(StIvtStructattr::getStoragevehicle_code, box_no));
if (ObjectUtil.isNotEmpty(pcsn)) {
if (ObjectUtil.isEmpty(struct_jo)) {
throw new BadRequestException("未查询到该批次所在货位!");
}
String struct_code = struct_jo.getStruct_code();
// JSONObject json = ivtTab.query("pcsn = '" + pcsn + "' AND struct_code = '" + struct_code + "'").uniqueResult(0);
StIvtStructivt stIvtStructivt = stIvtStructivtMapper.selectOne(new LambdaQueryWrapper<StIvtStructivt>().eq(StIvtStructivt::getPcsn, pcsn).eq(StIvtStructivt::getStruct_code, struct_code));
if (ObjectUtil.isEmpty(stIvtStructivt)) {
continue;
}
// JSONObject jsonMap = new JSONObject();
// jsonMap.put("flag", "1");
// jsonMap.put("pcsn", pcsn);
// jsonMap.put("struct_id", json.getString("struct_id"));
//
// JSONArray ivtArr = WQL.getWO("ST_OUTIVT02").addParamMap(jsonMap).process().getResultJSONArray(0);
OutBillStIvtStructivtDto outBillStIvtStructivtDto = new OutBillStIvtStructivtDto();
outBillStIvtStructivtDto.setPcsn(pcsn);
outBillStIvtStructivtDto.setStruct_id(stIvtStructivt.getStruct_id());
List<OutBillStIvtStructivtVo> outBillStIvtStructivtVos = stIvtStructivtMapper.selectByPcsnAndStructId(outBillStIvtStructivtDto);
for (int j = 0; j < outBillStIvtStructivtVos.size(); j++) {
OutBillStIvtStructivtVo outBillStIvtStructivtVo = outBillStIvtStructivtVos.get(j);
// JSONObject jsonDtl2 = new JSONObject();
// jsonDtl2.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
// jsonDtl2.put("iostorinv_id", iostorinv_id);
// jsonDtl2.put("seq_no", i + 2 + j);
// jsonDtl2.put("material_id", jsonIvt.getString("material_id"));
// jsonDtl2.put("pcsn", jsonIvt.getString("pcsn"));
// jsonDtl2.put("box_no", jsonIvt.getString("box_no"));
// jsonDtl2.put("quality_scode", "01");
// jsonDtl2.put("bill_status", "10");
// jsonDtl2.put("qty_unit_id", jsonIvt.get("qty_unit_id"));
// jsonDtl2.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
// jsonDtl2.put("plan_qty", jsonIvt.get("canuse_qty"));
// jsonDtl2.put("remark", "");
// jsonDtl2.put("assign_qty", "0");
// jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
// jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
StIvtIostorinvdtl stIvtIostorinvdtl2 = new StIvtIostorinvdtl();
stIvtIostorinvdtl2.setIostorinvdtl_id(IdUtil.getSnowflake(1, 1).nextId()+"");
stIvtIostorinvdtl2.setIostorinv_id(iostorinv_id);
stIvtIostorinvdtl2.setSeq_no(new BigDecimal(i + 2 + j));
stIvtIostorinvdtl2.setMaterial_id(outBillStIvtStructivtVo.getMaterial_id());
stIvtIostorinvdtl2.setPcsn(outBillStIvtStructivtVo.getPcsn());
stIvtIostorinvdtl2.setBox_no(outBillStIvtStructivtVo.getBox_no());
stIvtIostorinvdtl2.setQuality_scode("01");
stIvtIostorinvdtl2.setBill_status("10");
stIvtIostorinvdtl2.setQty_unit_id(outBillStIvtStructivtVo.getQty_unit_id());
stIvtIostorinvdtl2.setQty_unit_name(outBillStIvtStructivtVo.getQty_unit_name());
stIvtIostorinvdtl2.setPlan_qty(new BigDecimal(outBillStIvtStructivtVo.getCanuse_qty().toString()));
stIvtIostorinvdtl2.setRemark("");
stIvtIostorinvdtl2.setAssign_qty(new BigDecimal("0"));
stIvtIostorinvdtl2.setUnassign_qty(new BigDecimal(outBillStIvtStructivtVo.getCanuse_qty().toString()));
stIvtIostorinvdtl2.setSource_billdtl_id(stIvtIostorinvdtl.getIostorinvdtl_id());
// 校验计划数量不能为零
double plan_qty2 = stIvtIostorinvdtl2.getPlan_qty().doubleValue();
if (Double.compare(plan_qty2, 0) == 0) {
throw new BadRequestException("数量不能为0");
}
// WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2);
stIvtIostorinvdtlMapper.insert(stIvtIostorinvdtl2);
qty += stIvtIostorinvdtl2.getPlan_qty().doubleValue();
}
num += outBillStIvtStructivtVos.size();
}
}
map.put("total_qty", qty);
map.put("detail_count", num);
WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(map);
return iostorinv_id;
}
}

View File

@@ -0,0 +1,15 @@
package org.nl.wms.st.outbill.service.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt;
@Data
@EqualsAndHashCode(callSuper = false)
public class OutBillStIvtStructivtVo extends StIvtStructivt {
private String box_no;
private String qty_unit_id;
private String qty_unit_name;
}