rev:修改单据出库校验
This commit is contained in:
@@ -32,6 +32,8 @@ import org.nl.wms.stor_manage.io.service.iostor.IStIvtIostorinvService;
|
||||
import org.nl.wms.stor_manage.io.service.iostor.dao.StIvtIostorinv;
|
||||
import org.nl.wms.stor_manage.io.service.iostor_dtl.IStIvtIostorinvdtlService;
|
||||
import org.nl.wms.stor_manage.io.service.iostor_dtl.dao.StIvtIostorinvdtl;
|
||||
import org.nl.wms.stor_manage.struct.service.IStIvtStructattrService;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StructAssignQty;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -49,10 +51,7 @@ import java.net.URLConnection;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class PdaIOService {
|
||||
@@ -64,6 +63,8 @@ public class PdaIOService {
|
||||
@Autowired
|
||||
private IStIvtIostorinvService iStIvtIostorinvService;
|
||||
@Autowired
|
||||
private IStIvtStructattrService iStIvtStructattrService;
|
||||
@Autowired
|
||||
private IStIvtIostorinvdtlService iStIvtIostorinvdtlService;
|
||||
@Autowired
|
||||
private BmMeasureUnitServiceImpl bmMeasureUnitServiceImpl;
|
||||
@@ -131,14 +132,25 @@ public class PdaIOService {
|
||||
}
|
||||
String storCode = pdaFormOutMst.getStor_code();
|
||||
if (StringUtils.isEmpty(storCode)){
|
||||
storCode="FStockId";
|
||||
// throw new BadRequestException("出库申请失败:明细数据仓库字段未指定");
|
||||
throw new BadRequestException("出库申请失败:明细数据仓库字段未指定");
|
||||
}
|
||||
String pcsn = dtl.getPcsn();
|
||||
if (StringUtils.isEmpty(pcsn)){
|
||||
throw new BadRequestException("明细物料没有指定批号");
|
||||
}
|
||||
List<StructAssignQty> structMaterials = iStIvtStructattrService.getStructIvtAssign(ListOf.of(ivtDtl.getMaterial_id()), storCode);
|
||||
for (StructAssignQty assignQty : structMaterials) {
|
||||
if (assignQty.getPcsn().equals(pcsn)){
|
||||
boolean b = assignQty.getSto_qty().intValue() >= dtl.getNow_assign_qty().intValue();
|
||||
if (!b){
|
||||
throw new BadRequestException(dtl.getMaterial_code()+"物料该批号库存不足");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap map = MapOf.of("end_struct_code", "", "start_struct_code", "", "order", "", "product_area", productArea);
|
||||
ivtDtl.setForm_data(new JSONObject(map));
|
||||
ivtDtl.setQty(now_assign_qty);
|
||||
ivtDtl.setPcsn(dtl.getPcsn());
|
||||
ivtDtl.setPcsn(pcsn);
|
||||
ivtDtl.setStor_code(storCode);//pdaFormOutMst.getStor_code()
|
||||
ivtDtl.setId(IdUtil.getStringId());
|
||||
ivtDtl.setInv_id(mst.getId());
|
||||
@@ -160,9 +172,6 @@ public class PdaIOService {
|
||||
}
|
||||
iStIvtIostorinvdtlService.saveBatch(list);
|
||||
iStIvtIostorinvService.save(mst);
|
||||
for (StIvtIostorinvdtl stIvtIostorinvdtl : list) {
|
||||
iStIvtIostorinvService.outDispense((JSONObject) JSON.toJSON(stIvtIostorinvdtl));
|
||||
}
|
||||
//生成流程
|
||||
String now = DateUtil.now();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -193,6 +202,9 @@ public class PdaIOService {
|
||||
.set("update_name",nickName)
|
||||
.eq("id",sourceFormid));
|
||||
}
|
||||
for (StIvtIostorinvdtl stIvtIostorinvdtl : list) {
|
||||
iStIvtIostorinvService.outDispense((JSONObject) JSON.toJSON(stIvtIostorinvdtl));
|
||||
}
|
||||
return mst;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user