add:添加线边库领料,添加MES查询工单bom
This commit is contained in:
@@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
})
|
||||
@ServletComponentScan
|
||||
@EnableTransactionManagement
|
||||
@EnableCaching
|
||||
@MapperScan("org.nl.**.mapper")
|
||||
public class AppRun implements ApplicationRunner {
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -43,8 +44,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -52,7 +52,6 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@ConditionalOnClass(RedisOperations.class)
|
||||
@EnableConfigurationProperties(RedisProperties.class)
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
@@ -69,7 +68,18 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofHours(6));
|
||||
return configuration;
|
||||
}
|
||||
@Bean
|
||||
public RedisCacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
|
||||
Set<String> cachePackage = new HashSet<String>();
|
||||
cachePackage.add("sectType");
|
||||
RedisCacheManager cacheManager = RedisCacheManager.builder(redisConnectionFactory)
|
||||
.cacheDefaults(redisCacheConfiguration())
|
||||
.initialCacheNames(cachePackage) // 关键:初始化缓存空间
|
||||
.build();
|
||||
|
||||
log.info("初始化 RedisCacheManager,缓存空间:sectType");
|
||||
return cacheManager;
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
@Bean(name = "redisTemplate")
|
||||
@ConditionalOnMissingBean(name = "redisTemplate")
|
||||
|
||||
@@ -52,4 +52,8 @@ public interface IMdPbStoragevehicleinfoService extends IService<MdPbStoragevehi
|
||||
* @return 实体类
|
||||
*/
|
||||
MdPbStoragevehicleinfo getByCode(String storagevehicle_code);
|
||||
|
||||
|
||||
|
||||
String getVehicleType(String storagevehicleCode);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
@@ -136,4 +137,16 @@ public class MdPbStoragevehicleinfoServiceImpl extends ServiceImpl<MdPbStorageve
|
||||
}
|
||||
return one;
|
||||
}
|
||||
|
||||
|
||||
public String getVehicleType(String storagevehicleCode) {
|
||||
if (StringUtils.isEmpty(storagevehicleCode)){
|
||||
throw new BadRequestException("查询托盘类型报错,托盘号不能为空");
|
||||
}
|
||||
MdPbStoragevehicleinfo one = this.getOne(new LambdaQueryWrapper<MdPbStoragevehicleinfo>()
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicleCode)
|
||||
.select(MdPbStoragevehicleinfo::getStoragevehicle_type)
|
||||
);
|
||||
return one.getStoragevehicle_type();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
@CacheEvict(value = "baseConfig", key = "'allSectType'")
|
||||
public void create(Sectattr dto) {
|
||||
Sectattr sectattr = sectattrMapper.selectOne(new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.eq(Sectattr::getSect_id, dto.getSect_code())
|
||||
@@ -115,7 +115,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
@CacheEvict(value = "baseConfig", key = "'allSectType'")
|
||||
public void update(Sectattr dto) {
|
||||
Sectattr entity = this.findById(dto.getSect_id());
|
||||
if (entity == null) {
|
||||
@@ -141,7 +141,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
@CacheEvict(value = "baseConfig", key = "'allSectType'")
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
@@ -309,7 +309,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
);
|
||||
}
|
||||
@Override
|
||||
@Cacheable(value = "sectType", key = "'allSectType'")
|
||||
@Cacheable(value = "baseConfig", key = "'allSectType'")
|
||||
public Map<String, List<String>> getSectType() {
|
||||
final List<Sectattr> list = this.list(new LambdaQueryWrapper<Sectattr>()
|
||||
.eq(Sectattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.nl.wms.ext_manage.mes.service;
|
||||
|
||||
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MesApiService {
|
||||
|
||||
List<WorkOrderBomItem> workOrderMaterialList(String workOrder);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.ext_manage.mes.service;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MesResponse<T> {
|
||||
/**
|
||||
* 备料清单列表
|
||||
*/
|
||||
private T Result;
|
||||
/**
|
||||
* 消息类型:0-成功,其他-失败
|
||||
*/
|
||||
private Integer ResultCode;
|
||||
/**
|
||||
* 消息文本
|
||||
*/
|
||||
private String Message;
|
||||
|
||||
/**
|
||||
* 用户数据
|
||||
*/
|
||||
private Object UserData;
|
||||
|
||||
/**
|
||||
* 判断是否成功
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
return ResultCode != null && ResultCode == 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package org.nl.wms.ext_manage.mes.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class WorkOrderBomItem {
|
||||
/**
|
||||
* 单据分录ID
|
||||
*/
|
||||
private String ItemId;
|
||||
|
||||
/**
|
||||
* 单据分录行号
|
||||
*/
|
||||
private String ItemNo;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String MaterialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String MaterialName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String Spec;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String Unit;
|
||||
|
||||
/**
|
||||
* 基本计量单位
|
||||
*/
|
||||
private String BaseUnit;
|
||||
|
||||
/**
|
||||
* 单位用量
|
||||
*/
|
||||
private BigDecimal BomQty;
|
||||
|
||||
/**
|
||||
* 领料部门
|
||||
*/
|
||||
private String DeptCode;
|
||||
|
||||
/**
|
||||
* 供货库存组织
|
||||
*/
|
||||
private String SupOrgCode;
|
||||
|
||||
/**
|
||||
* 领料仓库
|
||||
*/
|
||||
private String WarehouseCode;
|
||||
|
||||
/**
|
||||
* 领料仓库名称
|
||||
*/
|
||||
private String WarehouseName;
|
||||
|
||||
/**
|
||||
* 生产工单
|
||||
*/
|
||||
private String WorkOrderCode;
|
||||
|
||||
/**
|
||||
* 跟踪号
|
||||
*/
|
||||
private String TrackNo;
|
||||
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
private String WorkCenter;
|
||||
|
||||
/**
|
||||
* 加载端口
|
||||
*/
|
||||
private String LoadPort;
|
||||
|
||||
/**
|
||||
* 库管员编码
|
||||
*/
|
||||
private String StockerCode;
|
||||
|
||||
/**
|
||||
* 库管员名称
|
||||
*/
|
||||
private String StockerName;
|
||||
|
||||
/**
|
||||
* 生产线点位
|
||||
*/
|
||||
private String LinePod;
|
||||
|
||||
/**
|
||||
* BOM属性1
|
||||
*/
|
||||
private String BomProp1;
|
||||
|
||||
/**
|
||||
* BOM属性2
|
||||
*/
|
||||
private String BomProp2;
|
||||
|
||||
/**
|
||||
* BOM属性3
|
||||
*/
|
||||
private String BomProp3;
|
||||
|
||||
/**
|
||||
* 扩展属性01
|
||||
*/
|
||||
private Object Attr01;
|
||||
|
||||
/**
|
||||
* 扩展属性02
|
||||
*/
|
||||
private Object Attr02;
|
||||
|
||||
/**
|
||||
* 扩展属性03
|
||||
*/
|
||||
private Object Attr03;
|
||||
|
||||
/**
|
||||
* 扩展属性04
|
||||
*/
|
||||
private Object Attr04;
|
||||
|
||||
/**
|
||||
* 扩展属性05
|
||||
*/
|
||||
private Object Attr05;
|
||||
|
||||
/**
|
||||
* 扩展属性06
|
||||
*/
|
||||
private Object Attr06;
|
||||
|
||||
/**
|
||||
* WMS数量
|
||||
*/
|
||||
private BigDecimal WmsQty;
|
||||
|
||||
/**
|
||||
* EAS5数量
|
||||
*/
|
||||
private BigDecimal Eas5Qty;
|
||||
|
||||
/**
|
||||
* EAS4数量
|
||||
*/
|
||||
private BigDecimal Eas4Qty;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String Id;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.wms.ext_manage.mes.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.ext_manage.mes.service.MesApiService;
|
||||
import org.nl.wms.ext_manage.mes.service.MesResponse;
|
||||
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MesApiServiceImpl implements MesApiService {
|
||||
|
||||
@Override
|
||||
public List<WorkOrderBomItem> workOrderMaterialList(String workOrder){
|
||||
final Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.MES_URL);
|
||||
if (param ==null){
|
||||
throw new BadRequestException("请传MES失败,未配置MES_URL地址");
|
||||
}
|
||||
String url = param.getValue();
|
||||
// TODO: add demand order API path to EXTConstant once endpoint is confirmed
|
||||
try {
|
||||
JSONObject requestParam = new JSONObject();
|
||||
requestParam.put("OrderCode",workOrder);
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(requestParam.toJSONString())
|
||||
.execute().body();
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
MesResponse<List<WorkOrderBomItem>> response = result.toJavaObject(MesResponse.class);
|
||||
if (!response.isSuccess()){
|
||||
throw new BadRequestException("请求MES API失败"+result.getString("Message"));
|
||||
}
|
||||
return response.getResult();
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||
@@ -28,8 +29,11 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
||||
public JSONObject uploadErp(JSONObject whereJson) {
|
||||
log.info("uploadErp回传接口输入参数为:-------------------" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ERP_URL).getValue();
|
||||
final Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ERP_URL);
|
||||
if (param==null){
|
||||
throw new BadRequestException("回传ERP失败,未配置erp_url地址");
|
||||
}
|
||||
String url = param.getValue();
|
||||
url = url + EXTConstant.UPLOAD_ERP_API;
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pda_manage.ios_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pda_manage.outBound.dto.LineSideDto;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ public interface PdaIosOutService {
|
||||
|
||||
|
||||
/**
|
||||
* 线边库物料出库确认
|
||||
* 线边库物料直接领料出库确认
|
||||
*
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具码
|
||||
@@ -55,7 +56,7 @@ public interface PdaIosOutService {
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse materialConfirm(JSONObject whereJson);
|
||||
PdaResponse directConfirm(LineSideDto whereJson);
|
||||
|
||||
/**
|
||||
* 货架与站点绑定或解绑
|
||||
|
||||
@@ -443,7 +443,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonMst.put("total_qty", total_qty);
|
||||
jsonMst.put("detail_count", 1);
|
||||
jsonMst.put("bill_type", StatusEnum.IOBILL_TYPE_IN.code("生产入库"));
|
||||
jsonMst.put("bill_type", IOSEnum.BILL_TYPE.code("生产入库"));
|
||||
jsonMst.put("biz_date", DateUtil.now());
|
||||
// 组织明细数据
|
||||
ArrayList<HashMap> tableData = new ArrayList<>();
|
||||
|
||||
@@ -21,11 +21,11 @@ import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.pda_manage.outBound.dto.LineSideDto;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
@@ -38,6 +38,7 @@ import org.nl.wms.sch_manage.service.util.tasks.VehicleOutTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
@@ -47,6 +48,9 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMappe
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper;
|
||||
import org.nl.wms.warehouse_manage.service.util.UpdateIvtUtils;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -77,13 +81,20 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
* 组盘记录mapper
|
||||
*/
|
||||
@Autowired
|
||||
private MdPbGroupplateMapper mdPbGroupplateMapper;
|
||||
private MdPbGroupplateMapper mdPbGroupplateMapper; /**
|
||||
* 组盘记录mapper
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
/**
|
||||
* 库区服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISectattrService iSectattrService;
|
||||
|
||||
@Autowired
|
||||
private IPmStockReturnService iPmStockReturnService;
|
||||
|
||||
/**
|
||||
* 出入库单主表
|
||||
*/
|
||||
@@ -100,11 +111,6 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
*/
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||
/**
|
||||
* 载具扩展属性服务
|
||||
*/
|
||||
@Autowired
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
@@ -151,7 +157,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
|
||||
@Override
|
||||
public PdaResponse getDtl(JSONObject whereJson) {
|
||||
return PdaResponse.requestParamOk(mdPbStoragevehicleextMapper.getIosDtl(whereJson));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,50 +184,49 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse materialConfirm(JSONObject whereJson) {
|
||||
public PdaResponse directConfirm(LineSideDto lineSideDto) {
|
||||
//创建出库单/明细/分配
|
||||
GroupPlate plateDao = mdPbGroupplateMapper.selectOne(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")));
|
||||
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, whereJson.getString("struct_code")));
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_code());
|
||||
whereJson.put("material_id", materDao.getMaterial_id());
|
||||
whereJson.put("material_code", materDao.getMaterial_code());
|
||||
whereJson.put("store_id", sectDao.getStor_id());
|
||||
whereJson.put("store_code", sectDao.getStor_code());
|
||||
whereJson.put("store_name", sectDao.getStor_name());
|
||||
whereJson.put("sec", sectDao.getSect_id());
|
||||
whereJson.put("qty", plateDao.getQty());
|
||||
whereJson.put("pcsn", plateDao.getPcsn());
|
||||
whereJson.put("unit_id", plateDao.getQty_unit_id());
|
||||
whereJson.put("unit_name", plateDao.getQty_unit_name());
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(lineSideDto.getMaterialCode());
|
||||
final GroupPlate group = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getMaterial_code, lineSideDto.getMaterialCode())
|
||||
.eq(GroupPlate::getStoragevehicle_code, lineSideDto.getStorageVehicleCode()));
|
||||
if (group ==null){
|
||||
throw new BadRequestException("物料库存信息不存在");
|
||||
}
|
||||
final Structattr struct = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStoragevehicle_code, lineSideDto.getStorageVehicleCode()));
|
||||
if (struct ==null){
|
||||
throw new BadRequestException("当前虚拟仓库未绑定"+lineSideDto.getStorageVehicleCode());
|
||||
}
|
||||
JSONObject outBillParam = new JSONObject();
|
||||
outBillParam.put("materialId", materDao.getMaterial_id());
|
||||
outBillParam.put("materialCode", materDao.getMaterial_code());
|
||||
outBillParam.put("stor_id", struct.getStor_id());
|
||||
outBillParam.put("sourceBillCode", lineSideDto.getWorkOrder());
|
||||
outBillParam.put("sourceBillType", "work_order");
|
||||
outBillParam.put("storCode", struct.getSect_code());
|
||||
outBillParam.put("storName", struct.getStor_name());
|
||||
outBillParam.put("sectCode", struct.getSect_code());
|
||||
outBillParam.put("sectId", struct.getSect_id());
|
||||
outBillParam.put("qty", lineSideDto.getQty());
|
||||
outBillParam.put("pcsn", group.getPcsn());
|
||||
outBillParam.put("unitId", materDao.getQty_unit_id());
|
||||
outBillParam.put("unitName", materDao.getQty_unit_name());
|
||||
outBillParam.put("storagevehicleCode", lineSideDto.getStorageVehicleCode());
|
||||
//创建出库单据
|
||||
String disId = createOutBills(whereJson);
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", whereJson.getString("struct_code"));
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
//创建任务
|
||||
JSONObject taskForm = new JSONObject();
|
||||
taskForm.put("task_type", "STOutTask");
|
||||
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskForm.put("PickingLocation", whereJson.getString("struct_code"));
|
||||
taskForm.put("PlacedLocation", whereJson.getString("siteCode"));
|
||||
taskForm.put("vehicle_code", whereJson.getString("storagevehicle_code"));
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
String taskId = stOutTask.create(taskForm);
|
||||
//更新任务id
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
.set(IOStorInvDis::getTask_id, taskId)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, disId)
|
||||
);
|
||||
createOutBills(outBillParam);
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getFrozen_qty, plateDao.getQty())
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"))
|
||||
.set(GroupPlate::getQty,group.getQty().subtract(lineSideDto.getQty()))
|
||||
.eq(GroupPlate::getGroup_id, group.getGroup_id())
|
||||
);
|
||||
//TODO:生成手工领料单
|
||||
final PmStockReturn stockReturn = new PmStockReturn();
|
||||
stockReturn.setCreate_time(DateUtil.now());
|
||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode());
|
||||
stockReturn.setRequest_data(outBillParam.toJSONString());
|
||||
iPmStockReturnService.save(stockReturn);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@@ -330,40 +335,39 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("io_type", IOSEnum.IO_TYPE.code("出库"));
|
||||
io_mst.put("bill_type", StatusEnum.IOBILL_TYPE_OUT.code("生产出库"));
|
||||
io_mst.put("biz_date", now.substring(0, 10));
|
||||
io_mst.put("stor_id", whereJson.get("store_id"));
|
||||
io_mst.put("stor_code", whereJson.get("store_code"));
|
||||
io_mst.put("stor_name", whereJson.get("store_name"));
|
||||
io_mst.put("bill_type", IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
io_mst.put("biz_date", DateUtil.today());
|
||||
io_mst.put("stor_id", whereJson.get("storId"));
|
||||
io_mst.put("stor_code", whereJson.get("storCode"));
|
||||
io_mst.put("stor_Name", whereJson.get("storName"));
|
||||
io_mst.put("detail_count", 1);
|
||||
io_mst.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
||||
io_mst.put("input_optid", currentUserId + "");
|
||||
io_mst.put("bill_status", IOSEnum.BILL_STATUS.code("完成"));
|
||||
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("终端产生"));
|
||||
io_mst.put("input_optid", currentUserId);
|
||||
io_mst.put("input_optname", nickName);
|
||||
io_mst.put("input_time", now);
|
||||
io_mst.put("update_optid", currentUserId + "");
|
||||
io_mst.put("update_optid", currentUserId);
|
||||
io_mst.put("update_optname", nickName);
|
||||
io_mst.put("update_time", now);
|
||||
io_mst.put("is_delete", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
io_mst.put("is_upload", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
io_mst.put("sysdeptid", deptId + "");
|
||||
io_mst.put("syscompanyid", deptId + "");
|
||||
io_mst.put("qty", whereJson.get("store_code"));
|
||||
io_mst.put("qty", whereJson.get("qty"));
|
||||
ioStorInvMapper.insert(io_mst.toJavaObject(IOStorInv.class));
|
||||
//明细
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", "1");
|
||||
ioStorInvDtl.put("material_id", whereJson.get("material_id"));
|
||||
ioStorInvDtl.put("material_code", whereJson.get("material_code"));
|
||||
ioStorInvDtl.put("Pcsn", whereJson.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
ioStorInvDtl.put("qty_unit_id", whereJson.get("unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name", whereJson.get("unit_name"));
|
||||
ioStorInvDtl.put("material_id", whereJson.get("materialId"));
|
||||
ioStorInvDtl.put("material_code", whereJson.get("materialCode"));
|
||||
ioStorInvDtl.put("pcsn", whereJson.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtl.put("qty_unit_id", whereJson.get("unitId"));
|
||||
ioStorInvDtl.put("qty_unit_name", whereJson.get("unitName"));
|
||||
ioStorInvDtl.put("assign_qty", whereJson.get("qty"));
|
||||
ioStorInvDtl.put("unassign_qty", "0");
|
||||
ioStorInvDtl.put("source_bill_code", whereJson.getString("sourceBillCode"));
|
||||
ioStorInvDtl.put("source_bill_type", whereJson.getString("sourceBillType"));
|
||||
ioStorInvDtl.put("plan_qty", whereJson.get("qty"));
|
||||
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class));
|
||||
//分配
|
||||
@@ -373,14 +377,14 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
dis.put("iostorinv_id", iostorinv_id);
|
||||
dis.put("iostorinvdtl_id", ioStorInvDtl.getString("iostorinvdtl_id"));
|
||||
dis.put("seq_no", 1);
|
||||
dis.put("material_id", whereJson.get("material_id"));
|
||||
dis.put("material_code", whereJson.get("material_code"));
|
||||
dis.put("material_id", whereJson.get("materialId"));
|
||||
dis.put("material_code", whereJson.get("materialCode"));
|
||||
dis.put("pcsn", whereJson.get("pcsn"));
|
||||
dis.put("storagevehicle_code", whereJson.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", whereJson.get("unit_id"));
|
||||
dis.put("qty_unit_name", whereJson.get("unit_name"));
|
||||
dis.put("storagevehicle_code", whereJson.get("storagevehicleCode"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("完成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.put("qty_unit_id", whereJson.get("unitId"));
|
||||
dis.put("qty_unit_name", whereJson.get("unitName"));
|
||||
dis.put("plan_qty", whereJson.get("qty"));
|
||||
ioStorInvDisMapper.insert(dis.toJavaObject(IOStorInvDis.class));
|
||||
return disId;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package org.nl.wms.pda_manage.ios_manage.controller;
|
||||
package org.nl.wms.pda_manage.outBound;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.pda_manage.outBound.dto.LineSideDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -65,11 +67,11 @@ public class PdaIosOutController {
|
||||
/**
|
||||
* 线边库物料出库确认
|
||||
*/
|
||||
@PostMapping("/materialConfirm")
|
||||
@Log("线边库物料出库确认")
|
||||
public ResponseEntity<Object> materialConfirm(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "group_id", "storagevehicle_code", "siteCode", "struct_code");
|
||||
return new ResponseEntity<>(pdaIosOutService.materialConfirm(whereJson), HttpStatus.OK);
|
||||
@PostMapping("/lineSideIssuance")
|
||||
@Log("装配线边库线边直接领料")
|
||||
public ResponseEntity<Object> lineSideIssuance(@RequestBody LineSideDto lineSideDto) {
|
||||
pdaIosOutService.directConfirm(lineSideDto);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.pda_manage.outBound.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class LineSideDto {
|
||||
private String workOrder;
|
||||
private String materialCode;
|
||||
/**
|
||||
* 线边库都是虚拟容器
|
||||
*/
|
||||
private String storageVehicleCode;
|
||||
private BigDecimal qty;
|
||||
}
|
||||
@@ -42,7 +42,6 @@ public class PmDemandController {
|
||||
|
||||
@PutMapping
|
||||
@Log("修改需求单")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> update(@Valid @RequestBody PmDemandParam param) {
|
||||
pmDemandService.update(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
package org.nl.wms.pm_manage.demand.listenerHandler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
||||
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
|
||||
import org.nl.wms.pm_manage.listener.core.BaseFormListenerHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("pm_demand")
|
||||
public class DemandFormListenerHandler extends BaseFormListenerHandler<DemandListenerParams> {
|
||||
@Autowired
|
||||
IPmDemandService iPmDemandService;
|
||||
@Override
|
||||
public void onApplicationEvent(DemandListenerParams params) {
|
||||
|
||||
iPmDemandService.update(new LambdaUpdateWrapper<PmDemand>()
|
||||
.set(PmDemand::getAssign_qty,params.getQty())
|
||||
.set(PmDemand::getStatus, DemandStatus.DORETURN.getValue())
|
||||
.eq(PmDemand::getId,params.getBillCode())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class PmDemand extends Model<PmDemand> {
|
||||
private String sku_name;
|
||||
|
||||
private BigDecimal qty;
|
||||
private BigDecimal assign_qty;
|
||||
|
||||
private String unit;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<result property="skuCode" column="sku_code"/>
|
||||
<result property="skuName" column="sku_name"/>
|
||||
<result property="qty" column="qty"/>
|
||||
<result property="assignQty" column="assign_qty"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="targetArea" column="target_area"/>
|
||||
<result property="productionLine" column="production_line"/>
|
||||
|
||||
@@ -18,6 +18,7 @@ public class PmDemandDto implements Serializable {
|
||||
private String skuCode;
|
||||
private String skuName;
|
||||
private Integer qty;
|
||||
private Integer assignQty;
|
||||
private String unit;
|
||||
private String targetArea;
|
||||
private String productionLine;
|
||||
|
||||
@@ -19,66 +19,51 @@ import java.math.BigDecimal;
|
||||
public class PmDemandParam {
|
||||
|
||||
@NotBlank(message = "单据唯一ID不能为空")
|
||||
@JsonProperty("Id")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "操作人不能为空")
|
||||
@JsonProperty("Creator")
|
||||
private String creator;
|
||||
|
||||
@NotBlank(message = "需求日期不能为空")
|
||||
@JsonProperty("CreateTime")
|
||||
private String createTime;
|
||||
|
||||
@NotNull(message = "优先级不能为空")
|
||||
@JsonProperty("Priority")
|
||||
private Integer priority;
|
||||
|
||||
@JsonProperty("Status")
|
||||
private String status;
|
||||
|
||||
@NotBlank(message = "工单编号不能为空")
|
||||
@JsonProperty("WorkOrder")
|
||||
private String workOrder;
|
||||
|
||||
@NotBlank(message = "物料编码不能为空")
|
||||
@JsonProperty("SkuCode")
|
||||
private String skuCode;
|
||||
|
||||
@NotBlank(message = "物料名称不能为空")
|
||||
@JsonProperty("SkuName")
|
||||
private String skuName;
|
||||
|
||||
@NotNull(message = "数量不能为空")
|
||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||
@JsonProperty("Qty")
|
||||
private BigDecimal qty;
|
||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||
private BigDecimal assignQty;
|
||||
|
||||
@NotBlank(message = "单位不能为空")
|
||||
@JsonProperty("Unit")
|
||||
private String unit;
|
||||
|
||||
@NotBlank(message = "目标库存地点不能为空")
|
||||
@JsonProperty("TargetArea")
|
||||
private String targetArea;
|
||||
|
||||
@NotBlank(message = "产线不能为空")
|
||||
@JsonProperty("ProductionLine")
|
||||
private String productionLine;
|
||||
|
||||
@JsonProperty("SN")
|
||||
private String sn;
|
||||
|
||||
@JsonProperty("MaxLoad")
|
||||
private String maxLoad;
|
||||
|
||||
@NotBlank(message = "目标仓别不能为空")
|
||||
@JsonProperty("TargetHouseCode")
|
||||
private String targetHouseCode;
|
||||
|
||||
@JsonProperty("BatchNo")
|
||||
private String batchNo;
|
||||
|
||||
@JsonProperty("Remark")
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ public enum DemandStatus {
|
||||
DIS("01","分配"),
|
||||
SEND("10","下发"),
|
||||
RUN("20","执行"),
|
||||
FINISH("80","完成"),
|
||||
DORETURN("50","待回传"),
|
||||
RETURN_FAIL("70","回传失败"),
|
||||
FINISH("80","回传完成"),
|
||||
CANCEL("90","取消"),
|
||||
;
|
||||
private String value;
|
||||
|
||||
@@ -25,6 +25,8 @@ import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
|
||||
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
|
||||
@@ -111,6 +113,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
demand.setSku_code(param.getSkuCode());
|
||||
demand.setSku_name(param.getSkuName());
|
||||
demand.setQty(param.getQty());
|
||||
demand.setAssign_qty(param.getAssignQty());
|
||||
demand.setUnit(param.getUnit());
|
||||
demand.setTarget_area(param.getTargetArea());
|
||||
demand.setProduction_line(param.getProductionLine());
|
||||
@@ -211,7 +214,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
JSONObject billParam = new JSONObject();
|
||||
billParam.put("stor_code", inventoryDis.getString("horseCode"));
|
||||
billParam.put("biz_date", DateUtil.today());
|
||||
billParam.put("bill_type", "010201");
|
||||
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
billParam.put("remark", "需求单下推生成");
|
||||
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
@@ -231,16 +234,13 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
detailRow.put("qty_unit_name", demand.getUnit());
|
||||
detailRow.put("qty_unit_id", codeToIdMap.get(demand.getSkuCode()).getQty_unit_id());
|
||||
detailRow.put("qty", demand.getQty());
|
||||
detailRow.put("source_bill_code", demand.getWorkOrder());
|
||||
detailRow.put("source_bill_type", "PM_DEMAND");
|
||||
detailRow.put("source_bill_code", demand.getId());
|
||||
detailRow.put("source_bill_type", "pm_demand");
|
||||
detailRow.put("source_billdtl_id", demand.getId());
|
||||
detailRow.put("remark", "需求单:" + demand.getId());
|
||||
|
||||
detailRow.put("remark", "关联工单:" + demand.getWorkOrder());
|
||||
tableData.add(detailRow);
|
||||
}
|
||||
|
||||
billParam.put("tableData", tableData);
|
||||
|
||||
return billParam;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class SmartFormListener implements ApplicationListener<PmManageEvent> {
|
||||
System.out.println("======="+billTypeEnum.getBillType()+"单据类型没有定义监听处理机=======");
|
||||
return;
|
||||
}
|
||||
handler.onApplicationEvent(event);
|
||||
handler.onApplicationEvent(event.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ public class SchBasePointController {
|
||||
|
||||
@GetMapping("/getRegionPoints")
|
||||
@Log("获取区域下拉点")
|
||||
public ResponseEntity<Object> getRegionPoints(String region_code) {
|
||||
SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaUpdateWrapper<SchBaseRegion>().eq(SchBaseRegion::getRegion_code, region_code));
|
||||
|
||||
public ResponseEntity<Object> getRegionPoints(String regionCode) {
|
||||
SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaUpdateWrapper<SchBaseRegion>()
|
||||
.eq(SchBaseRegion::getRegion_code, regionCode));
|
||||
HashMap parent = MapOf.of("value", region.getRegion_code(), "label", region.getRegion_name());
|
||||
List<SchBasePoint> points = schBasePointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, region_code));
|
||||
.eq(SchBasePoint::getRegion_code, regionCode));
|
||||
List<Object> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(points)){
|
||||
for (SchBasePoint point : points) {
|
||||
|
||||
@@ -46,7 +46,8 @@ public enum StatusEnum {
|
||||
ERP_TYPE(ForkMap.of("PRD_MO", "10", "生产订单", "PUR_ReceiveBill", "11", "收料通知单",
|
||||
"SAL_SaleOrder", "12", "销售订单", "PRD_INSTOCK", "13", "生产入库单", "STK_InStock", "14", "采购入库单",
|
||||
"SAL_RETURNSTOCK", "15", "销售退货入库单", "PUR_MRB", "18", "采购退料出库单",
|
||||
"SUB_PickMtrl", "19", "委外用料清单", "PRD_PPBOM", "20", "生产用料清单", "PRD_PickMtrl", "21", "生产领料单",
|
||||
"SUB_PickMtrl", "19", "委外用料清单", "PRD_PPBOM", "20", "生产用料清单", "PRD_PickMtrl", "21", "" +
|
||||
"生产领料单",
|
||||
"SP_PickMtrl", "22", "简单生产领料单", "STK_TransferDirect", "23", "调拨出库单", "STK_MisDelivery", "26", "其他出库单", "PRD_ReturnMtrl", "27", "生产退料单", "PRD_FeedMtrl", "28", "生产补料单", "SUB_RETURNMTRL", "29", "委外退料单")),
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,5 +26,9 @@ public class SysParamConstant {
|
||||
* 中鼎系统URL
|
||||
*/
|
||||
public final static String ZD_URL = "zd_url";
|
||||
/**
|
||||
* MES URL
|
||||
*/
|
||||
public final static String MES_URL = "mes_url";
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.constantt.DictConstantPool;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class OutBillController {
|
||||
}
|
||||
|
||||
@PostMapping("/allSetPoint")
|
||||
@Log("一键设置")
|
||||
@Log("一键下发AGV搬运")
|
||||
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.allSetPoint(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
||||
@@ -132,7 +132,12 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
|
||||
/**
|
||||
* 设置全部站点
|
||||
*
|
||||
* String task_id = stOutTask.create(task_form);
|
||||
* ioStorInvDisMapper.update(null,new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
* .set(IOStorInvDis::getTask_id,task_id)
|
||||
* .set(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
* .set(IOStorInvDis::getPoint_code,pointCode)
|
||||
* .set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
* @param whereJson /
|
||||
*/
|
||||
void allSetPoint(JSONObject whereJson);
|
||||
|
||||
@@ -21,11 +21,15 @@ import org.nl.common.utils.IdUtil;;
|
||||
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.IMdPbStoragevehicleinfoService;
|
||||
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.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.*;
|
||||
import org.nl.wms.pm_manage.demand.listenerHandler.DemandListenerParams;
|
||||
import org.nl.wms.pm_manage.listener.PmManageEvent;
|
||||
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;
|
||||
@@ -35,10 +39,10 @@ import org.nl.wms.sch_manage.service.util.tasks.StOutTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.AddInvParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisReverseParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutFinishParam;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
@@ -51,6 +55,7 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -76,11 +81,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Resource
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 载具扩展属性mapper
|
||||
*/
|
||||
@Resource
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
@@ -102,6 +102,14 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
private IMdPbGroupplateService iMdPbGroupPlateService;
|
||||
@Autowired
|
||||
private IStInventoryService iStInventoryService;
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
@Autowired
|
||||
private ISectattrService iSectattrService;
|
||||
@Autowired
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
@Autowired
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -280,6 +288,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
map.put("io_type", IOSEnum.IO_TYPE.code("出库"));
|
||||
map.put("detail_count", array.size() + "");
|
||||
map.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
||||
map.put("bill_type", map.getString("bill_type"));
|
||||
map.put("stor_code", bsrealStorattr.getStor_code());
|
||||
map.put("stor_name", bsrealStorattr.getStor_name());
|
||||
map.put("input_optid", currentUserId);
|
||||
@@ -463,8 +472,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
public void allCancel(JSONObject whereJson) {
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.isNull(IOStorInvDis::getTask_id)
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDisList)){
|
||||
@@ -635,8 +645,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.isNull(IOStorInvDis::getTask_id)
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,whereJson.getString("iostorinvdtl_id"))
|
||||
);
|
||||
@@ -645,12 +656,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
//需要更新的出入库单明细
|
||||
Set<String> dtlSet = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
|
||||
//添加需要更新的明细标识
|
||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -663,7 +671,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
|
||||
//解锁库位
|
||||
JSONObject unlock_map = new JSONObject();
|
||||
unlock_map.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
@@ -671,7 +678,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
unlock_map.put("inv_id", null);
|
||||
unlock_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2",unlock_map);
|
||||
|
||||
//删除出入库单分配表
|
||||
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
|
||||
|
||||
@@ -713,16 +719,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void manualDiv(JSONObject whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject row = whereJson.getJSONObject("row");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
|
||||
String iostorinv_id = row.getString("iostorinv_id");
|
||||
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
@@ -738,6 +740,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(dtls)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
List<String> flatWarehouse = iSectattrService.getSectType()
|
||||
.getOrDefault(IOSEnum.ST_SECT_TYPE.code("平库"),Collections.emptyList());
|
||||
|
||||
for (IOStorInvDtlDto dtl:dtls){
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
if (unassign_qty.intValue() <= 0){
|
||||
@@ -754,7 +759,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// BigDecimal frozen_qty = ivt.getBigDecimal("frozen_qty");
|
||||
//库存分配数:为负数
|
||||
BigDecimal change_qty = ivt.getBigDecimal("change_qty");
|
||||
//分配明细
|
||||
//生成分配明细
|
||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
||||
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
|
||||
@@ -766,7 +771,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
|
||||
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
|
||||
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
|
||||
//判断是不是平库
|
||||
//判断是不是平库,是平库则变成生成状态
|
||||
final boolean flat = flatWarehouse.contains(ivt.getString("sect_code"));
|
||||
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
|
||||
ioStorInvDis.setStruct_name(ivt.getString("struct_name"));
|
||||
ioStorInvDis.setStruct_code(ivt.getString("struct_code"));
|
||||
@@ -774,7 +780,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
ioStorInvDis.setWork_status(flat?
|
||||
IOSEnum.INBILL_DIS_STATUS.code("生成")
|
||||
:IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
unassign_qty = unassign_qty.subtract(change_qty);
|
||||
if (unassign_qty.intValue()<0){
|
||||
unassign_qty = BigDecimal.ZERO;
|
||||
@@ -801,7 +809,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDisMapper.batchSave(invDis);
|
||||
//更新详情
|
||||
final IOStorInvDtlDto dto = new IOStorInvDtlDto();
|
||||
dto.setBill_status(unassign_qty.intValue() == 0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
dto.setBill_status(unassign_qty.intValue() <= 0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
dto.setUnassign_qty(unassign_qty);
|
||||
dto.setAssign_qty(allocation_canuse_qty.add(dtl.getAssign_qty()));
|
||||
dto.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
||||
@@ -923,22 +931,27 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
pointCode=regionCode.get(0).getPoint_code();
|
||||
}
|
||||
|
||||
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
}
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).ne(IOStorInvDis::getStruct_code,""))
|
||||
.eq(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code)
|
||||
.ne(IOStorInvDis::getStruct_code,""))
|
||||
.select(IOStorInvDis::getIostorinvdis_id
|
||||
,IOStorInvDis::getStruct_code
|
||||
,IOStorInvDis::getStoragevehicle_code)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDisList)){
|
||||
throw new BadRequestException("当前没有可设置的分配明细");
|
||||
}
|
||||
//仓储出入任务
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
//分配明细中同分配到同载具的进行合并
|
||||
Map<String, List<IOStorInvDis>> groupDis = ioStorInvDisList.stream().collect(Collectors.groupingBy(dis -> dis.getStoragevehicle_code()));
|
||||
for (String storageVehicleCode : groupDis.keySet()) {
|
||||
@@ -951,131 +964,110 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("PickingLocation", item.getStruct_code());
|
||||
task_form.put("PlacedLocation", pointCode);
|
||||
task_form.put("vehicle_code", item.getStoragevehicle_code());
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
String task_id = stOutTask.create(task_form);
|
||||
for (IOStorInvDis itemDis : disList) {
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(itemDis.getIostorinvdis_id());
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(pointCode);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
}
|
||||
ioStorInvDisMapper.update(null,new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
.set(IOStorInvDis::getTask_id,task_id)
|
||||
.set(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(IOStorInvDis::getPoint_code,pointCode)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.in(IOStorInvDis::getIostorinvdis_id,disList.stream()
|
||||
.map(IOStorInvDis::getIostorinvdis_id).collect(Collectors.toList())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirm(JSONObject whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
}
|
||||
|
||||
if (!IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
|
||||
throw new BadRequestException("主表状态必须为分配完!");
|
||||
}
|
||||
|
||||
//解锁原货位点位
|
||||
List<IOStorInvDis> storInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
// 判断此单据下的所有任务有没有完成的
|
||||
boolean is_finish = iSchBaseTaskService.list(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.in(SchBaseTask::getTask_id, storInvDisList.stream()
|
||||
.map(IOStorInvDis::getTask_id)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
).stream()
|
||||
.allMatch(row -> row.getTask_status().equals(TaskStatus.FINISHED.getCode()));
|
||||
.collect(Collectors.toList())))
|
||||
.stream().allMatch(row -> row.getTask_status().equals(TaskStatus.FINISHED.getCode()));
|
||||
if (!is_finish) {
|
||||
throw new BadRequestException("当前有未完成的任务不能强制确认!");
|
||||
}
|
||||
|
||||
//需要更新的出入库单明细
|
||||
Set<String> dtlSet = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
|
||||
//解绑仓位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",null);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
|
||||
//解锁库位状态
|
||||
iStructattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getInv_id,null)
|
||||
.set(Structattr::getInv_code,null)
|
||||
.set(Structattr::getInv_type,null)
|
||||
.set(Structattr::getStoragevehicle_code,null)
|
||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.in(Structattr::getStruct_code,storInvDisList.stream()
|
||||
.map(IOStorInvDis::getStruct_code)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList())));
|
||||
//库存绑定到出库点。
|
||||
final Map<String, List<String>> collect = storInvDisList.stream()
|
||||
.filter(a->!StringUtils.isEmpty(a.getPoint_code()))
|
||||
.collect(Collectors.groupingBy(IOStorInvDis::getPoint_code,//按照 point_code 分组
|
||||
Collectors.mapping(
|
||||
IOStorInvDis::getStruct_code,
|
||||
Collectors.toList())));
|
||||
for (String pointCode : collect.keySet()) {
|
||||
final List<String> vecicles = collect.get(pointCode);
|
||||
schBasePointMapper.update(new SchBasePoint(),new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
.set(SchBasePoint::getIos_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.eq(SchBasePoint::getPoint_code,ioStorInvDis.getPoint_code())
|
||||
);
|
||||
|
||||
//修改库存 减冻结加可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
|
||||
//判断分配明细是否分配了出库点位和任务号 分配则恢复库存等待手持减扣 没分配则减扣库存
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getPoint_code()) && StrUtil.isNotBlank(ioStorInvDis.getTask_id())){
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
}else {
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN);
|
||||
}
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
}
|
||||
//更新分配明细数据
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,BigDecimal.ZERO)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
//添加需要更新的明细标识
|
||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
//更新组盘记录表
|
||||
.set(SchBasePoint::getVehicle_code,vecicles.stream().collect(Collectors.joining(",")))
|
||||
.eq(SchBasePoint::getPoint_code,pointCode));
|
||||
};
|
||||
List<OutFinishParam> outFinishParams = new ArrayList<>();
|
||||
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
||||
//更新组盘记录表 ,如果是虚拟托盘则扔为入库状态
|
||||
if (!ioStorInvDis.getStoragevehicle_code().contains("VTP")){
|
||||
iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_code,ioStorInvDis.getMaterial_id())
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
}
|
||||
|
||||
//修改库存:减冻结加,分配的时候已经把可用扣减了
|
||||
outFinishParams.add(OutFinishParam.builder()
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.changeQty(ioStorInvDis.getPlan_qty())
|
||||
.pcsn(ioStorInvDis.getPcsn())
|
||||
.materialCode(ioStorInvDis.getMaterial_code())
|
||||
.build());
|
||||
//添加需要更新的明细标识
|
||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
}
|
||||
//更新分配明细数据
|
||||
ioStorInvDisMapper.update(null,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,BigDecimal.ZERO)
|
||||
.in(IOStorInvDis::getIostorinvdis_id,storInvDisList.stream()
|
||||
.map(IOStorInvDis::getIostorinvdis_id).collect(Collectors.toList()))
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS,outFinishParams);
|
||||
//更新出库明细单状态
|
||||
for (String dtlId : dtlSet) {
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(), new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
ioStorInvDtlMapper.update(null, new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty, BigDecimal.ZERO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id, dtlId)
|
||||
.in(IOStorInvDtl::getIostorinvdtl_id, dtlSet)
|
||||
);
|
||||
}
|
||||
|
||||
//TODO:添加单据更新
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid, currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname, nickName)
|
||||
.set(IOStorInv::getConfirm_time, now)
|
||||
.set(IOStorInv::getConfirm_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(IOStorInv::getConfirm_optname, SecurityUtils.getCurrentNickName())
|
||||
.set(IOStorInv::getConfirm_time, DateUtil.now())
|
||||
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
|
||||
);
|
||||
}
|
||||
@@ -1142,6 +1134,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
eventPublisher.publishEvent(new PmManageEvent(ioStorInvDtl.getSource_bill_type()
|
||||
,new DemandListenerParams(ioStorInvDtl.getSource_bill_code(),ioStorInvDtl.getAssign_qty(),ioStorInvDtl.getMaterial_code())));
|
||||
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package org.nl.wms.warehouse_manage.inventory.core.param.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class OutFinishParam implements InventoryParam {
|
||||
private String storagevehicleCode;
|
||||
private String materialCode;
|
||||
private String pcsn;
|
||||
private BigDecimal qty;
|
||||
private BigDecimal changeQty;
|
||||
|
||||
@Override
|
||||
public OutFinishParam validation() {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package org.nl.wms.warehouse_manage.inventory.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
|
||||
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
@@ -15,4 +19,7 @@ import java.util.List;
|
||||
public interface StInventoryMapper {
|
||||
|
||||
List<StInventoryDto> queryInventory(@Param("query") StInventoryQuery query);
|
||||
|
||||
JSONObject getCanuseIvt(@Param("param") Map whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,4 +18,58 @@
|
||||
GROUP BY s.stor_id, s.stor_code, s.stor_name, g.material_code
|
||||
ORDER BY s.stor_code;
|
||||
</select>
|
||||
|
||||
<select id="getCanuseIvt" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ext.group_id,
|
||||
ext.storagevehicle_code,
|
||||
ext.material_code,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
ext.pcsn,
|
||||
ext.qty_unit_id,
|
||||
ext.qty_unit_name,
|
||||
ext.qty,
|
||||
ext.frozen_qty,
|
||||
attr.sect_name AS turnout_sect_name,
|
||||
attr.sect_code AS turnout_sect_code,
|
||||
attr.sect_id,
|
||||
attr.struct_id,
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
md_pb_groupplate ext
|
||||
INNER JOIN md_me_materialbase material ON material.material_code = ext.material_code
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
<where>
|
||||
attr.lock_type = '0'
|
||||
AND attr.is_used = "1"
|
||||
AND ext.qty > 0
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id LIKE #{param.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="param.sect_id != null and param.sect_id != ''">
|
||||
AND
|
||||
attr.sect_id = #{param.sect_id}
|
||||
</if>
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
attr.struct_code LIKE #{param.struct_code}
|
||||
</if>
|
||||
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
material.material_code LIKE #{param.material_code}
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
ext.pcsn = #{param.pcsn}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY ext.create_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package org.nl.wms.warehouse_manage.inventory.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -128,7 +125,7 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
queryWrapper.eq(GroupPlate::getPcsn, outFinishParam.getPcsn());
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(queryWrapper);
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(outFinishParam.getQty()));
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupPlate.setUpdate_time(DateUtil.now());
|
||||
@@ -146,6 +143,9 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
queryWrapper.eq(GroupPlate::getPcsn, param.getPcsn());
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(queryWrapper);
|
||||
if (groupPlate==null){
|
||||
throw new BadRequestException("当前物料在组盘"+param.getStoragevehicleCode()+"库存中不存在");
|
||||
}
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(param.getChangeQty()));
|
||||
groupPlate.setQty(groupPlate.getQty().add(param.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -74,14 +74,12 @@ public class PmStockReturnServiceImpl extends ServiceImpl<PmStockReturnMapper, P
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void upload(JSONObject whereJson) {
|
||||
List<PmStockReturn> rows = whereJson.getJSONArray("rows").toJavaList(PmStockReturn.class);
|
||||
uploadRows(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void uploadRows(List<PmStockReturn> rows) {
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
throw new BadRequestException("请选择需要回传的记录");
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<el-col :span="12"><el-form-item label="物料编码" prop="skuCode"><el-input v-model.trim="form.skuCode" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="物料名称" prop="skuName"><el-input v-model.trim="form.skuName" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="数量" prop="qty"><el-input-number v-model="form.qty" :min="0" :precision="4" :step="1" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="已分配数量" prop="assignQty"><el-input-number v-model="form.assignQty" :min="0" :precision="4" :step="1" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="单位" prop="unit"><el-input v-model.trim="form.unit" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="目标库存地点" prop="targetArea"><el-input v-model.trim="form.targetArea" style="width: 280px;" /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="产线" prop="productionLine"><el-input v-model.trim="form.productionLine" style="width: 280px;" /></el-form-item></el-col>
|
||||
@@ -84,6 +85,7 @@
|
||||
<el-table-column prop="skuCode" label="物料编码" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="skuName" label="物料名称" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="qty" label="数量" width="100" />
|
||||
<el-table-column prop="assignQty" label="已分配数量" width="100" />
|
||||
<el-table-column prop="unit" label="单位" width="80" />
|
||||
<el-table-column prop="targetArea" label="目标库存地点" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
|
||||
@@ -126,6 +128,8 @@ export default {
|
||||
{ value: '01', label: '分配' },
|
||||
{ value: '10', label: '下发' },
|
||||
{ value: '20', label: '执行' },
|
||||
{ value: '50', label: '待回传' },
|
||||
{ value: '70', label: '回传失败' },
|
||||
{ value: '80', label: '完成' },
|
||||
{ value: '90', label: '取消' }
|
||||
],
|
||||
|
||||
@@ -47,5 +47,12 @@ export function changeLock(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function getRegionPoints(param) {
|
||||
return request({
|
||||
url: 'api/schBasePoint/getRegionPoints',
|
||||
method: 'get',
|
||||
params: param
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, changeUsed, getPointList, changeLock }
|
||||
export default { add, edit, del, changeUsed, getPointList, changeLock, getRegionPoints }
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="request_Id" label="回传业务单据号" min-width="170" />
|
||||
<el-table-column prop="request_type" label="回传类型" min-width="120" />
|
||||
<el-table-column prop="request_type" label="回传类型" min-width="120" :formatter="formatRequestType" />
|
||||
<el-table-column prop="status" label="状态" min-width="90" :formatter="formatStatus" />
|
||||
<el-table-column prop="error_msg" label="ERP处理失败记录" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="create_time" label="单据创建时间" min-width="160" />
|
||||
@@ -158,6 +158,14 @@ export default {
|
||||
{ value: '1', label: '成功' },
|
||||
{ value: '2', label: '失败' }
|
||||
],
|
||||
typeStatusMap: {
|
||||
'生产入库': '0001',
|
||||
'采购入库': '0005',
|
||||
'手工入库': '0009',
|
||||
'销售出库': '1001',
|
||||
'生产出库': '1005',
|
||||
'手工出库': '1009'
|
||||
},
|
||||
jsonDialog: {
|
||||
visible: false,
|
||||
edit: false,
|
||||
@@ -280,6 +288,21 @@ export default {
|
||||
formatStatus(row) {
|
||||
const item = this.statusOptions.find(option => option.value === row.status)
|
||||
return item ? item.label : row.status
|
||||
},
|
||||
formatTypeStatus(row) {
|
||||
const item = this.statusOptions.find(option => option.value === row.status)
|
||||
return item ? item.label : row.status
|
||||
},
|
||||
formatRequestType(row) {
|
||||
const requestTypeMap = {
|
||||
'0001': '生产入库',
|
||||
'0005': '采购入库',
|
||||
'0009': '手工入库',
|
||||
'1001': '销售出库',
|
||||
'1005': '生产出库',
|
||||
'1009': '手工出库'
|
||||
}
|
||||
return requestTypeMap[row.request_type] || row.request_type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
size="mini"
|
||||
@click="allSetPointAllDtl"
|
||||
>
|
||||
一键设置
|
||||
一键下发
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -234,9 +234,8 @@ import CRUD, { crud } from '@crud/crud'
|
||||
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
|
||||
import StructIvt from '@/views/wms/st/outbill/StructIvt'
|
||||
import PointDialog from '@/views/wms/sch/point/PointDialog'
|
||||
import crudPoint, { getRegionPoints } from '@/views/wms/sch/point/schBasePoint'
|
||||
import crudPoint from '@/views/wms/sch/point/schBasePoint'
|
||||
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
|
||||
import { autoCancel, getOutBillDis } from './checkoutbill'
|
||||
|
||||
export default {
|
||||
name: 'DivDialog',
|
||||
@@ -320,7 +319,7 @@ export default {
|
||||
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
crudPoint.getRegionPoints({ 'region_code': 'CKQ' }).then(res => {
|
||||
crudPoint.getRegionPoints({ 'regionCode': 'CKQ' }).then(res => {
|
||||
this.outBoundRegion = res.content
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user