Browse Source

PC订制品包件备货

newStockUp
汤建军 1 year ago
parent
commit
a397fc0eca
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 8
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java
  3. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java
  4. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataGoodsAllocationController.java
  5. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java
  6. 12
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.java
  7. 26
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml
  8. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAllocationService.java
  9. 67
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java
  10. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockController.java
  11. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -8,7 +8,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="";
public static final String DEVAUTH ="-tjj";
/**
* 工厂对接服务名称

8
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java

@ -82,4 +82,12 @@ public interface IBasicdataGoodsAllocationClient {
*/
@GetMapping(API_PREFIX+"/scanStockUpAllocationByCode")
BasicdataGoodsAllocationEntity scanStockUpAllocationByCode(String stockUpAreaCode);
/**
* 查询库位的完整名称按照货区-货架-货位的方式呈现
* @param goodsStockupAllocationId
* @return
*/
@GetMapping(API_PREFIX+"/getAllocationIntegrityName")
String getAllocationIntegrityName(@RequestParam Long goodsStockupAllocationId);
}

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java

@ -179,4 +179,7 @@ public class DistributionStockEntity extends TenantEntity {
@ApiModelProperty(value = "扫码类型 1包件 2库存品")
private Integer type;
@ApiModelProperty(value = "备货区库位ID")
private Long goodsStockupAllocationId; //备货区库位ID
}

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataGoodsAllocationController.java

@ -199,6 +199,14 @@ public class BasicdataGoodsAllocationController extends BladeController {
return R.data(pages);
}
@GetMapping("/getStockUpAllocation")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询备货库位信息", notes = "传入BasicdataGoodsAllocation")
public R<List<BasicdataNodeVO>> getStockUpAllocation() {
List<BasicdataNodeVO> pages = basicdataGoodsAllocationService.getStockUpAllocation();
return R.data(pages);
}
/**
* 货位获取模板信息
@ -209,7 +217,6 @@ public class BasicdataGoodsAllocationController extends BladeController {
public R<?> getPrintTemplate(@ApiIgnore @RequestParam("ids") String ids) {
FreightSpaceVO result = basicdataGoodsAllocationService.getPrintTemplate(ids);
return R.data(result);
}

5
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java

@ -110,4 +110,9 @@ public class BasicdataGoodsAllocationClient implements IBasicdataGoodsAllocation
return basicdataGoodsAllocationService.scanStockUpAllocationByCode(stockUpAreaCode);
}
@Override
public String getAllocationIntegrityName(Long goodsStockupAllocationId) {
return basicdataGoodsAllocationService.getAllocationIntegrityName(goodsStockupAllocationId);
}
}

12
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.java

@ -55,7 +55,7 @@ public interface BasicdataGoodsAllocationMapper extends BaseMapper<BasicdataGood
*/
List<BasicdataGoodsAllocationExcel> exportBasicdataGoodsAllocation(@Param("ew") Wrapper<BasicdataGoodsAllocationEntity> queryWrapper);
List<BasicdataNodeVO> selectSecondNode(@Param("warehouseId")String warehouseId);
List<BasicdataNodeVO> selectSecondNode(@Param("warehouseId")String warehouseId,@Param("areaType") String areaType);
List<BasicdataNodeVO> selectThirdNode(@Param("warehouseId")String warehouseId,@Param("areaId") String areaId);
@ -68,4 +68,14 @@ public interface BasicdataGoodsAllocationMapper extends BaseMapper<BasicdataGood
* @return
*/
WarehouseAllocationInfoVO selectAllocationInfo(@Param("id") String id);
/*
* @param warehouseId
* @param areaId
* @param goodsShelfId
* @return
*/
List<BasicdataNodeVO> selectFourthNode(@Param("warehouseId") String warehouseId,@Param("areaId") String areaId,@Param("goodsShelfId") String goodsShelfId);
String getAllocationIntegrityName(@Param("goodsAllocationId") Long goodsStockupAllocationId);
}

26
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml

