diff --git a/ant-design-vue-jeecg/.env.production b/ant-design-vue-jeecg/.env.production index d6a41e8..dd01f94 100644 --- a/ant-design-vue-jeecg/.env.production +++ b/ant-design-vue-jeecg/.env.production @@ -1,6 +1,6 @@ NODE_ENV=production VUE_APP_ENV=production outputDir=dist -VUE_APP_API_BASE_URL=http://127.0.0.1:8080/wms +VUE_APP_API_BASE_URL=http://101.132.100.116:8080/wms VUE_APP_CAS_BASE_URL=http://localhost:8443/cas VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/components/layouts/UserLayout.vue b/ant-design-vue-jeecg/src/components/layouts/UserLayout.vue index f73913c..2b28395 100644 --- a/ant-design-vue-jeecg/src/components/layouts/UserLayout.vue +++ b/ant-design-vue-jeecg/src/components/layouts/UserLayout.vue @@ -107,7 +107,7 @@ export default { .desc { font-size: 24px; color: #111; - margin-top: 170px; + margin-top: 10%; margin-bottom: 70px; font-weight: bolder; } @@ -117,6 +117,9 @@ export default { min-width: 260px; width: 368px; margin: 0 auto; + height: auto; + position: relative; + min-height: 400px; } .footer { diff --git a/ant-design-vue-jeecg/src/views/system/config/LocationList.vue b/ant-design-vue-jeecg/src/views/system/config/LocationList.vue index 1969344..1395af4 100644 --- a/ant-design-vue-jeecg/src/views/system/config/LocationList.vue +++ b/ant-design-vue-jeecg/src/views/system/config/LocationList.vue @@ -57,6 +57,11 @@ <j-dict-select-tag placeholder="请选择是否可用" v-model="queryParam.enable" dictCode="enable_status"/> </a-form-item> </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库内是否有托盘"> + <j-dict-select-tag placeholder="请选择库内是否有托盘" v-model="queryParam.haveContainer" dictCode="have_container_in_location"/> + </a-form-item> + </a-col> <template v-if="toggleSearchStatus"> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="行"> @@ -161,6 +166,12 @@ </a-tag> </span> + <span slot="haveContainer_dictText" slot-scope="haveContainer_dictText"> + <a-tag :key="haveContainer_dictText" :color="getStatusColor(haveContainer_dictText)"> + {{ haveContainer_dictText }} + </a-tag> + </span> + <span slot="high_dictText" slot-scope="high_dictText"> <a-tag :key="high_dictText" :color="getStatusColor(high_dictText)"> {{ high_dictText }} @@ -329,6 +340,12 @@ export default { dataIndex: 'materialAreaCode' }, { + title: '是否有托盘', + align: 'center', + dataIndex: 'haveContainer_dictText', + scopedSlots: {customRender: 'haveContainer_dictText'} + }, + { title: '是否可用', align: 'center', dataIndex: 'enable_dictText' @@ -404,6 +421,7 @@ export default { '内侧': 'purple', '高库位': 'red', + '没有': 'red', '低库位': 'green', default: 'blue' }; diff --git a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue index 2cc727d..c6268b3 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue @@ -37,6 +37,13 @@ </a-tag> </span> + <span slot="controller_dictText" slot-scope="controller_dictText"> + <a-tag :key="controller_dictText" :color="getStatusColor(controller_dictText)"> + {{ controller_dictText }} + </a-tag> + </span> + + <span slot="companyCode" slot-scope="companyCode"> <a-tag :key="companyCode" color="blue"> {{ solutionCompany(companyCode) }} @@ -192,6 +199,12 @@ export default { scopedSlots: {customRender: 'inventoryStatus_dictText'} }, { + title: '受控状态', + align: 'center', + dataIndex: 'controller_dictText', + scopedSlots: {customRender: 'controller_dictText'} + }, + { title: '批次', align: 'center', dataIndex: 'batch' diff --git a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue index 543626c..7bfa17c 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue @@ -49,6 +49,15 @@ </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="受控状态"> + <j-dict-select-tag + placeholder="请选择受控状态" + v-model="queryParam.controller" + dictCode="inventory_controller" + /> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="物料编码"> <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input> </a-form-item> @@ -127,6 +136,8 @@ > <a-button type="primary" icon="import">导入</a-button> </a-upload> + <a-button v-has="'inventoryDetail:controller'" @click='controller()' type='primary'>受控</a-button> + <a-button v-has="'inventoryDetail:releaseController'" @click='releaseController()' type='primary'>释放受控</a-button> <!-- 高级查询区域 --> <j-super-query :fieldList="superFieldList" @@ -144,10 +155,10 @@ <!-- table区域-begin --> <div> - <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">--> - <!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项--> - <!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> - <!-- </div>--> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> <a-table ref="table" @@ -159,9 +170,16 @@ :dataSource="dataSource" :pagination="ipagination" :loading="loading" + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="j-table-force-nowrap" @change="handleTableChange" > + <span slot="controller_dictText" slot-scope="controller_dictText"> + <a-tag :key="controller_dictText" :color="getStatusColor(controller_dictText)"> + {{ controller_dictText }} + </a-tag> + </span> + <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText"> <a-tag :key="inventoryStatus_dictText" :color="getStatusColor(inventoryStatus_dictText)"> {{ inventoryStatus_dictText }} @@ -216,7 +234,8 @@ import {mixinDevice} from '@/utils/mixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin' import SimpleInventoryDetailModal from './modules/SimpleInventoryDetailModal' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' -import {getCompanyList, getZoneList} from "@api/api"; +import {getCompanyList, getZoneList, } from "@api/api"; +import {postAction} from '@/api/manage' export default { name: 'InventoryDetailList', @@ -308,6 +327,12 @@ export default { scopedSlots: {customRender: 'inventoryStatus_dictText'} }, { + title: '受控状态', + align: 'center', + dataIndex: 'controller_dictText', + scopedSlots: {customRender: 'controller_dictText'} + }, + { title: '批次', align: 'center', dataIndex: 'batch' @@ -361,7 +386,10 @@ export default { delete: '/inventory/inventoryDetail/delete', deleteBatch: '/inventory/inventoryDetail/deleteBatch', exportXlsUrl: '/inventory/inventoryDetail/exportXls', - importExcelUrl: 'inventory/inventoryDetail/importExcel' + importExcelUrl: 'inventory/inventoryDetail/importExcel', + controller: 'inventory/inventoryHeader/controller', + quickShipment: 'inventory/inventoryHeader/quickShipment', + releaseController: 'inventory/inventoryHeader/releaseController', }, dictOptions: {}, superFieldList: [] @@ -407,7 +435,80 @@ export default { } }) }, - + controller: function() { + if (this.selectedRowKeys.length <= 0) { + this.$message.warning('请选择一条记录!') + } else { + let that = this; + this.$confirm({ + title: '确认受控', + content: '是否受控选中数据?', + onOk: function() { + that.loading = true; + postAction(that.url.controller, that.selectedRowKeys).then((res) => { + if (res.success) { + //重新计算分页问题 + that.reCalculatePage(that.selectedRowKeys.length); + that.$message.success(res.message); + that.loadData(); + that.onClearSelected(); + } else { + that.$message.warning(res.message); + this.selectedRowKeys = []; + } + }).finally(() => { + that.loading = false; + }) + } + }) + } + }, + releaseController() { + if (this.selectedRowKeys.length <= 0) { + this.$message.warning('请选择一条记录!') + } else { + let that = this; + this.$confirm({ + title: '释放受控', + content: '释放受控选中数据?', + onOk: function() { + that.loading = true; + postAction(that.url.releaseController, that.selectedRowKeys).then((res) => { + if (res.success) { + //重新计算分页问题 + that.reCalculatePage(that.selectedRowKeys.length); + that.$message.success(res.message); + that.loadData(); + that.onClearSelected(); + } else { + that.$message.warning(res.message); + this.selectedRowKeys = []; + } + }).finally(() => { + that.loading = false; + }) + } + }) + } + }, + quickShipment() { + if (this.selectedRowKeys.length <= 0) { + this.$message.warning('请选择一条记录!'); + } else { + let zoneCodes = this.selectRecord.map(row => row.zoneCode) + if (new Set(zoneCodes).size !== 1) { + this.$message.warning('所选数据非同库区'); + return; + } + if ('D' !== this.selectRecord[0].zoneCode){ + this.$refs.quickShipmentModel.model.containerCode = this.selectRecord[0].containerCode; + this.$refs.quickShipmentModel.edit(); + this.$refs.quickShipmentModel.title = '选择出库口'; + }else { + this.quickShipmentModalFormOk(null) + } + } + }, solutionCompany(value) { var actions = [] Object.keys(this.companyList).some(key => { @@ -443,6 +544,7 @@ export default { fieldList.push({type: 'BigDecimal', value: 'qty', text: '数量', dictCode: ''}) fieldList.push({type: 'BigDecimal', value: 'taskQty', text: '任务锁定数量', dictCode: ''}) fieldList.push({type: 'string', value: 'inventoryStatus', text: '库存状态', dictCode: 'inventory_status'}) + fieldList.push({type: 'int', value: 'controller', text: '受控状态', dictCode: 'inventory_controller'}) fieldList.push({type: 'string', value: 'batch', text: '批次', dictCode: ''}) // fieldList.push({type:'string',value:'sn',text:'序列号',dictCode:''}) fieldList.push({type: 'datetime', value: 'receiptDate', text: '入库日期'}) diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java index 209ec74..202c1ab 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java @@ -243,6 +243,9 @@ public class WcsServiceImpl implements WcsService { // 如果是外侧库位,那么就要判断该库位对应的内侧库位是不是有托盘 if (rowFlag == QuantityConstant.ROW_OUT) { Location insideLocation = locationService.getInsideNear(location); + if (insideLocation == null) { + return Result.error("分配库位时" + locationCode + "没有找到对应的内侧库位"); + } if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { Location destinationLocation = locationService.getEmptyLocation(insideLocation); if (destinationLocation == null) { @@ -348,6 +351,9 @@ public class WcsServiceImpl implements WcsService { if (rowFlag == QuantityConstant.ROW_OUT) { // 找到对应内侧库位 Location insideLocation = locationService.getInsideNear(fromLocation); + if (insideLocation == null) { + return Result.error("分配库位时" + fromLocation + "没有找到对应的内侧库位"); + } String insideLocationCode = insideLocation.getCode(); // 如果对应内侧库位有托盘 if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java index 03de7ab..e143c01 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java @@ -13,12 +13,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.wms.config.container.service.IContainerService; -import org.jeecg.modules.wms.config.location.dto.CompareContainerTaskDto; -import org.jeecg.modules.wms.config.location.dto.CompareLocationDto; -import org.jeecg.modules.wms.config.location.dto.CompareLocationTaskDto; -import org.jeecg.modules.wms.config.location.dto.QueryCompareContainerTaskDto; -import org.jeecg.modules.wms.config.location.dto.QueryCompareLocationDto; -import org.jeecg.modules.wms.config.location.dto.QueryCompareLocationTaskDto; +import org.jeecg.modules.wms.config.location.dto.*; import org.jeecg.modules.wms.config.location.entity.BatchLocation; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; @@ -28,15 +23,7 @@ import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -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.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -79,8 +66,17 @@ public class LocationController extends JeecgController<Location, ILocationServi public Result<IPage<Location>> queryPageList(Location location, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { HuahengJwtUtil.setWarehouseCode(req, location); + Integer haveContainer = location.getHaveContainerInLocation(); + location.setHaveContainer(null); QueryWrapper<Location> queryWrapper = QueryGenerator.initQueryWrapper(location, null); LambdaQueryWrapper<Location> locationLambdaQueryWrapper = queryWrapper.lambda(); + if (haveContainer != null) { + if (haveContainer == QuantityConstant.STATUS_NOT_CONTAINER) { + locationLambdaQueryWrapper.eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + } else if (haveContainer == QuantityConstant.STATUS_HAVE_CONTAINER) { + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + } + } locationLambdaQueryWrapper.orderByAsc(Location::getId); Page<Location> page = new Page<Location>(pageNo, pageSize); IPage<Location> pageList = locationService.page(page, locationLambdaQueryWrapper); @@ -252,7 +248,8 @@ public class LocationController extends JeecgController<Location, ILocationServi String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); String containerCode = location.getContainerCode(); String locationCode = location.getCode(); - List<Location> locationList = locationService.getContainerInLocation(containerCode, QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, locationCode, warehouseCode); + List<Location> locationList = + locationService.getContainerInLocation(containerCode, QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, locationCode, warehouseCode); return Result.OK(locationList); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/entity/Location.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/entity/Location.java index e55d612..e58c100 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/entity/Location.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/entity/Location.java @@ -1,22 +1,23 @@ package org.jeecg.modules.wms.config.location.entity; import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Date; import java.math.BigDecimal; +import java.util.Date; import java.util.List; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; +import org.jeecgframework.poi.excel.annotation.Excel; + import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.springframework.format.annotation.DateTimeFormat; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.jeecg.common.aspect.annotation.Dict; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -141,4 +142,25 @@ public class Location implements Serializable { /** 库存所在库位状态 */ @TableField(exist = false) private String locationAttribute; + /** 库位是否有托盘 */ + @TableField(exist = false) + @Dict(dicCode = "have_container_in_location") + private Integer haveContainer; + + public void setHaveContainer(Integer haveContainer) { + this.haveContainer = haveContainer; + } + + public Integer getHaveContainer() { + if (StringUtils.isNotEmpty(containerCode)) { + return QuantityConstant.STATUS_HAVE_CONTAINER; + } else { + return QuantityConstant.STATUS_NOT_CONTAINER; + } + } + + public Integer getHaveContainerInLocation() { + return this.haveContainer; + } + } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java index 00be7a0..ec9ade2 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java @@ -14,6 +14,7 @@ import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; @@ -27,6 +28,7 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderS import org.jeecg.utils.HuahengJwtUtil; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; +import org.jeecg.utils.support.ApiLogger; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -342,4 +344,27 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, /*--------------------------------子表处理-库存详情-end----------------------------------------------*/ + @AutoLog("库存详情-释放受控") + @ApiOperation(value = "释放受控", notes = "释放受控") + @ApiLogger(apiName = "释放受控") + @PostMapping(value = "/releaseController") + @ResponseBody + public Result releaseController(@RequestBody List<Integer> ids, HttpServletRequest req) { + if (StringUtils.isEmpty(ids)) { + throw new JeecgBootException("库存明细id为空"); + } + return inventoryDetailService.releaseController(ids); + } + + @AutoLog("库存详情-批量受控") + @ApiOperation(value = "批量受控", notes = "批量受控") + @ApiLogger(apiName = "批量受控") + @PostMapping("/controller") + @ResponseBody + public Result controller(@RequestBody List<Integer> ids) { + if (StringUtils.isEmpty(ids)) { + return Result.error("库存明细id为空"); + } + return inventoryDetailService.controller(ids); + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java index e7b8cbf..f1bb1fa 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java @@ -125,6 +125,11 @@ public class InventoryDetail implements Serializable { @Excel(name = "库龄(天)", width = 15) @ApiModelProperty(value = "库龄(天)") private Integer inventoryAge; + /** 受控 */ + @Excel(name = "受控", width = 15) + @Dict(dicCode = "inventory_controller") + @ApiModelProperty(value = "受控") + private Integer controller; /** 备用字段1 */ @Excel(name = "备用字段1", width = 15) @ApiModelProperty(value = "备用字段1") diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java index 8088443..d315926 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java @@ -3,6 +3,7 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service; import java.math.BigDecimal; import java.util.List; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -59,4 +60,18 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { * @param inventoryDetailList */ void calculateInventoryAge(List<InventoryDetail> inventoryDetailList); + + /** + * 批量设置受控 + * @param inventoryDetailIdList 库存明细id + * @return + */ + Result controller(List<Integer> inventoryDetailIdList); + + /** + * 批量释放受控 + * @param inventoryDetailIdList 库存明细id + * @return + */ + Result releaseController(List<Integer> inventoryDetailIdList); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java index c4b4be1..50e6fbf 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java @@ -9,14 +9,20 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Resource; + +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -48,6 +54,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe @Autowired private IContainerCapacityService containerCapacityService; + @Resource + private IInventoryHeaderService inventoryHeaderService; + @Override public List<InventoryDetail> selectByMainId(String mainId) { return inventoryDetailMapper.selectByMainId(mainId); @@ -96,7 +105,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe .eq(StringUtils.isNotEmpty(inventoryDetail.getBatch()), InventoryDetail::getBatch, inventoryDetail.getBatch()) .eq(StringUtils.isNotEmpty(inventoryDetail.getLot()), InventoryDetail::getLot, inventoryDetail.getLot()) .eq(StringUtils.isNotEmpty(inventoryDetail.getProject()), InventoryDetail::getProject, inventoryDetail.getLot()) - .eq(InventoryDetail::getTaskQty, BigDecimal.ZERO).eq(InventoryDetail::getCompanyCode, inventoryDetail.getCompanyCode()); + .eq(InventoryDetail::getController, QuantityConstant.CONTROLLER_NOT_ENABLE) + .eq(InventoryDetail::getContainerStatus, QuantityConstant.STATUS_CONTAINER_EMPTY).eq(InventoryDetail::getTaskQty, BigDecimal.ZERO) + .eq(InventoryDetail::getCompanyCode, inventoryDetail.getCompanyCode()); List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); if (inventoryDetailList.size() == 0) { return BigDecimal.ZERO; @@ -189,4 +200,46 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe } } } + + @Override + public Result controller(List<Integer> inventoryDetailIdList) { + List<InventoryDetail> inventoryDetailList = listByIds(inventoryDetailIdList); + if (StringUtils.isEmpty(inventoryDetailList)) { + return Result.error("没有找到库存详情"); + } + List<InventoryDetail> inventoryDetailUpdateList = new ArrayList<>(); + List<Integer> inventoryHeaderIdList = inventoryDetailList.stream().map(InventoryDetail::getInventoryHeaderId).distinct().collect(Collectors.toList()); + List<InventoryHeader> inventoryHeaderList = inventoryHeaderService.listByIds(inventoryHeaderIdList); + for (InventoryDetail inventoryDetail : inventoryDetailList) { + InventoryDetail inventoryDetail1 = new InventoryDetail(); + inventoryDetail1.setId(inventoryDetail.getId()); + inventoryDetail1.setController(QuantityConstant.CONTROLLER_ENABLE); + inventoryDetailUpdateList.add(inventoryDetail1); + } + boolean success = updateBatchById(inventoryDetailUpdateList); + if (success) { + return Result.ok("批量受控库存成功"); + } + return Result.ok("批量受控库存失败"); + } + + @Override + public Result releaseController(List<Integer> inventoryDetailIdList) { + List<InventoryDetail> inventoryDetailList = listByIds(inventoryDetailIdList); + if (StringUtils.isEmpty(inventoryDetailList)) { + return Result.error("没有找到库存详情"); + } + List<InventoryDetail> inventoryDetailUpdateList = new ArrayList<>(); + for (InventoryDetail inventoryDetail : inventoryDetailList) { + InventoryDetail inventoryDetail1 = new InventoryDetail(); + inventoryDetail1.setId(inventoryDetail.getId()); + inventoryDetail1.setController(QuantityConstant.CONTROLLER_NOT_ENABLE); + inventoryDetailUpdateList.add(inventoryDetail1); + } + boolean success = updateBatchById(inventoryDetailUpdateList); + if (success) { + return Result.ok("批量释放受控库存成功"); + } + return Result.ok("批量释放受控库存失败"); + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java index 7ed5964..e23251f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import javax.annotation.Resource; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; @@ -68,6 +69,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe } @Override + @Transactional public boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode) { Container container = containerService.getContainerByCode(containerCode, warehouseCode); if (container == null) { @@ -75,63 +77,62 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe } InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); if (inventoryHeader != null) { - boolean success = inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId()); - if (!success) { - return success; + if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) { + throw new JeecgBootException("更新库存头表状态失败"); } List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); - List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); + List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); if (inventoryDetailList.size() > 0) { for (InventoryDetail inventoryDetail : inventoryDetailList) { - inventoryDetail.setContainerStatus(container.getStatus()); - InventoryDetail inventoryDetail1 = new InventoryDetail(); - inventoryDetail1.setId(inventoryDetail.getId()); - inventoryDetail1.setContainerStatus(container.getStatus()); - inventoryDetailList1.add(inventoryDetail1); + InventoryDetail updateInventoryDetail = new InventoryDetail(); + updateInventoryDetail.setId(inventoryDetail.getId()); + updateInventoryDetail.setContainerStatus(container.getStatus()); + updateInventoryDetailList.add(updateInventoryDetail); + } + if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) { + throw new JeecgBootException("更新库存明细表状态失败"); } - success = inventoryDetailService.updateBatchById(inventoryDetailList1); } - return success; } return true; } @Override + @Transactional public boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id) { InventoryHeader inventoryHeader = new InventoryHeader(); inventoryHeader.setId(id); inventoryHeader.setLocationCode(locationCode); inventoryHeader.setZoneCode(zoneCode); - boolean success = inventoryHeaderService.updateById(inventoryHeader); - return success; + return inventoryHeaderService.updateById(inventoryHeader); } @Override + @Transactional public boolean updateContainerStatusById(String containerStatus, Integer id) { InventoryHeader inventoryHeader = new InventoryHeader(); inventoryHeader.setId(id); inventoryHeader.setContainerStatus(containerStatus); - boolean success = inventoryHeaderService.updateById(inventoryHeader); - return success; + return inventoryHeaderService.updateById(inventoryHeader); } @Override + @Transactional public boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id) { InventoryHeader inventoryHeader = new InventoryHeader(); inventoryHeader.setId(id); inventoryHeader.setContainerStatus(containerStatus); inventoryHeader.setLocationCode(locationCode); - boolean success = inventoryHeaderService.updateById(inventoryHeader); - return success; + return inventoryHeaderService.updateById(inventoryHeader); } @Override + @Transactional public boolean updateLocationCodeById(String locationCode, Integer id) { InventoryHeader inventoryHeader = new InventoryHeader(); inventoryHeader.setId(id); inventoryHeader.setLocationCode(locationCode); - boolean success = inventoryHeaderService.updateById(inventoryHeader); - return success; + return inventoryHeaderService.updateById(inventoryHeader); } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java index 152e7cd..f6fc148 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java @@ -27,6 +27,8 @@ import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService import org.jeecg.modules.wms.receipt.receiving.domain.Receive; import org.jeecg.modules.wms.receipt.receiving.mapper.ReceiveMapper; import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; @@ -75,6 +77,8 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl private IParameterConfigurationService parameterConfigurationService; @Resource private IReceiveService receiveService; + @Resource + private IShipmentContainerHeaderService shipmentContainerHeaderService; /** * 组盘后自动生成任务,返回任务实体 @@ -136,6 +140,10 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl if (containerType == null) { return Result.error("入库组盘,容器类型为空" + containerCode); } + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getUnCompleteShipmentContainerByCode(containerCode, warehouseCode); + if (shipmentContainerHeader != null) { + throw new JeecgBootException("入库组盘,容器" + containerCode + "不能有出库配盘"); + } int taskType = QuantityConstant.TASK_TYPE_WHOLERECEIPT; String fromLocationCode = container.getLocationCode(); if (StringUtils.isNotEmpty(fromLocationCode)) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java index 0ced322..7ad163c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java @@ -112,7 +112,8 @@ public class ShipmentCombinationController { @ResponseBody public Result createShipmentTask(@RequestBody ShipmentContainerHeader shipmentContainerHeader, HttpServletRequest req) { String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); - return huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0, 0, 0); + Result result = huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0, 0, 0); + return result; } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java index 2e570c5..5a02c06 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java @@ -15,17 +15,17 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; */ public interface IShipmentCombinationService { - public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail); + List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail); - public Result autoCombination(String shipmentCode, String warehouseCode); + Result autoCombination(String shipmentCode, String warehouseCode); - public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); + Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); - public Result getInventoryFromShipmentDetail(Integer shipmentDetailId); + Result getInventoryFromShipmentDetail(Integer shipmentDetailId); - public Result combination(CombinationModel combinationModel); + Result combination(CombinationModel combinationModel); - public Result autoCombinationDetail(ShipmentDetail shipmentDetail, BigDecimal shipQty); + Result autoCombinationDetail(ShipmentDetail shipmentDetail, BigDecimal shipQty); ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java index e6b0176..f77a57c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java @@ -97,6 +97,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi * @return */ @Override + @Transactional(rollbackFor = JeecgBootException.class) public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail) { String warehouseCode = shipmentDetail.getWarehouseCode(); String companyCode = shipmentDetail.getCompanyCode(); @@ -116,7 +117,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi } LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode).eq(InventoryDetail::getCompanyCode, companyCode) - .eq(InventoryDetail::getMaterialCode, materialCode).eq(InventoryDetail::getInventoryStatus, inventoryStatus); + .eq(InventoryDetail::getMaterialCode, materialCode).eq(InventoryDetail::getInventoryStatus, inventoryStatus) + .eq(InventoryDetail::getController, QuantityConstant.CONTROLLER_NOT_ENABLE) + .eq(InventoryDetail::getContainerStatus, QuantityConstant.STATUS_CONTAINER_EMPTY); List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); return inventoryDetailList; } @@ -169,7 +172,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if (shipQty != null) { shipmentQty = shipQty; } - List<InventoryDetail> inventoryList = getInventorys(shipmentDetail); + List<InventoryDetail> inventoryList = shipmentCombinationService.getInventorys(shipmentDetail); // 去除已锁的库存 ArrayList<InventoryDetail> removeInventoryList = new ArrayList<>(); List<ReceiptContainerHeader> receiptContainerHeaderList = receiptContainerHeaderService.getUnCompleteCombineList(); @@ -200,7 +203,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi } inventoryList.removeAll(removeInventoryList); if (inventoryList.size() < 1) { - return Result.error(shipmentDetail.getMaterialName() + "' 没有符合出库条件的库存"); + return Result.error(shipmentDetail.getMaterialName() + "没有符合出库条件的库存"); } for (InventoryDetail inventoryDetail : inventoryList) { @@ -268,6 +271,10 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { return Result.error("配盘时, 容器已经锁定,不能再组盘"); } + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); + if (receiptContainerHeader != null) { + return Result.error("配盘时, 容器有入库组盘不能再组盘,容器编码" + containerCode); + } BigDecimal shipmentDetailQty = shipmentDetail.getQty(); BigDecimal shipmentDetailTaskQty = shipmentDetail.getTaskQty(); // 可出数量 @@ -590,13 +597,14 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi } @Override + @Transactional(rollbackFor = JeecgBootException.class) public Result getInventoryFromShipmentDetail(Integer shipmentDetailId) { ShipmentDetail shipmentDetail = shipmentDetailService.getById(shipmentDetailId); if (shipmentDetail == null) { return Result.error("找不到出库单详情"); } String warehouseCode = shipmentDetail.getWarehouseCode(); - List<InventoryDetail> inventoryDetailList = getInventorys(shipmentDetail); + List<InventoryDetail> inventoryDetailList = shipmentCombinationService.getInventorys(shipmentDetail); if (inventoryDetailList.size() == 0) { return Result.error("该物料没有库存或没有符合出库规则的库存"); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java index 7f2045f..7dc8bf5 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java @@ -18,6 +18,8 @@ import org.jeecg.modules.wms.config.material.service.impl.MaterialServiceImpl; import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper; @@ -73,6 +75,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap private ContainerServiceImpl containerServiceImpl; @Resource private IParameterConfigurationService parameterConfigurationService; + @Resource + private IReceiptContainerHeaderService receiptContainerHeaderService; + @Resource + private IShipmentContainerHeaderService shipmentContainerHeaderService; @Override @Transactional @@ -224,6 +230,14 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { toLocationCode = fromLocationCode; } + // 校验入库组盘 + if (receiptContainerHeaderService.havaUnCompleteCombineByContainerCode(containerCode, warehouseCode)) { + return Result.error("创建出盘点任务时,容器:" + containerCode + "存在入库组盘,不能移库"); + } + // 校验出库组盘 + if (shipmentContainerHeaderService.havaUnCompleteCombineByContainerCode(containerCode, warehouseCode)) { + return Result.error("创建出盘点任务时, 容器:" + containerCode + "存在出库组盘,不能移库"); + } Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_CYCLECOUNT, containerCode, fromLocationCode, toLocationCode, warehouseCode); if (!result.isSuccess()) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java index 365ac88..f39c5c9 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java @@ -367,8 +367,7 @@ public class TaskHeaderController extends HuahengBaseController { result = handleMultiProcess("cancelTask", new MultiProcessListener() { @Override public Result<?> doProcess() { - Result result = taskHeaderService.cancelTask(taskId); - return result; + return taskHeaderService.cancelTask(taskId); } }); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 6f18a45..013f8cc 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -62,7 +62,6 @@ import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; @@ -298,6 +297,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (container == null) { return Result.error("创建出库查看任务时,容器为空"); } + // 校验入库组盘 + if (receiptContainerHeaderService.havaUnCompleteCombineByContainerCode(containerCode, warehouseCode)) { + return Result.error("创建出库查看任务时,容器:" + containerCode + "存在入库组盘,不能移库"); + } + // 校验出库组盘 + if (shipmentContainerHeaderService.havaUnCompleteCombineByContainerCode(containerCode, warehouseCode)) { + return Result.error("创建出库查看任务时, 容器:" + containerCode + "存在出库组盘,不能移库"); + } String fromLocationCode = container.getLocationCode(); String toLocationCode = QuantityConstant.EMPTY_STRING; String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); @@ -825,31 +832,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { return Result.ok("任务(" + taskId + ")任务已经是完成的!"); } - if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { - Result result = wcsService.cancelWcsTask(taskHeader); - if (!result.isSuccess()) { - return result; - } - } - int taskType = taskHeader.getTaskType().intValue(); - int preTaskNo = taskId; - String warehouseCode = taskHeader.getWarehouseCode(); - TaskHeader preTaskHeader = getUnCompleteTaskByPreTaskNo(preTaskNo, warehouseCode); + TaskHeader preTaskHeader = getUnCompleteTaskByPreTaskNo(taskId, taskHeader.getWarehouseCode()); if (preTaskHeader != null) { return Result.error("取消任务失败,有前置任务" + preTaskHeader.getId()); } - boolean success = taskHeaderService.removeById(taskId); - if (!success) { - return Result.error("取消任务失败, 删除任务失败"); + if (!taskHeaderService.removeById(taskId)) { + throw new JeecgBootException("取消任务失败, 删除任务失败"); } List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskId); if (taskDetailList.size() > 0) { List<Integer> taskDetailIdList = taskDetailList.stream().map(TaskDetail::getId).collect(Collectors.toList()); - success = taskDetailService.removeByIds(taskDetailIdList); - if (!success) { - return Result.error("取消任务失败, 删除任务详情失败"); + if (!taskDetailService.removeByIds(taskDetailIdList)) { + throw new JeecgBootException("取消任务失败, 删除任务详情失败"); } } + int taskType = taskHeader.getTaskType().intValue(); Result result = Result.ok("取消任务成功"); switch (taskType) { case QuantityConstant.TASK_TYPE_WHOLERECEIPT: @@ -862,6 +859,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea break; } taskHeaderService.cancelLocationAndContainerStatus(taskHeader); + if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { + result = wcsService.cancelWcsTask(taskHeader); + if (!result.isSuccess()) { + throw new JeecgBootException(result.getMessage()); + } + } log.info("完成取消任务" + taskHeader.getId()); return result; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index b55e56d..55b29b4 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -552,6 +552,11 @@ public class QuantityConstant { /* 不可用 */ public static final int STATUS_DISABLE = 0; + /* 库内有托盘 */ + public static final int STATUS_HAVE_CONTAINER = 1; + /* 库内没有托盘 */ + public static final int STATUS_NOT_CONTAINER = 0; + public static final int HTTP_OK = 200; public static final String URL = "http://erptest.gani.com.cn/K3Cloud/"; @@ -561,116 +566,28 @@ public class QuantityConstant { public static final String SRC_STOCK_ID_BH = "10237102"; public static final String DEST_STOCK_ID = "10237102"; - public static final String PORTGROUP_P1 = "P1"; // 拆垛机1 - public static final String PORTGROUP_P2 = "P2"; // 拆垛机2 - public static final String PORTGROUP_P3 = "P3"; // 拆垛机3 - public static final String PORTGROUP_P11 = "P11"; // 码垛机1 - public static final String PORTGROUP_P12 = "P12"; // 码垛机2 - public static final String PORTGROUP_P13 = "P13"; // 码垛机3 - public static final String PORTGROUP_P30 = "P30"; // 出库到备货区 - public static final String PORTGROUP_P31 = "P31"; // 单片分拣 - public static final String PORTGROUP_P40 = "P40"; // 库内质检到入库缓存区 - - public static final String PORTGROUP_P10 = "P10"; // 异常口 - - public static final String PORT_P1000 = "P1000"; // 入库端 出口 - public static final String PORT_P1004 = "P1004"; // 入库端 出口 - public static final String PORT_P1001 = "P1001"; // 入库端 入口 - public static final String PORT_P1005 = "P1005"; // 入库端 入口 - - public static final int CONTAINER_SPEC_1100 = 1; // 1100*1100木托盘 - public static final int CONTAINER_SPEC_800 = 2; // 800*1135木托盘 - - public static final int MOVE_SLIDER_OR_PAPER = 1; // 把拆盘机的纸皮滑块搬走 - public static final int PUT_SLIDER_OR_PAPER = 2; // 放纸皮滑块到拆盘机 - public static final String WORK_SHOP = "BM000346"; // 生产车间 // test // public static final String SRC_STOCK_ID_BH = "9988308"; // public static final String SRC_STOCK_ID = "9989058"; // public static final String DEST_STOCK_ID = "9989057"; - public static final int CONTAINER_TYPE_SMALL = 0; // 800*1135 - public static final int CONTAINER_TYPE_MIDDLE = 1; // 1100*1100 - public static final int CONTAINER_TYPE_LARGE = 2; - public static final int AGV_TASK_NOT_CREATE = 0; // 没有创建过AGV任务 public static final int AGV_TASK_ALREADY_CREATE = 1; // 创建过AGV任务 // 第三方打印工具 public static final String PRINT_SERVICE = "PRINT_SERVICE"; - // BosAssistantDetail 其他入库类型 key值 - public static final String BOS_ASSISTANT_KEY_QTRKLX = "QTRKLX"; - - // 贴标机1 - public static final String PRINT_ADDRESS_11 = "PRINT_ADDRESS_P11"; - - // 贴标机2 - public static final String PRINT_ADDRESS_12 = "PRINT_ADDRESS_P12"; - - // 贴标机3 - public static final String PRINT_ADDRESS_13 = "PRINT_ADDRESS_P13"; - - // 贴标机3 - public static final Integer PRINT_PORE = 3003; - - // 下载单据参数剥离 - public static final String MATERIAL_FILTERSTRING = "material_FilterString"; - - public static final String CUSTOMER_FILTERSTRING = "customer_FilterString"; - - public static final String USER_FILTERSTRING = "user_FilterString"; - - public static final String DEPT_FILTERSTRING = "dept_FilterString"; - - public static final String PROPACKAGING_FILTERSTRING = "proPackaging_FilterString"; - - public static final String PRODUCTSIZE_FILTERSTRING = "productSize_FilterString"; - - public static final String STOCK_FILTERSTRING = "stock_FilterString"; - - public static final String FLEXVALUES_FILTERSTRING = "flexValues_FilterString"; - - public static final String PRODUCTSCHEDULE_FILTERSTRING = "productSchedule_FilterString"; - public static final String PRODUCTSCHEDULEHEADER_FILTERSTRING = "productScheduleHeader_FilterString"; - public static final String PRODUCTSCHEDULEDETAIL_FILTERSTRING = "productScheduleDetail_FilterString"; - - public static final String UNIT_FILTERSTRING = "unit_FilterString"; - public static final String ACCEPTABLE_PRODUCT_LEVEL = "03"; // 合格品 - - public static final String BOSASSISTANTDETAIL_FILTERSTRING = "bosAssistantDetail_FilterString"; - - public static final String SHIPMENTREQUEST_FILTERSTRING = "shipmentRequest_FilterString"; - - public static final String DEILVERYNOTICE_FILTERSTRING = "deliveryNotice_FilterString"; - - public static final String RETURNNOTICE_FILTERSTRING = "returnNotice_FilterString"; - - public static final String BEFORE_BILL_DATE_NUM = "before_bill_date_num"; - - public static final String MAXIMIM_NUMBER_OF_SLICES = "maximum_number_of_slices"; - - public static final String ERP_RETURN_QTY = "erp_Return_Qty"; - - public static final String DEBUG_SERVER = "debug_Server"; - - public static final String ERP_K3CLOUD_SAVE = "ERP_K3CLOUD_SAVE"; - public static final String ERP_K3CLOUD_POST = "ERP_K3CLOUD_POST"; - public static final String ERP_K3CLOUD_QUERY = "ERP_K3CLOUD_QUERY"; - public static final String ERP_K3CLOUD_LOGIN = "ERP_K3CLOUD_LOGIN"; - public static final String ERP_SESSION_ID = "SESSION_ID"; - - public static final String ERP_AcctID = "62ac23107f9b3a"; - public static final String ERP_AppID = "229087_551NSbjs7PCe29Up2/QCV/UG6tW+WAtu"; - public static final String ERP_AppSec = "d7c33e41b2ff47d09273163d8e55e45c"; - public static final String ERP_UserName = "productadmin"; - public static final String ERP_PASSWORD = "123123"; - public static final String ERP_LCID = "2052"; - public static final String ERP_ServerUrl = "http://erptest.gani.com.cn/K3Cloud/"; - public static final String UPSTREAM_DELETE_RECEIPT = "上游删除"; public static final String BACK_DELETE_RECEIPT = "回传删除"; public static final String WMS_DELETE_RECEIPT = "WMS删除"; + /** + * 不受控 + */ + public static final int CONTROLLER_NOT_ENABLE = 0; + /** + * 受控,受控的库存详情不能出库 + */ + public static final int CONTROLLER_ENABLE = 1; }