From 4b3cba9ff217d25109a64eff6684f21c92acd896 Mon Sep 17 00:00:00 2001 From: liuxy Date: Mon, 15 May 2023 08:58:59 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=85=A5=E5=BA=93=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/StIvtSectattrController.java | 26 ++- .../storage/IStIvtBsrealstorattrService.java | 4 + .../storage/IStIvtSectattrService.java | 7 + .../dao/mapper/StIvtBsrealstorattrMapper.java | 4 + .../dao/mapper/StIvtBsrealstorattrMapper.xml | 26 ++- .../impl/StIvtBsrealstorattrServiceImpl.java | 7 + .../impl/StIvtSectattrServiceImpl.java | 45 +++++ .../IStivtlostorivnCpInController.java | 8 + .../iostorInv/IStIvtIostorinvCpService.java | 9 + .../iostorInv/dao/StIvtIostorinvdtlCp.java | 6 +- .../impl/StIvtIostorinvCpServiceImpl.java | 170 ++++++++++++++++-- .../productmanage/util/DivRuleCpService.java | 27 +++ .../productmanage/util/RuleUtil.java | 11 ++ .../util/impl/DivRuleCpServiceImpl.java | 55 ++++++ .../product/productIn/DivDialog.vue | 23 ++- .../product/productIn/index.vue | 6 +- .../product/productIn/productin.js | 20 ++- 17 files changed, 422 insertions(+), 32 deletions(-) create mode 100644 mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/DivRuleCpService.java create mode 100644 mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/RuleUtil.java create mode 100644 mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/impl/DivRuleCpServiceImpl.java diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/controller/storage/StIvtSectattrController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/controller/storage/StIvtSectattrController.java index 943dc9e1..75d3e829 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/controller/storage/StIvtSectattrController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/controller/storage/StIvtSectattrController.java @@ -1,9 +1,23 @@ package org.nl.wms.storage_manage.basedata.controller.storage; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.swagger.annotations.ApiOperation; +import org.nl.common.TableDataInfo; +import org.nl.common.anno.Log; +import org.nl.wms.storage_manage.basedata.service.storage.IStIvtSectattrService; +import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** *