@ -50,6 +50,9 @@
is_deleted = 0
AND
warehouse_id = #{warehouseId}
<if test="areaType !=null and areaType != ''">
and area_type = #{areaType}
</if>
</select>
<select id="selectThirdNode" resultType="com.logpm.basicdata.vo.BasicdataNodeVO">
SELECT
@ -158,5 +161,26 @@
where lwga.is_deleted = 0
and CONCAT(lwga2.headline,'-',lwgs.goods_shelf_name,'-',lwga.goods_allocation_name) = #{allocationCode}
</select>
<select id="selectFourthNode" resultType="com.logpm.basicdata.vo.BasicdataNodeVO">
SELECT
lwga.id AS
VALUE
,
lwga.goods_allocation_name AS label,
( TRUE ) AS leaf
FROM
logpm_warehouse_goods_allocation AS lwga
WHERE
lwga.is_deleted = 0 AND lwga.warehouse_id = #{warehouseId} AND lwga.goods_area_id = #{areaId} and lwga.goods_shelf_id = #{goodsShelfId}
</select>
<select id="getAllocationIntegrityName" resultType="java.lang.String">
SELECT
CONCAT_WS('-',lwgaa.headline,lwgs.goods_shelf_name,lwga.goods_allocation_name)
FROM
logpm_warehouse_goods_allocation AS lwga
LEFT JOIN logpm_warehouse_goods_shelf AS lwgs ON lwga.goods_shelf_id = lwgs.id
LEFT JOIN logpm_warehouse_goods_area AS lwgaa ON lwga.goods_area_id = lwgaa.id
WHERE
lwga.id = #{goodsAllocationId}
</select>
</mapper>

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAllocationService.java

@ -117,4 +117,13 @@ public interface IBasicdataGoodsAllocationService extends BaseService<BasicdataG
* @return
*/
BasicdataGoodsAllocationEntity scanStockUpAllocationByCode(String stockUpAreaCode);
List<BasicdataNodeVO> getStockUpAllocation();
/**
* 查询库位的完整名称 货区-货架-货位的方式呈现
* @param goodsStockupAllocationId
* @return
*/
String getAllocationIntegrityName(Long goodsStockupAllocationId);
}

67
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java

