opt:更新
This commit is contained in:
@@ -46,13 +46,11 @@ public class SecurityUtils {
|
||||
* @return 系统用户名称
|
||||
*/
|
||||
public static String getCurrentNickName() {
|
||||
// CurrentUser user = getCurrentUser();
|
||||
// if (user!=null){
|
||||
// return user.getPresonName();
|
||||
// }
|
||||
// return null;
|
||||
//tofix postMan测试,完成后改回
|
||||
return "admin";
|
||||
CurrentUser user = getCurrentUser();
|
||||
if (user!=null){
|
||||
return user.getPresonName();
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +59,7 @@ public class SecurityUtils {
|
||||
* @return 系统用户Id
|
||||
*/
|
||||
public static String getCurrentUserId() {
|
||||
//return getCurrentUser().getId();
|
||||
//tofix postMan测试,完成后改回
|
||||
return "1";
|
||||
return getCurrentUser().getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +68,7 @@ public class SecurityUtils {
|
||||
*/
|
||||
@Deprecated
|
||||
public static Long getDeptId() {
|
||||
// return getCurrentUser().getUser().getDept().getId();
|
||||
//return getCurrentUser().getUser().getDept().getId();
|
||||
return 1L;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,23 @@ public class StructattrVechielDto extends GroupPlate {
|
||||
* 仓位编码
|
||||
*/
|
||||
private String struct_code;
|
||||
|
||||
/**
|
||||
* 仓位编码
|
||||
*/
|
||||
private String struct_name;
|
||||
/**
|
||||
* 库区标识
|
||||
*/
|
||||
private String sect_id;
|
||||
/**
|
||||
* 库区标识
|
||||
*/
|
||||
private String sect_code;
|
||||
/**
|
||||
* 库区标识
|
||||
*/
|
||||
private String sect_name;
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
|
||||
@@ -87,5 +87,5 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
List<MdPbStoragevehicleextDto> queryAvailableInv(@Param("params") Map whereJson);
|
||||
List<JSONObject> queryAvailableInv(@Param("params") Map whereJson);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
ORDER BY ext.create_time Desc
|
||||
</select>
|
||||
|
||||
<select id="queryAvailableInv" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
|
||||
<select id="queryAvailableInv" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ext.group_id as storagevehicleext_id,
|
||||
ext.storagevehicle_code,
|
||||
@@ -277,7 +277,10 @@
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
attr.lock_type = '0'
|
||||
AND attr.is_used = "1"
|
||||
AND ext.status = '02'
|
||||
and ext.frozen_qty = 0
|
||||
<if test="params.stor_id != null and params.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id = #{params.stor_id}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
jsonDtl.setStatus(IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonDtl.setStor_id(storDao.getStor_id());
|
||||
jsonDtl.setStor_name(storDao.getStor_name());
|
||||
jsonDtl.setForm_type(json.getString("order_type"));
|
||||
jsonDtl.setForm_type("0001");
|
||||
jsonDtl.setSource_form_date(DateUtil.today());
|
||||
jsonDtl.setMaterial_code(json.getString("mater_code"));
|
||||
jsonDtl.setMaterial_id(materDao.getMaterial_id());
|
||||
@@ -140,7 +140,8 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
plate.setQty(BigDecimal.valueOf(json.getDoubleValue("qty")));
|
||||
plate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("生成"));
|
||||
plate.setExt_code(json.getString("order_code"));
|
||||
plate.setExt_type(json.getString("order_type"));
|
||||
plate.setExt_type("0001");
|
||||
plate.setExt_id(jsonDtl.getId());
|
||||
plate.setCreate_name("ERP");
|
||||
plate.setCreate_time(DateUtil.now());
|
||||
plates.add(plate);
|
||||
@@ -204,7 +205,7 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
jsonDtl.setStatus(IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonDtl.setStor_id(storDao.getStor_id());
|
||||
jsonDtl.setStor_name(storDao.getStor_name());
|
||||
jsonDtl.setForm_type(json.getString("order_type"));
|
||||
jsonDtl.setForm_type("1001");
|
||||
jsonDtl.setSource_form_date(DateUtil.today());
|
||||
jsonDtl.setMaterial_code(json.getString("mater_code"));
|
||||
jsonDtl.setMaterial_id(materDao.getMaterial_id());
|
||||
|
||||
@@ -156,7 +156,7 @@ public class PmFormData implements Serializable {
|
||||
/**
|
||||
* 是否完结
|
||||
*/
|
||||
private Integer is_finish;
|
||||
private String is_finish;
|
||||
|
||||
/**
|
||||
* 是否合单
|
||||
|
||||
@@ -125,6 +125,9 @@
|
||||
<if test="query.form_type != null and query.form_type != ''">
|
||||
and form_type = #{query.form_type}
|
||||
</if>
|
||||
<if test="query.is_finish != null and query.is_finish != ''">
|
||||
and is_finish = #{query.is_finish}
|
||||
</if>
|
||||
<if test="query.pcsn != null and query.pcsn != ''">
|
||||
and pcsn = #{query.pcsn}
|
||||
</if>
|
||||
|
||||
@@ -22,6 +22,7 @@ public class FormDataQuery extends BaseQuery<PmFormData> {
|
||||
private String pcsn;
|
||||
private String parent_id;
|
||||
private String material_code;
|
||||
private String is_finish;
|
||||
private String[] status;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
@@ -116,7 +116,7 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
List<MdPbStoragevehicleextDto> queryAvailableInv(Map whereJson);
|
||||
List<JSONObject> queryAvailableInv(Map whereJson);
|
||||
|
||||
/**
|
||||
* 出库单手动分配
|
||||
|
||||
@@ -113,4 +113,9 @@ public class GroupPlate implements Serializable {
|
||||
* 来源单据类型
|
||||
*/
|
||||
private String ext_type;
|
||||
|
||||
/**
|
||||
* 来源单据id
|
||||
*/
|
||||
private String ext_id;
|
||||
}
|
||||
|
||||
@@ -54,20 +54,22 @@
|
||||
gp.material_id,
|
||||
gp.qty_unit_id,
|
||||
gp.qty_unit_name,
|
||||
gp.qty,
|
||||
gp.qty as plan_qty,
|
||||
gp.frozen_qty,
|
||||
gp.remark,
|
||||
gp.STATUS,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
mater.material_code,
|
||||
gp.ext_code,
|
||||
gp.ext_type
|
||||
gp.ext_code as source_bill_code,
|
||||
gp.ext_type as source_bill_type,
|
||||
gp.ext_id as source_billdtl_id
|
||||
FROM
|
||||
md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gp.material_id
|
||||
<where>
|
||||
gp.status = '01' and frozen_qty = 0
|
||||
and gp.ext_type = '0001'
|
||||
<if test="params.material_code != null">
|
||||
AND
|
||||
gp.material_code LIKE CONCAT('%', #{params.material_code}, '%')
|
||||
@@ -120,7 +122,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getIODtl" resultType="org.nl.wms.warehouse_manage.service.dto.IOStorInvDtlDto">
|
||||
SELECT DISTINCT
|
||||
SELECT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
|
||||
@@ -3,13 +3,18 @@ package org.nl.wms.warehouse_manage.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/5/20
|
||||
*/
|
||||
@Data
|
||||
public class GroupPlateDto extends GroupPlate{
|
||||
|
||||
/**
|
||||
* 组盘数量
|
||||
*/
|
||||
private BigDecimal plan_qty;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@@ -21,4 +26,19 @@ public class GroupPlateDto extends GroupPlate{
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String source_bill_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String source_bill_type;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String source_billdtl_id;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,18 @@ import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.pm_manage.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.service.dao.PmFormData;
|
||||
import org.nl.wms.pm_manage.service.dao.mapper.PmFormDataMapper;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
@@ -72,7 +77,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
@Resource
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
@Resource
|
||||
private ISectattrService iSectattrService;
|
||||
/**
|
||||
* 载具扩展属性mapper
|
||||
*/
|
||||
@@ -84,6 +90,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
*/
|
||||
@Resource
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
@Resource
|
||||
private IPmFormDataService iPmFormDataService;
|
||||
|
||||
@Resource
|
||||
private IBsrealStorattrService iBsrealStorattrService;
|
||||
@@ -91,6 +99,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
@Resource
|
||||
private PmFormDataMapper pmFormDataMapper;
|
||||
|
||||
@Resource
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
@@ -223,6 +233,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.get("material_id"));
|
||||
ioStorInvDtl.put("material_code", row.get("material_code"));
|
||||
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
@@ -251,6 +262,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
//暂时只软删除出入库单主表
|
||||
ioStorInvMapper.updateById(param.toJavaObject(IOStorInv.class));
|
||||
//先删除该单据下的所有明细
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,id));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,9 +366,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
String sectCode = whereJson.getString("sect_code");
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
Sectattr sect = iSectattrService.findById(whereJson.getString("sect_code"));
|
||||
if (ObjectUtil.isEmpty(sect)) {
|
||||
throw new BadRequestException("分配库区不能为空!");
|
||||
}
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
@@ -362,7 +379,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配中"));
|
||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
|
||||
@@ -375,21 +392,16 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
String pcsn = dtl.getPcsn();
|
||||
String material_id = dtl.getMaterial_id();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
// 根据物料和批次号查询库存可用
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.material_id(material_id)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.sect_code(sect.getSect_code())
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
|
||||
|
||||
int seq_no = 1;
|
||||
BigDecimal allocation_canuse_qty=BigDecimal.ZERO;
|
||||
for (StrategyStructMaterialVO outAllocation : structMaterials) {
|
||||
@@ -542,7 +554,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
String sectCode = whereJson.getString("sect_code");
|
||||
Sectattr sect = iSectattrService.findById(whereJson.getString("sect_code"));
|
||||
if (ObjectUtil.isEmpty(sect)) {
|
||||
throw new BadRequestException("分配库区不能为空!");
|
||||
}
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
@@ -552,7 +567,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配中"));
|
||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||
queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
|
||||
@@ -564,15 +579,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
IOStorInvDtlDto dtl = dtls.get(i);
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
String pcsn = dtl.getPcsn();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
String material_id = dtl.getMaterial_id();
|
||||
//调用分配规则获取分配的库位:如果库存不足则直接报错
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.material_id(material_id)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.sect_code(sect.getSect_code())
|
||||
.build()
|
||||
);
|
||||
int seq_no = 1;
|
||||
@@ -584,12 +599,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
|
||||
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
||||
ioStorInvDis.setSeq_no((seq_no++)+"");
|
||||
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
||||
ioStorInvDis.setPcsn(outAllocation.getPcsn());
|
||||
ioStorInvDis.setMaterial_id(outAllocation.getMaterial_id());
|
||||
ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code());
|
||||
ioStorInvDis.setSect_name(outAllocation.getSect_name());
|
||||
ioStorInvDis.setSect_code(outAllocation.getSect_code());
|
||||
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
||||
ioStorInvDis.setSect_name(sect.getSect_name());
|
||||
ioStorInvDis.setSect_code(sect.getSect_code());
|
||||
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
|
||||
ioStorInvDis.setStruct_name(outAllocation.getStruct_name());
|
||||
ioStorInvDis.setStruct_code(outAllocation.getStruct_code());
|
||||
@@ -725,7 +739,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MdPbStoragevehicleextDto> queryAvailableInv(Map whereJson) {
|
||||
public List<JSONObject> queryAvailableInv(Map whereJson) {
|
||||
return mdPbStoragevehicleextMapper.queryAvailableInv(whereJson);
|
||||
}
|
||||
|
||||
@@ -750,7 +764,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配中"));
|
||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||
queryDtl.put("iostorinvdtl_id", row.getString("iostorinvdtl_id"));
|
||||
@@ -760,12 +774,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
for (IOStorInvDtlDto dtl:dtls){
|
||||
double unassign_qty = dtl.getUnassign_qty().doubleValue();
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
if (unassign_qty.equals(BigDecimal.ZERO)){
|
||||
throw new BadRequestException("已全部分配完,未分配数量为0");
|
||||
}
|
||||
//分配数量
|
||||
double allocation_canuse_qty = 0;
|
||||
BigDecimal allocation_canuse_qty = BigDecimal.ZERO;
|
||||
for (int i = 0; i < rows.size(); i++){
|
||||
JSONObject ivt = rows.getJSONObject(i);
|
||||
double canuse_qty = ivt.getDoubleValue("canuse_qty");
|
||||
BigDecimal qty = ivt.getBigDecimal("qty");
|
||||
//分配明细
|
||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
||||
@@ -773,7 +790,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
||||
ioStorInvDis.setSeq_no((i+1)+"");
|
||||
ioStorInvDis.setSect_id(ivt.getString("sect_id"));
|
||||
ioStorInvDis.setPcsn(ivt.getString("pcsn"));
|
||||
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
|
||||
ioStorInvDis.setMaterial_id(dtl.getMaterial_id());
|
||||
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
|
||||
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
|
||||
@@ -786,26 +803,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
// if (unassign_qty<0){
|
||||
// unassign_qty=0;
|
||||
// }
|
||||
if (unassign_qty <= 0){
|
||||
throw new BadRequestException("已全部分配完,未分配数量为0");
|
||||
unassign_qty = unassign_qty.subtract(qty);
|
||||
if (unassign_qty.compareTo(BigDecimal.ZERO) <0){
|
||||
unassign_qty = BigDecimal.ZERO;
|
||||
}
|
||||
unassign_qty = unassign_qty-canuse_qty;
|
||||
if (unassign_qty<0){
|
||||
unassign_qty=0;
|
||||
}
|
||||
allocation_canuse_qty = allocation_canuse_qty + canuse_qty;
|
||||
ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
allocation_canuse_qty = allocation_canuse_qty.add(qty);
|
||||
ioStorInvDis.setPlan_qty(qty);
|
||||
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
@@ -834,10 +837,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
//更新详情
|
||||
dtl.setBill_status(unassign_qty==0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
|
||||
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
|
||||
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
||||
dtl.setBill_status((unassign_qty.compareTo(BigDecimal.ZERO) ==0) ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
dtl.setUnassign_qty(unassign_qty);
|
||||
dtl.setAssign_qty(allocation_canuse_qty.add(dtl.getAssign_qty()));
|
||||
ioStorInvDtlMapper.updateById(dtl);
|
||||
}
|
||||
|
||||
@@ -1163,6 +1165,23 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
//判断是否有源单据,更新源单据
|
||||
if(ObjectUtil.isNotEmpty(ioStorInvDtl.getSource_billdtl_id())){
|
||||
PmFormData form = iPmFormDataService.getById(ioStorInvDtl.getSource_billdtl_id());
|
||||
form.setStatus(IOSEnum.BILL_STATUS.code("完成"));
|
||||
form.setIs_finish("1");
|
||||
form.setAssign_qty(form.getQty());
|
||||
iPmFormDataService.updateById(form);
|
||||
//更新被合单单据
|
||||
if(ObjectUtil.isNotEmpty(form.getMerge_codes())){
|
||||
String[] codes = form.getMerge_codes().split(",");
|
||||
pmFormDataMapper.update(null,new LambdaUpdateWrapper<>(PmFormData.class)
|
||||
.set(PmFormData::getStatus,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(PmFormData::getIs_finish,"1")
|
||||
.in(PmFormData::getCode,codes)
|
||||
);
|
||||
}
|
||||
}
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
|
||||
@@ -29,6 +29,8 @@ import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleinfoMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.pm_manage.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.service.dao.PmFormData;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
@@ -46,6 +48,7 @@ import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -89,6 +92,9 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
@Resource
|
||||
private MdPbGroupplateServiceImpl mdPbGroupplateService;
|
||||
|
||||
@Resource
|
||||
private IPmFormDataService iPmFormDataService;
|
||||
|
||||
@Override
|
||||
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
@@ -182,16 +188,16 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("material_code",row.get("material_code"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("source_bill_type",row.get("ext_type"));
|
||||
ioStorInvDtl.put("source_bill_code",row.get("ext_code"));
|
||||
ioStorInvDtl.put("source_bill_type",row.get("source_bill_type"));
|
||||
ioStorInvDtl.put("source_bill_code",row.get("source_bill_code"));
|
||||
ioStorInvDtl.put("source_billdtl_id",row.get("source_billdtl_id"));
|
||||
ioStorInvDtl.put("assign_qty","0");
|
||||
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("plan_qty",row.get("qty"));
|
||||
Double qty = new Double(String.valueOf(row.get("qty")));
|
||||
ioStorInvDtl.put("unassign_qty",row.get("plan_qty"));
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
Double qty = new Double(String.valueOf(row.get("plan_qty")));
|
||||
total_qty = total_qty.add(new BigDecimal(qty));
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
@@ -208,13 +214,12 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("seq_no", 1);
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("material_code", row.get("material_code"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
dis.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
dis.put("plan_qty", row.get("qty"));
|
||||
dis.put("plan_qty", row.get("plan_qty"));
|
||||
ioStorInvDisMapper.insert(dis.toJavaObject(IOStorInvDis.class));
|
||||
}
|
||||
io_mst.put("total_qty", total_qty);
|
||||
@@ -239,6 +244,11 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
|
||||
//暂时只软删除出入库单主表
|
||||
ioStorInvMapper.updateById(param.toJavaObject(IOStorInv.class));
|
||||
|
||||
//先删除该单据下的所有明细
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,id));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,13 +297,16 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("material_code",row.get("material_code"));
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("source_bill_type",row.get("source_bill_type"));
|
||||
ioStorInvDtl.put("source_bill_code",row.get("source_bill_code"));
|
||||
ioStorInvDtl.put("source_billdtl_id",row.get("source_billdtl_id"));
|
||||
ioStorInvDtl.put("assign_qty",0);
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("unassign_qty",row.get("plan_qty"));
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
@@ -309,7 +322,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("iostorinvdtl_id", ioStorInvDtl.getString("iostorinvdtl_id"));
|
||||
dis.put("seq_no", 1);
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("material_code", row.get("material_code"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
@@ -653,12 +666,12 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
throw new BadRequestException("未找到入库单明细记录");
|
||||
}
|
||||
// 明细
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInv)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
throw new BadRequestException("未找到入库单");
|
||||
}
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
@@ -693,6 +706,14 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
//判断是否有源单据,更新源单据
|
||||
if(ObjectUtil.isNotEmpty(ioStorInvDtl.getSource_billdtl_id())){
|
||||
PmFormData form = iPmFormDataService.getById(ioStorInvDtl.getSource_billdtl_id());
|
||||
form.setStatus(IOSEnum.BILL_STATUS.code("完成"));
|
||||
form.setIs_finish("1");
|
||||
form.setAssign_qty(form.getQty());
|
||||
iPmFormDataService.updateById(form);
|
||||
}
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
|
||||
@@ -99,9 +99,6 @@ public class UpdateIvtUtils {
|
||||
if (ObjectUtil.isEmpty(where.getString("material_id"))) {
|
||||
throw new BadRequestException("物料标识不能为空!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(where.getString("pcsn"))) {
|
||||
throw new BadRequestException("批次不能为空!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(where.getString("qty_unit_id"))) {
|
||||
throw new BadRequestException("计量单位标识不能为空!");
|
||||
}
|
||||
@@ -164,7 +161,7 @@ public class UpdateIvtUtils {
|
||||
}
|
||||
// 加冻结数
|
||||
double frozen_qty = NumberUtil.add(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setQty(BigDecimal.valueOf(canuse_qty));
|
||||
//extDao.setQty(BigDecimal.valueOf(canuse_qty));
|
||||
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty));
|
||||
extDao.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
@@ -219,7 +216,7 @@ public class UpdateIvtUtils {
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||
.eq(GroupPlate::getPcsn, where.getString("pcsn")).eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||
@@ -232,7 +229,6 @@ public class UpdateIvtUtils {
|
||||
// 加可用
|
||||
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setFrozen_qty(BigDecimal.ZERO);
|
||||
extDao.setQty(BigDecimal.valueOf(qty));
|
||||
extDao.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
|
||||
Reference in New Issue
Block a user