* 库区属性表 前端控制器 @@ -13,8 +27,18 @@ import org.springframework.web.bind.annotation.RestController; * @since 2023-05-04 */ @RestController -@RequestMapping("/stIvtSectattr") +@RequestMapping("/api/stIvtSectattr") public class StIvtSectattrController { + @Autowired + protected IStIvtSectattrService iStIvtSectattrService; + + @PostMapping("/getSect") + @Log("仓库库区多级下拉框") + @ApiOperation("仓库库区多级下拉框") + public ResponseEntity queryStor(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(iStIvtSectattrService.getSect(whereJson), HttpStatus.OK); + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtBsrealstorattrService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtBsrealstorattrService.java index 007db998..dc4b6792 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtBsrealstorattrService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtBsrealstorattrService.java @@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.basedata.service.storage; import com.baomidou.mybatisplus.extension.service.IService; import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr; +import java.util.List; +import java.util.Map; + /** *

* 实物库属性表 服务类 @@ -13,4 +16,5 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt */ public interface IStIvtBsrealstorattrService extends IService { + List queryStor(Map map); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtSectattrService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtSectattrService.java index cb6c8671..72a52b2a 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtSectattrService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/IStIvtSectattrService.java @@ -1,5 +1,6 @@ package org.nl.wms.storage_manage.basedata.service.storage; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.IService; import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr; @@ -13,4 +14,10 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr; */ public interface IStIvtSectattrService extends IService { + /** + * 仓库库区多级下拉框 + * @param whereJson / + * @return Object + */ + Object getSect(JSONObject whereJson); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.java index b1ccb09d..97d44861 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.java @@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.basedata.service.storage.dao.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr; +import java.util.List; +import java.util.Map; + /** *

* 实物库属性表 Mapper 接口 @@ -13,4 +16,5 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt */ public interface StIvtBsrealstorattrMapper extends BaseMapper { + List queryStor(Map map); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.xml b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.xml index 1bc02fdc..f5ac8605 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.xml +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/dao/mapper/StIvtBsrealstorattrMapper.xml @@ -1,5 +1,29 @@ - + diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtBsrealstorattrServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtBsrealstorattrServiceImpl.java index 5ca4fc79..69151fa7 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtBsrealstorattrServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtBsrealstorattrServiceImpl.java @@ -6,6 +6,9 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt import org.nl.wms.storage_manage.basedata.service.storage.dao.mapper.StIvtBsrealstorattrMapper; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + /** *

* 实物库属性表 服务实现类 @@ -17,4 +20,8 @@ import org.springframework.stereotype.Service; @Service public class StIvtBsrealstorattrServiceImpl extends ServiceImpl implements IStIvtBsrealstorattrService { + @Override + public List queryStor(Map map) { + return baseMapper.queryStor(map); + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtSectattrServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtSectattrServiceImpl.java index 6dff7080..8b619326 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtSectattrServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/basedata/service/storage/impl/StIvtSectattrServiceImpl.java @@ -1,11 +1,20 @@ package org.nl.wms.storage_manage.basedata.service.storage.impl; +import cn.hutool.json.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.wms.storage_manage.basedata.service.storage.IStIvtBsrealstorattrService; import org.nl.wms.storage_manage.basedata.service.storage.IStIvtSectattrService; import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr; import org.nl.wms.storage_manage.basedata.service.storage.dao.mapper.StIvtSectattrMapper; +import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + /** *

* 库区属性表 服务实现类 @@ -17,4 +26,40 @@ import org.springframework.stereotype.Service; @Service public class StIvtSectattrServiceImpl extends ServiceImpl implements IStIvtSectattrService { + @Autowired + private IStIvtBsrealstorattrService iStIvtBsrealstorattrService; + + @Autowired + private IStIvtSectattrService iStIvtSectattrService; + + @Override + public Object getSect(JSONObject whereJson) { + List maps = iStIvtBsrealstorattrService.queryStor(whereJson); + + JSONArray result = new JSONArray(); + + maps.forEach(item -> { + JSONObject jsonStor = new JSONObject(); + jsonStor.put("value", item.get("stor_id")); + jsonStor.put("label", item.get("stor_name")); + + List attrList = iStIvtSectattrService.list(new QueryWrapper().eq("stor_id", item.get("stor_id"))); + + JSONArray objects = new JSONArray(); + if (attrList.size()>0) { + attrList.forEach(json -> { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("value", json.getSect_id()); + jsonObject.put("label", json.getSect_name()); + objects.add(jsonObject); + }); + jsonStor.put("children", objects); + } + + result.add(jsonStor); + }); + JSONObject jo = new JSONObject(); + jo.put("content", result); + return jo; + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/controller/iostorInv/IStivtlostorivnCpInController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/controller/iostorInv/IStivtlostorivnCpInController.java index 02fcc7ab..580a8248 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/controller/iostorInv/IStivtlostorivnCpInController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/controller/iostorInv/IStivtlostorivnCpInController.java @@ -90,4 +90,12 @@ public class IStivtlostorivnCpInController { return new ResponseEntity<>(HttpStatus.OK); } + @PostMapping("/divStruct") + @Log("分配") + @ApiOperation("分配") + public ResponseEntity divStruct(@RequestBody JSONObject whereJson){ + iStIvtIostorinvCpService.divStruct(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/IStIvtIostorinvCpService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/IStIvtIostorinvCpService.java index 70805bb3..479c8aed 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/IStIvtIostorinvCpService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/IStIvtIostorinvCpService.java @@ -108,4 +108,13 @@ public interface IStIvtIostorinvCpService extends IService { * } */ void vehicleCheck(JSONObject whereJson); + + /** + * 分配 + * @param whereJson + * { + * 分配明细 + * } + */ + void divStruct(JSONObject whereJson); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/dao/StIvtIostorinvdtlCp.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/dao/StIvtIostorinvdtlCp.java index 93230f99..8405ece2 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/dao/StIvtIostorinvdtlCp.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/dao/StIvtIostorinvdtlCp.java @@ -1,8 +1,8 @@ package org.nl.wms.storage_manage.productmanage.service.iostorInv.dao; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.*; +import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; @@ -16,7 +16,7 @@ import java.math.BigDecimal; * @since 2023-05-04 */ @Data -@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) @TableName("st_ivt_iostorinvdtl_cp") public class StIvtIostorinvdtlCp implements Serializable { diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/impl/StIvtIostorinvCpServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/impl/StIvtIostorinvCpServiceImpl.java index f85a4255..c6a48371 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/impl/StIvtIostorinvCpServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/service/iostorInv/impl/StIvtIostorinvCpServiceImpl.java @@ -25,7 +25,9 @@ import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext; import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo; import org.nl.wms.storage_manage.IOSEnum; import org.nl.wms.storage_manage.basedata.service.storage.IStIvtBsrealstorattrService; +import org.nl.wms.storage_manage.basedata.service.storage.IStIvtStructattrService; import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr; +import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr; import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService; import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService; import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisdtlCpService; @@ -33,8 +35,11 @@ import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinv import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvCp; import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp; import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisdtlCp; +import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp; import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.mapper.StIvtIostorinvCpMapper; import org.nl.wms.storage_manage.productmanage.service.iostorInv.dto.IostorInvQuery; +import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService; +import org.nl.wms.storage_manage.productmanage.util.RuleUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -72,6 +77,12 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl() - .eq("iostorinvdis_id", param.getString("iostorinvdis_id")) - .eq("storagevehicle_code", disDao.getStoragevehicle_code()) + new QueryWrapper().lambda() + .eq(StIvtIostorinvdisdtlCp::getIostorinvdis_id, param.getString("iostorinvdis_id")) + .eq(StIvtIostorinvdisdtlCp::getStoragevehicle_code, disDao.getStoragevehicle_code()) ); // 6.更新载具扩展属性表 @@ -240,7 +251,8 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl().eq("storagevehicle_code", disDtlDao.getStoragevehicle_code()) + vehicleDao,new QueryWrapper().lambda() + .eq(MdPbStoragevehicleext::getStoragevehicle_code, disDtlDao.getStoragevehicle_code()) ); } } @@ -279,17 +291,17 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl() - .eq("storagevehicle_code", whereJson.getString("storagevehicle_code")) - .eq("is_used", true) + new QueryWrapper().lambda() + .eq(MdPbStoragevehicleinfo::getStoragevehicle_code, whereJson.getString("storagevehicle_code")) + .eq(MdPbStoragevehicleinfo::getIs_used, true) ); if (ObjectUtil.isEmpty(daoVehicle)) throw new BadRequestException("此载具不存在或未启用"); // 2.校验载具是否已组盘 MdPbStoragevehicleext daoVehicleExt = iMdPbStoragevehicleextService.getOne( - new QueryWrapper() - .eq("storagevehicle_code", whereJson.getString("storagevehicle_code")) + new QueryWrapper().lambda() + .eq(MdPbStoragevehicleext::getStoragevehicle_code, whereJson.getString("storagevehicle_code")) ); if (ObjectUtil.isEmpty(daoVehicleExt)) { @@ -300,6 +312,48 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl().lambda() + .eq(StIvtStructattr::getStruct_id,struct_id) + ); + } + + if (ObjectUtil.isEmpty(attrDao.getStruct_code())) throw new BadRequestException("未找到仓位!"); + + // 2.更新分配明细、分配、明细、主表 + updateDivIos(attrDao,whereJson); + + // TODO 更新点位 + // TODO 更新库存、物流等 + } + @NotNull private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) { JSONArray rows = whereJson.getJSONArray("tableData"); @@ -328,8 +382,10 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("stor_id", whereJson.getString("stor_id")); - wrapper.eq("is_used", true); + wrapper.lambda() + .eq(StIvtBsrealstorattr::getStor_id,whereJson.getString("stor_id")) + .eq(StIvtBsrealstorattr::getIs_used, true); + StIvtBsrealstorattr bsrealDao = stIvtBsrealstorattrService.getOne(wrapper); if (ObjectUtil.isEmpty(bsrealDao)) throw new BadRequestException("仓库不存在或未启用!"); @@ -343,4 +399,96 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl().lambda() + .eq(StIvtIostorinvdisdtlCp::getIostorinvdis_id, whereJson.getString("iostorinvdis_id")) + .eq(StIvtIostorinvdisdtlCp::getStoragevehicle_code, whereJson.getString("storagevehicle_code")) + ); + + // 2.更新分配表 + iostorinvdisCpService.update( + new StIvtIostorinvdisCp() + .setSect_id(attrDao.getSect_id()) + .setSect_code(attrDao.getSect_code()) + .setSect_name(attrDao.getSect_name()) + .setStruct_id(attrDao.getStruct_id()) + .setStruct_code(attrDao.getStruct_code()) + .setStruct_name(attrDao.getStruct_name()), + new QueryWrapper().lambda() + .eq(StIvtIostorinvdisCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id")) + ); + + // 3.更新明细表 + BigDecimal unassign_qty = iostorinvdtlCpService.getOne( + new QueryWrapper().lambda() + .eq(StIvtIostorinvdtlCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id")) + ).getUnassign_qty(); + + iostorinvdtlCpService.update( + new StIvtIostorinvdtlCp() + .setBill_status(IOSEnum.BILL_STATUS.code("分配完")) + .setAssign_qty(unassign_qty) + .setUnassign_qty(new BigDecimal(0)), + new QueryWrapper().lambda() + .eq(StIvtIostorinvdtlCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id")) + ); + + // 4.更新主表 + updateMst(whereJson.getString("iostorinv_id")); + + } + + @NotNull + public void updateMst(String iostorinv_id) { + /* + 更新主表 + */ + + StIvtIostorinvCp mstDao = this.baseMapper.selectOne( + new QueryWrapper().lambda() + .eq(StIvtIostorinvCp::getIostorinv_id, iostorinv_id) + ); + mstDao.setUpdate_id(SecurityUtils.getCurrentUserId()); + mstDao.setUpdate_name(SecurityUtils.getCurrentNickName()); + mstDao.setUpdate_time(new Date()); + mstDao.setDis_id(SecurityUtils.getCurrentUserId()); + mstDao.setDis_name(SecurityUtils.getCurrentNickName()); + mstDao.setDis_time(DateUtil.now()); + + // 查询主表下所有明细 + List dtlDaoList = iostorinvdtlCpService.list( + new QueryWrapper().lambda() + .eq(StIvtIostorinvdtlCp::getIostorinv_id, iostorinv_id) + ); + + // 判断是否都为分配完 + boolean is_true = dtlDaoList + .stream() + .allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))); + + if (is_true) { + // 更新主表为分配完 + mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); + } else { + // 更新主表为分配中 + mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中")); + } + + this.updateById(mstDao); + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/DivRuleCpService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/DivRuleCpService.java new file mode 100644 index 00000000..32d6617e --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/DivRuleCpService.java @@ -0,0 +1,27 @@ +package org.nl.wms.storage_manage.productmanage.util; + +import com.alibaba.fastjson.JSONObject; +import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr; + +/** + *

+ * 成品分配规则 服务类 + *

+ * + * @author Liuxy + * @since 2023-05-11 + */ +public interface DivRuleCpService { + + /** + * 入库分配规则 + * @param whereJson + * { + * "stor_id":仓库标识 + * "sect_id":库区标识 + * "rule_type":规则类型(后续优化) + * } + * @return StIvtStructattr / + */ + StIvtStructattr divRuleIn(JSONObject whereJson); +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/RuleUtil.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/RuleUtil.java new file mode 100644 index 00000000..91bfeede --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/RuleUtil.java @@ -0,0 +1,11 @@ +package org.nl.wms.storage_manage.productmanage.util; + +public class RuleUtil { + + /* + * 按照仓位顺序找一个仓位 + */ + public static final String PRODUCTION_IN = "1"; + +} + diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/impl/DivRuleCpServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/impl/DivRuleCpServiceImpl.java new file mode 100644 index 00000000..440643cf --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/storage_manage/productmanage/util/impl/DivRuleCpServiceImpl.java @@ -0,0 +1,55 @@ +package org.nl.wms.storage_manage.productmanage.util.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.wms.storage_manage.basedata.service.storage.IStIvtStructattrService; +import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr; +import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService; +import org.nl.wms.storage_manage.productmanage.util.RuleUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * 成品分配规则 服务实现类 + *

+ * + * @author Liuxy + * @since 2023-05-11 + */ +@Service +public class DivRuleCpServiceImpl implements DivRuleCpService { + + @Autowired + protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务 + + private StIvtStructattr attrDao; + + @Override + public StIvtStructattr divRuleIn(JSONObject whereJson) { + + String stor_id = whereJson.getString("stor_id"); + String sect_id = whereJson.getString("sect_id"); + + if (ObjectUtil.isEmpty(stor_id)) throw new BadRequestException("仓库不能为空!"); + if (ObjectUtil.isEmpty(sect_id)) throw new BadRequestException("库区不能为空!"); + + switch (whereJson.getString("rule_type")) { + case RuleUtil.PRODUCTION_IN : + attrDao = iStIvtStructattrService.getOne( + new QueryWrapper().lambda() + .eq(StIvtStructattr::getStor_id, stor_id) + .eq(StIvtStructattr::getSect_id, sect_id) + .isNull(StIvtStructattr::getStoragevehicle_code) + .eq(StIvtStructattr::getIs_used, "1") //TODO 暂时写死 + .eq(StIvtStructattr::getIs_delete, "0") //TODO 暂时写死 + .eq(StIvtStructattr::getLock_type, "1") //TODO 暂时写死 + ); + break; + } + + return attrDao; + } +} diff --git a/mes/qd/src/views/wms/storage_manage/product/productIn/DivDialog.vue b/mes/qd/src/views/wms/storage_manage/product/productIn/DivDialog.vue index 2d410e2f..989e3b84 100644 --- a/mes/qd/src/views/wms/storage_manage/product/productIn/DivDialog.vue +++ b/mes/qd/src/views/wms/storage_manage/product/productIn/DivDialog.vue @@ -222,7 +222,6 @@ import CRUD, { crud } from '@crud/crud' import StructDiv from '@/views/wms/pub/StructDialog' import crudProductIn from '@/views/wms/storage_manage/product/productIn/productin' import crudPoint from '@/api/wms/sch/point' -import crudRegion from '@/api/wms/sch/region' import AddBox from '@/views/wms/storage_manage/product/productIn/AddBox' export default { @@ -286,7 +285,7 @@ export default { }, methods: { open() { - crudRegion.getRegionSelect({ 'stor_id': this.storId }).then(res => { + crudProductIn.getSect({ 'stor_id': this.storId }).then(res => { this.sects = res.content }) const area_type = 'A1_RK01' @@ -511,25 +510,25 @@ export default { this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO) return } + if (!this.sect_id) { + this.crud.notify('请先选择区域!', CRUD.NOTIFICATION_TYPE.INFO) + return + } // 如果勾选了,直接跳后台 if (this.form.checked) { - if (!this.sect_id) { - this.crud.notify('请先选择区域!', CRUD.NOTIFICATION_TYPE.INFO) - return - } this.divBtn = true - this.form.sect_id = this.sect_id - this.form.stor_id = this.stor_id - this.form.is_pc = '1' - crudProductIn.divStruct(this.form).then(res => { - crudProductIn.getIODtl({ 'iostorinv_id': this.form.dtl_row.iostorinv_id, 'open_flag': '1' }).then(res => { + + this.dis_row.stor_id = this.stor_id + this.dis_row.sect_id = this.sect_id + crudProductIn.divStruct(this.dis_row).then(res => { + /* crudProductIn.getIODtl({ 'iostorinv_id': this.form.dtl_row.iostorinv_id, 'open_flag': '1' }).then(res => { this.openParam = res }) crudProductIn.getDisDtl(this.form.dtl_row).then(res => { this.form.tableMater = res this.divBtn = false this.crud.notify('分配货位成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) - }) + })*/ }).finally(() => { this.divBtn = false }) diff --git a/mes/qd/src/views/wms/storage_manage/product/productIn/index.vue b/mes/qd/src/views/wms/storage_manage/product/productIn/index.vue index efe764af..e6b3397f 100644 --- a/mes/qd/src/views/wms/storage_manage/product/productIn/index.vue +++ b/mes/qd/src/views/wms/storage_manage/product/productIn/index.vue @@ -310,12 +310,12 @@ export default { buttonChange(currentRow) { if (currentRow !== null) { this.currentRow = currentRow - if (currentRow.bill_status === '1' || currentRow.bill_status === '2' || currentRow.bill_status === '3') { + if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30') { this.dis_flag = false } else { this.dis_flag = true } - if (currentRow.bill_status === '3') { + if (currentRow.bill_status === '30') { this.confirm_flag = false } else { this.confirm_flag = true @@ -352,7 +352,7 @@ export default { divOpen() { crudProductIn.getIosInvDtl({ 'bill_code': this.currentRow.bill_code }).then(res => { this.openParam = res - this.storId = this.currentRow.product_code + this.storId = this.currentRow.stor_id this.billType = this.currentRow.bill_type this.divShow = true }) diff --git a/mes/qd/src/views/wms/storage_manage/product/productIn/productin.js b/mes/qd/src/views/wms/storage_manage/product/productIn/productin.js index 9afd508b..5aaf216f 100644 --- a/mes/qd/src/views/wms/storage_manage/product/productIn/productin.js +++ b/mes/qd/src/views/wms/storage_manage/product/productIn/productin.js @@ -56,6 +56,22 @@ export function confirmvehicle(data) { }) } +export function getSect(data) { + return request({ + url: '/api/stIvtSectattr/getSect', + method: 'post', + data + }) +} + +export function divStruct(data) { + return request({ + url: '/api/stIvtSectattr/divStruct', + method: 'post', + data + }) +} + export default { add, edit, @@ -63,5 +79,7 @@ export default { getIosInvDtl, getIosInvDis, vehicleCheck, - confirmvehicle + confirmvehicle, + getSect, + divStruct }