@ -138,7 +138,7 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
List<BasicdataNodeVO> basicdataWarehouseVOList = goodsAreaMapper.selectFirstNode(collect);
//遍历仓库节点查询货区节点信息
for (BasicdataNodeVO basicdataNodeVO : basicdataWarehouseVOList) {
List<BasicdataNodeVO> goodeAreaNodes = goodsAllocationMapper.selectSecondNode(basicdataNodeVO.getValue());
List<BasicdataNodeVO> goodeAreaNodes = goodsAllocationMapper.selectSecondNode(basicdataNodeVO.getValue(), null);
//判断仓库下是否存在货区节点,存在则添加,不存在则设置没有下级节点
if (!Func.isEmpty(goodeAreaNodes)) {
basicdataNodeVO.setChildren(goodeAreaNodes);
@ -164,7 +164,7 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
public boolean insertGoodsAllocation(BasicdataGoodsAllocationDTO basicdataGoodsAllocationDto) {
BasicdataGoodsAllocationEntity basicdataGoodsAllocationEntity = new BasicdataGoodsAllocationEntity();
if (Func.isEmpty(basicdataGoodsAllocationDto)) {
log.error("参数不合法:{}" , basicdataGoodsAllocationDto);
log.error("参数不合法:{}", basicdataGoodsAllocationDto);
return false;
}
BeanUtils.copyProperties(basicdataGoodsAllocationDto, basicdataGoodsAllocationEntity);
@ -185,7 +185,7 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
String code = tenantCodeClient.shelfCode(user.getTenantId(), "5");
String allocationCode = code + "-" + basicdataGoodsAllocationEntity.getColumnNum() + "-" + basicdataGoodsAllocationEntity.getLayerNum() + "-" + basicdataGoodsAllocationEntity.getGoodsAllocationName();
basicdataGoodsAllocationEntity.setQrCode(allocationCode);
return SqlHelper.retBool(goodsAllocationMapper.insert(basicdataGoodsAllocationEntity));
return SqlHelper.retBool(goodsAllocationMapper.insert(basicdataGoodsAllocationEntity));
}
@Override
@ -197,8 +197,8 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
List<Long> collect = myWatchWarehouse.stream()
.map(BasicdataWarehouseEntity::getId)
.collect(Collectors.toList());
basicdataGoodsAllocation.put("warehouseList",collect);
return goodsAllocationMapper.selectGoodsAllocationList(page, basicdataGoodsAllocation);
basicdataGoodsAllocation.put("warehouseList", collect);
return goodsAllocationMapper.selectGoodsAllocationList(page, basicdataGoodsAllocation);
}
@ -206,7 +206,7 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
public boolean updateGoodsAllocation(BasicdataGoodsAllocationDTO basicdataGoodsAllocationDto) {
boolean result = false;
if (Func.isEmpty(basicdataGoodsAllocationDto)) {
log.error("参数不合法:{}" , basicdataGoodsAllocationDto);
log.error("参数不合法:{}", basicdataGoodsAllocationDto);
return result;
}
BasicdataGoodsAllocationEntity basicdataGoodsAllocationEntity = new BasicdataGoodsAllocationEntity();
@ -266,35 +266,35 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
boolean update = this.update(new UpdateWrapper<BasicdataGoodsAllocationEntity>().lambda()
.set(BasicdataGoodsAllocationEntity::getEnableStatus, 1)
.in(BasicdataGoodsAllocationEntity::getId, Func.toLongList(ids)));
return update?R.success("成功"):R.fail("失败");
return update ? R.success("成功") : R.fail("失败");
}
@Override
public R disableGoodsAllocation(String ids) {
log.info("传入参数>>>>>>>>>>{}",ids);
log.info("传入参数>>>>>>>>>>{}", ids);
//查询该货位有无货物
// List<Long> longs = Func.toLongList(ids);
Integer integer = warehouseUpdownGoodsClient.selectCountByAllo(ids);
if (integer>0){
if (integer > 0) {
return R.fail("有货物,无法禁用");
}
boolean update = this.update(new UpdateWrapper<BasicdataGoodsAllocationEntity>().lambda()
.set(BasicdataGoodsAllocationEntity::getEnableStatus, 2)
.in(BasicdataGoodsAllocationEntity::getId, Func.toLongList(ids)));
return update?R.success("成功"):R.fail("失败");
return update ? R.success("成功") : R.fail("失败");
}
@Override
public List<BasicdataGoodsAllocationEntity> findListStockUpAllocationByName(String fragment) {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
if (Func.isEmpty(myCurrentWarehouse)) {
return null;
}
return this.list(Wrappers.<BasicdataGoodsAllocationEntity>query().lambda()
.like(BasicdataGoodsAllocationEntity::getGoodsAllocationName,fragment)
.eq(BasicdataGoodsAllocationEntity::getWarehouseId,myCurrentWarehouse.getId())
.eq(BasicdataGoodsAllocationEntity::getEnableStatus,"1")
.like(BasicdataGoodsAllocationEntity::getGoodsAllocationName, fragment)
.eq(BasicdataGoodsAllocationEntity::getWarehouseId, myCurrentWarehouse.getId())
.eq(BasicdataGoodsAllocationEntity::getEnableStatus, "1")
);
}
@ -304,4 +304,43 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
return this.getById(stockUpAreaCode);
}
@Override
public List<BasicdataNodeVO> getStockUpAllocation() {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseService.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)) {
return null;
}
List<BasicdataNodeVO> nodeS = new ArrayList<>();
List<BasicdataNodeVO> goodeAreaNodes = goodsAllocationMapper.selectSecondNode(myCurrentWarehouse.getId().toString(), "1");
if (Func.isNotEmpty(goodeAreaNodes)) {
for (BasicdataNodeVO goodeAreaNode : goodeAreaNodes) {
List<BasicdataNodeVO> goodsShelfNode = goodsAllocationMapper.selectThirdNode(myCurrentWarehouse.getId().toString(), goodeAreaNode.getValue());
if (Func.isNotEmpty(goodsShelfNode)) {
goodeAreaNode.setChildren(goodsShelfNode);
goodeAreaNode.setLeaf(false);
for (BasicdataNodeVO basicdataNodeVO : goodsShelfNode) {
List<BasicdataNodeVO> goodsAllocationNode = goodsAllocationMapper.selectFourthNode(myCurrentWarehouse.getId().toString(), goodeAreaNode.getValue(), basicdataNodeVO.getValue());
if (Func.isNotEmpty(goodsAllocationNode)) {
basicdataNodeVO.setChildren(goodsAllocationNode);
basicdataNodeVO.setLeaf(false);
}else {
basicdataNodeVO.setLeaf(true);
}
}
}else {
goodeAreaNode.setLeaf(true);
}
nodeS.add(goodeAreaNode);
}
}
return nodeS;
}
@Override
public String getAllocationIntegrityName(Long goodsStockupAllocationId) {
return baseMapper.getAllocationIntegrityName(goodsStockupAllocationId);
}
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockController.java

