add::退料单增加targethource,增加分配及下推功能
This commit is contained in:
@@ -4,6 +4,7 @@ import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,6 +40,13 @@ public interface WmsToZDWmdService {
|
||||
*/
|
||||
ResponseEntity syncDemandOrder(List<PmDemandDto> demands);
|
||||
|
||||
/**
|
||||
* 同步生产退料单
|
||||
* @param demands
|
||||
* @return
|
||||
*/
|
||||
ResponseEntity syncReturnOrder(List<PmReturnDto> demands);
|
||||
|
||||
/**
|
||||
* EAS入库单下发
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,8 @@ import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
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;
|
||||
@@ -72,6 +74,30 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity syncReturnOrder(List<PmReturnDto> pmReturns) {
|
||||
log.info("syncReturnOrder生产退料单下发输入参数:-------------------" + pmReturns.size());
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_RETURN).getValue();
|
||||
try {
|
||||
//数据转换
|
||||
final String param = JSONObject.toJSONString(pmReturns);
|
||||
log.info("syncReturnOrder:-------------------" + param);
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(JSONArray.parseArray(param).toJSONString())
|
||||
.execute().body();
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
log.info("syncReturnOrder生产退料单同步结果参数:-------------------" + result.toString());
|
||||
Integer respCode = result.getInteger("respCode");
|
||||
if (respCode == null || respCode != 0) {
|
||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||
}
|
||||
return new ResponseEntity(result, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity syncPurchaseReceiving(BillChangeDto billChangeDto) {
|
||||
final String param = JSON.toJSONString(billChangeDto);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.wms.pm_manage.pmreturn.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
@@ -61,4 +63,21 @@ public class PmReturnController {
|
||||
pmReturnService.deleteByIds(idList);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/allocate")
|
||||
@Log("分配仓库")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> allocate(@RequestBody PmReturnDto param) {
|
||||
pmReturnService.allocate(param);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
@Log("下推单子")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> upload(@RequestBody PmReturnDto param) {
|
||||
pmReturnService.upload(param);
|
||||
return ResponseData.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnQuery;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,4 +22,6 @@ public interface IPmReturnService extends IService<PmReturn> {
|
||||
void update(PmReturnDto param);
|
||||
|
||||
void deleteByIds(List<String> ids);
|
||||
void allocate(PmReturnDto param);
|
||||
void upload(PmReturnDto param);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class PmReturn extends Model<PmReturn> {
|
||||
|
||||
@TableField("source_house_code")
|
||||
private String source_house_code;
|
||||
@TableField("target_house_code")
|
||||
private String target_house_code;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="sourceHouseCode" column="source_house_code"/>
|
||||
<result property="targetHouseCode" column="target_house_code"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateName" column="update_name"/>
|
||||
@@ -49,6 +50,9 @@
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and source_house_code like concat('%', #{query.sourceHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and target_house_code like concat('%', #{query.targetHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.status != null">
|
||||
and status = #{query.status}
|
||||
</if>
|
||||
|
||||
@@ -22,6 +22,7 @@ public class PmReturnDto implements Serializable {
|
||||
private String creator;
|
||||
private String createTime;
|
||||
private String sourceHouseCode;
|
||||
private String targetHouseCode;
|
||||
private Integer status;
|
||||
private String updateTime;
|
||||
private String updateName;
|
||||
|
||||
@@ -53,6 +53,8 @@ public class PmReturnParam {
|
||||
@NotBlank(message = "来源仓别不能为空")
|
||||
private String sourceHouseCode;
|
||||
|
||||
private String targetHouseCode;
|
||||
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -1,21 +1,43 @@
|
||||
package org.nl.wms.pm_manage.pmreturn.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.mapper.PmReturnMapper;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnQuery;
|
||||
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.InFinishParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutFinishParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.common.domain.query.PageQuery.trimStringFields;
|
||||
@@ -23,6 +45,15 @@ import static org.nl.common.domain.query.PageQuery.trimStringFields;
|
||||
@Service
|
||||
public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> implements IPmReturnService {
|
||||
|
||||
@Autowired
|
||||
private ISysParamService iSysParamService;
|
||||
@Autowired
|
||||
private WmsToZDWmdService wmsToZDWmdService;
|
||||
@Autowired
|
||||
private IStInventoryService iStInventoryService;
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
@Override
|
||||
public Page<PmReturnDto> queryPage(PmReturnQuery query, PageQuery pageQuery) {
|
||||
trimStringFields(query);
|
||||
@@ -60,6 +91,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
entity.setCreator(param.getCreator());
|
||||
entity.setCreate_time(param.getCreateTime());
|
||||
entity.setSource_house_code(param.getSourceHouseCode());
|
||||
entity.setTarget_house_code(param.getTargetHouseCode());
|
||||
entity.setStatus(param.getStatus());
|
||||
entity.setUpdate_name(param.getUpdateName());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
@@ -86,6 +118,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
entity.setDelivery_method(param.getDeliveryMethod());
|
||||
entity.setCreator(param.getCreator());
|
||||
entity.setCreate_time(param.getCreateTime());
|
||||
entity.setTarget_house_code(param.getTargetHouseCode());
|
||||
entity.setSource_house_code(param.getSourceHouseCode());
|
||||
entity.setStatus(param.getStatus());
|
||||
entity.setUpdate_name(param.getUpdateName());
|
||||
@@ -101,6 +134,69 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
this.removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allocate(PmReturnDto param) {
|
||||
final String targetHouseCode = param.getTargetHouseCode();
|
||||
if (StringUtils.isEmpty(targetHouseCode)) {
|
||||
throw new BadRequestException("分配失败,没有分配目标仓库");
|
||||
}
|
||||
// statusOptions: [
|
||||
// { value: 0, label: '生成' },
|
||||
// { value: 10, label: '分配' },
|
||||
// { value: 1, label: '失效' },
|
||||
// { value: 20, label: '执行' },
|
||||
// { value: 80, label: '完成' }
|
||||
// ],
|
||||
if (param.getStatus() != 0) {
|
||||
throw new BadRequestException("分配失败,当前单子状态已经分配");
|
||||
}
|
||||
param.setStatus(10);
|
||||
this.update(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void upload(PmReturnDto param) {
|
||||
final String targetHouseCode = param.getTargetHouseCode();
|
||||
if (StringUtils.isEmpty(targetHouseCode)){
|
||||
throw new BadRequestException("下推失败,当前单子未分配仓库");
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
if (zdStorParam!=null){
|
||||
ZD_STOR_SET = JSONObject.parseObject(zdStorParam.getValue(), List.class);
|
||||
} else {
|
||||
ZD_STOR_SET = new ArrayList<>();
|
||||
}
|
||||
if (ZD_STOR_SET.contains(targetHouseCode)){
|
||||
//如果是中鼎仓库则推给中鼎并更新库存
|
||||
final List<PmReturnDto> request = new ArrayList<>();
|
||||
request.add(param);
|
||||
wmsToZDWmdService.syncReturnOrder(request);
|
||||
final List<InFinishParam> addInvParams = new ArrayList<>();
|
||||
InFinishParam addParam = new InFinishParam();
|
||||
List<OutFinishParam> outFinsParams = new ArrayList<>();
|
||||
//查询线边仓库对应虚拟货位
|
||||
final Structattr one = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getSect_code, param.getSourceHouseCode()));
|
||||
outFinsParams.add(OutFinishParam.builder()
|
||||
.storagevehicleCode(one.getStoragevehicle_code())
|
||||
.changeQty(param.getQty())
|
||||
.sectCode(param.getSourceHouseCode())
|
||||
.structCode(one.getStruct_code())
|
||||
.materialCode(param.getSkuCode())
|
||||
.build());
|
||||
addInvParams.add(addParam);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
|
||||
param.setStatus(80);
|
||||
this.update(param);
|
||||
}{
|
||||
throw new BadRequestException("已经分配至平库,走打单入库流程");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private BigDecimal defaultAssignQty(BigDecimal assignQty) {
|
||||
return assignQty == null ? BigDecimal.ZERO : assignQty;
|
||||
}
|
||||
@@ -121,6 +217,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
dto.setCreator(entity.getCreator());
|
||||
dto.setCreateTime(entity.getCreate_time());
|
||||
dto.setSourceHouseCode(entity.getSource_house_code());
|
||||
dto.setTargetHouseCode(entity.getTarget_house_code());
|
||||
dto.setStatus(entity.getStatus());
|
||||
dto.setUpdateTime(entity.getUpdate_time());
|
||||
dto.setUpdateName(entity.getUpdate_name());
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SysParamConstant {
|
||||
* 中鼎系统URL
|
||||
*/
|
||||
public final static String ZD_URL_REQUISITION = "ZD_URL_REQUISITION";
|
||||
public final static String ZD_URL_RETURN = "ZD_URL_RETURN";
|
||||
public final static String ZD_URL_LOC = "ZD_URL_LOC";
|
||||
public final static String ZD_URL_IOORDER = "ZD_URL_IOORDER";
|
||||
/**
|
||||
|
||||
@@ -165,7 +165,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.getChangeQty()));
|
||||
groupPlate.setFrozen_qty(BigDecimal.ZERO.min(groupPlate.getFrozen_qty().subtract(outFinishParam.getChangeQty())));
|
||||
groupPlate.setQty(groupPlate.getQty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
|
||||
Reference in New Issue
Block a user