otp:优化
This commit is contained in:
@@ -18,17 +18,22 @@ import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
|
|||||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||||
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
||||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||||
|
import org.nl.wms.pm_manage.service.dao.PmFormData;
|
||||||
|
import org.nl.wms.pm_manage.service.dao.mapper.PmFormDataMapper;
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
import org.nl.wms.warehouse_manage.service.ReturnService;
|
import org.nl.wms.warehouse_manage.service.ReturnService;
|
||||||
import org.nl.wms.warehouse_manage.service.dao.IOStorInv;
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInv;
|
||||||
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDis;
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDis;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDtl;
|
||||||
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDisMapper;
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDisMapper;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDtlMapper;
|
||||||
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvMapper;
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -48,21 +53,14 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
/**
|
/**
|
||||||
* 出入库mapper服务
|
* 出入库mapper服务
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Resource
|
||||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||||
|
@Resource
|
||||||
/**
|
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||||
* 物料基础服务
|
@Resource
|
||||||
*/
|
private IOStorInvMapper ioStorInvMapper;
|
||||||
@Autowired
|
@Resource
|
||||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
private PmFormDataMapper pmFormDataMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 计量单位服务
|
|
||||||
*/
|
|
||||||
@Autowired
|
|
||||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WMS调用ERP服务类
|
* WMS调用ERP服务类
|
||||||
*/
|
*/
|
||||||
@@ -106,61 +104,39 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// 查询所有物料
|
|
||||||
List<MdMeMaterialbase> materList = iMdMeMaterialbaseService.list(
|
|
||||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
|
||||||
.in(MdMeMaterialbase::getMaterial_id, iosDisList.stream()
|
|
||||||
.map(IOStorInvDis::getMaterial_id)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList())
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// 查询所有计量单位
|
|
||||||
List<MdPbMeasureunit> unitList = iMdPbMeasureunitService.list(
|
|
||||||
new QueryWrapper<MdPbMeasureunit>().lambda()
|
|
||||||
.in(MdPbMeasureunit::getMeasure_unit_id, iosDisList.stream()
|
|
||||||
.map(IOStorInvDis::getQty_unit_id)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList()))
|
|
||||||
);
|
|
||||||
|
|
||||||
// 需回传数据集合
|
|
||||||
List<JSONObject> paramList = new ArrayList<>();
|
|
||||||
for(IOStorInvDis disDao : iosDisList) {
|
for(IOStorInvDis disDao : iosDisList) {
|
||||||
|
IOStorInv mst = ioStorInvMapper.selectById(disDao.getIostorinv_id());
|
||||||
|
IOStorInvDtl dtl = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
// 物料编码
|
//入库
|
||||||
MdMeMaterialbase materDao = materList.stream()
|
if("0".equals(mst.getIo_type())){
|
||||||
.filter(row -> row.getMaterial_id().equals(disDao.getMaterial_id()))
|
// 载具编码
|
||||||
.findFirst().orElse(null);
|
param.put("pallet_sn", disDao.getStoragevehicle_code());
|
||||||
param.put("mater_code", materDao.getMaterial_code());
|
param.put("instor_time", mst.getConfirm_time());
|
||||||
// 批次
|
wmsToErpService.instorinfoToErp(param);
|
||||||
param.put("batch_no", disDao.getPcsn());
|
}else {//出
|
||||||
// 数量
|
//如果是用料出库,则需回传
|
||||||
param.put("quantity", disDao.getReal_qty());
|
if(ObjectUtil.isNotEmpty(dtl.getSource_bill_code())){
|
||||||
// 计量单位
|
//判断用料清单是否合单
|
||||||
MdPbMeasureunit unitDao = unitList.stream()
|
PmFormData pmform = pmFormDataMapper.selectById(dtl.getSource_billdtl_id());
|
||||||
.filter(row -> row.getMeasure_unit_id().equals(disDao.getQty_unit_id()))
|
if("0".equals(pmform.getNew_merge_flag())){
|
||||||
.findFirst().orElse(null);
|
// 载具编码
|
||||||
param.put("unit_code", unitDao.getUnit_code());
|
param.put("pallet_sn", disDao.getStoragevehicle_code());
|
||||||
// 仓库编码
|
// 数量
|
||||||
JSONObject jsonMst = rows.stream()
|
param.put("qty", disDao.getReal_qty());
|
||||||
.filter(row -> row.getString("iostorinv_id").equals(disDao.getIostorinv_id()))
|
// 单据号
|
||||||
.findFirst().orElse(null);
|
param.put("order_code", dtl.getSource_bill_code());
|
||||||
param.put("stor_code", jsonMst.getString("stor_code"));
|
// 业务类型
|
||||||
// 货位编码
|
param.put("order_type", dtl.getSource_bill_type());
|
||||||
param.put("point_code", disDao.getStruct_code());
|
// 业务类型
|
||||||
// 载具编码
|
param.put("outstor_time", mst.getConfirm_time());
|
||||||
param.put("pallet_code", disDao.getStoragevehicle_code());
|
}else{//合单
|
||||||
// 单据号
|
|
||||||
param.put("inv_code", jsonMst.getString("source_id"));
|
}
|
||||||
// 业务类型
|
wmsToErpService.outstorinfoToErp(param);
|
||||||
param.put("task_type", jsonMst.getString("source_type"));
|
}
|
||||||
paramList.add(param);
|
}
|
||||||
}
|
}
|
||||||
JSONObject jsonParam = new JSONObject();
|
|
||||||
jsonParam.put("data", paramList);
|
|
||||||
wmsToErpService.instorinfoToErp(jsonParam);
|
|
||||||
|
|
||||||
// 更新主表
|
// 更新主表
|
||||||
this.update(
|
this.update(
|
||||||
|
|||||||
Reference in New Issue
Block a user