@ -110,11 +110,9 @@ public class DistributionStockController extends BladeController {
@ApiOperationSupport(order = 4)
@ApiOperation(value = "系统备货新增", notes = "传入distributionStock")
public R addStockDetail(@Valid @RequestBody DistributionStockDTO distributionStock) {
if(ObjectUtils.isNull(distributionStock.getGoodsAreaId())){
return R.fail("注意,注意:备货区未选择!");
}
// if(ObjectUtils.isNull(distributionStock.getGoodsAreaId())){
// return R.fail("注意,注意:备货区未选择!");
// }
return R.status(distributionStockService.addStockDetail(distributionStock));
}

42
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java

@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity;
import com.logpm.basicdata.feign.IBasicdataGoodsAllocationClient;
import com.logpm.distribution.dto.DistributionStockDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionStockExcel;
@ -37,6 +39,7 @@ import org.springblade.common.constant.order.OrderStockupStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -80,6 +83,8 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
private IDistributionDeliveryDetailsService distributionDeliveryDetailsService;
private IBasicdataGoodsAllocationClient basicdataGoodsAllocationClient;
@Override
public IPage<DistributionStockVO> selectDistributionStockPage(IPage<DistributionStockVO> page, DistributionStockVO distributionStock) {
@ -204,8 +209,13 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
@Transactional(rollbackFor = Exception.class)
public Boolean addStockDetail(DistributionStockDTO distributionStocks) {
// DistributionStockDTO distributionStock1 = JSONObject.parseObject(JSONObject.toJSONString(distributionStocks), DistributionStockDTO.class);
if (Func.isEmpty(distributionStocks.getGoodsStockupAllocationId())){
log.warn("备货缺少备货库位ID");
return false;
}
List<String> ids = distributionStocks.getIds();
List<DistributionStockEntity> list = new ArrayList<>();
String allocationIntegrityName = basicdataGoodsAllocationClient.getAllocationIntegrityName(distributionStocks.getGoodsStockupAllocationId());
for (int ii = 0; ii < ids.size(); ii++) {
String i = ids.get(ii);
DistributionStockEntity stockEntity = new DistributionStockEntity();
@ -246,10 +256,18 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
stockEntity.setGoodsName(byId.getMaterialName()); //货物名称
stockEntity.setUnit(byId.getMaterialUnit()); //单位
stockEntity.setOrderSelfNumbering(byId.getOrderCode()); //自编码
//----------------------2023-12-14 备货区域字段调整
//查询库位的完整名称
if (Func.isNotEmpty(allocationIntegrityName)){
stockEntity.setStockupArea(distributionStocks.getStockupArea()); //自编码
}
stockEntity.setStockupArea(distributionStocks.getStockupArea()); //自编码
stockEntity.setStockupId(distributionStocks.getStockupId()); //自编码
stockEntity.setType(1);
stockEntity.setStockQuantity(1);
stockEntity.setGoodsStockupAllocationId(distributionStocks.getGoodsStockupAllocationId());
stockEntity.setStockQuantity(1);
stockEntity.setStockQuantity(1);
stockEntity.setOutboundType(byId1.getTypeService());//类型
list.add(stockEntity);
//修改备货状态
@ -262,10 +280,15 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && distributionStocks.getStockupType().equals("ZT")){
//修改备货状态 自提
getUpdateOrderState(distributionStocks.getStockupId(),3,list.size() );
}else{
//修改备货状态 市 商
getUpdateOrderState(distributionStocks.getStockupId(),2,list.size() );
getUpdateOrderState(distributionStocks.getStockupId(),2,list.size());
}
//维护备货区
maintenanceStockUpArea(distributionStocks.getStockupId(),allocationIntegrityName);
//修改已备货的数量
@ -279,7 +302,7 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
* @param type
*/
@Override
public void getUpdateOrderState(Long pageId,int type,Integer num ) {
public void getUpdateOrderState(Long pageId,int type,Integer num) {
switch (type){
case 1: //修改订单备货状态
DistributionStockVO distributionStockVO = baseMapper.selectParcelList(pageId); //查询有多少待备货的包件
@ -319,6 +342,7 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
//查询备货状态
getUpdateStockup(pageId,2);
}
}
}
@ -353,6 +377,20 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
}
private void maintenanceStockUpArea(Long pageId,String allocationIntegrityName) {
DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(pageId);
if (Func.isBlank(distributionStockupEntity.getStockupArea())){
distributionStockupEntity.setStockupArea(allocationIntegrityName);
}else {
if (!distributionStockupEntity.getStockupArea().contains(allocationIntegrityName)){
distributionStockupEntity.setStockupArea(distributionStockupEntity.getStockupArea()+","+allocationIntegrityName);
}
}
distributionStockupMapper.updateById(distributionStockupEntity);
}
/**
* 修改备货状态
* @param pageId

Loading…
Cancel
Save