diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue index 17487eb..2d2124a 100644 --- a/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue @@ -74,10 +74,13 @@ </template> <template slot="action" slot-scope="text, record"> <cycle-count-detail-chi-id-modal ref="adjustmentModal" @ok="modalFormOk" :id="record.id"/> - <a @click="createMany()"><a-icon/>新增</a> + <a v-if="record.enableStatus != '100'" @click="createMany()"><a-icon/>新增</a> <a-divider type="vertical"/> - <a v-if="record.enableStatus == '1'" @click="selectPort(record)">生成盘点任务</a> - <a-divider v-if="record.enableStatus == '1'" type="vertical"/> + <a-popconfirm v-if="record.enableStatus === 1" v-has="'cycleCountHeader:delete'" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除 <a-divider type="vertical"/> </a> + </a-popconfirm> + <a v-if="record.enableStatus == '1' && record.zoneType == 'L'" @click="selectPort(record)">生成盘点任务 <a-divider type="vertical"/></a> + <a @click="loadDatas(record.cycleCountHeadId)"><a-icon type="sync"/>刷新</a> </template> @@ -174,6 +177,11 @@ // dataIndex: 'inventoryDetailId', // }, { + title: '库区类型', + align: 'center', + dataIndex: 'zoneType_dictText', + }, + { title: '库位', align: 'center', dataIndex: 'locationCode', @@ -189,6 +197,11 @@ dataIndex: 'inventorySts_dictText', }, { + title: '状态', + align: 'center', + dataIndex: 'enableStatus_dictText', + }, + { title: '系统数量', align: 'center', dataIndex: 'systemQty', @@ -219,11 +232,6 @@ dataIndex: 'completedAt', }, { - title: '状态', - align: 'center', - dataIndex: 'enableStatus_dictText', - }, - { title: '操作', dataIndex: 'action', align: 'center', @@ -252,7 +260,8 @@ mounted() { let _this = this; Utils.$on('methodB',(data)=> { - _this.methodB(data); + this.methodB(data); + this.$emit('ok'); }) }, computed: { @@ -293,6 +302,7 @@ loadDatas(record) { this.loading = true this.dataSource = [] + console.log("loadDatas " + record) getAction(this.url.list, { cycleCountHeadId: record }).then((res) => { @@ -341,7 +351,7 @@ createMany() { this.$refs.adjustmentModal.edit(); - this.$refs.adjustmentModal.title = "实盘登记"; + this.$refs.adjustmentModal.title = "新增"; }, } } diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue index 2e4e1f0..5be65f1 100644 --- a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue @@ -89,10 +89,10 @@ export default { confirmGapQty(this.model).then((res) => { if (res.success) { that.$message.success(res.message); - that.$emit('ok'); + // Utils.$emit('methodB',res.result); that.model.containerCode = ''; that.model.toLocationCode = ''; - Utils.$emit('methodB',res.result); + that.$emit('ok'); } else { that.$message.warning(res.message); } diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue index aebe6bb..02c58ac 100644 --- a/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue @@ -23,7 +23,7 @@ <template slot="action" slot-scope="text, record"> <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk"/> - <a v-if="record.childStatus != 1" @click="createMany(record)"><a-icon />实盘登记</a> + <a v-if="record.childStatus != 1 && record.childStatus != 100" @click="createMany(record)"><a-icon />实盘登记</a> </template> <template slot="fileSlot" slot-scope="text"> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java index 3fdc09c..5016765 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -25,8 +25,6 @@ import org.jeecg.modules.wms.api.mobile.service.IMobileService; import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; -import org.jeecg.modules.wms.shipment.shipmentCombination.entity.FlatShipment; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; @@ -280,13 +278,13 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS * @param ids * @return */ - @AutoLog(value = "出库单详情-批量删除") - @ApiOperation(value = "出库单详情-批量删除", notes = "出库单详情-批量删除") - @RequiresPermissions("shipmentDetail:deleteBatch") - @DeleteMapping(value = "/deleteBatchShipmentDetail") - public Result<String> deleteBatchShipmentDetail(@RequestParam(name = "ids", required = true) String ids) { - return shipmentDetailService.removeDetailListById(Arrays.asList(ids.split(","))); - } +// @AutoLog(value = "出库单详情-批量删除") +// @ApiOperation(value = "出库单详情-批量删除", notes = "出库单详情-批量删除") +// @RequiresPermissions("shipmentDetail:deleteBatch") +// @DeleteMapping(value = "/deleteBatchShipmentDetail") +// public Result<String> deleteBatchShipmentDetail(@RequestParam(name = "ids", required = true) String ids) { +// return shipmentDetailService.removeDetailListById(Arrays.asList(ids.split(","))); +// } /** * 导出 @@ -460,7 +458,6 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS return result; } - @AutoLog(value = "自动预配盘出库") @ApiOperation(value = "自动预配盘出库", notes = "自动预配盘出库") @PostMapping("/autoShipmentAdvice") diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java index a2f81cf..3912cb0 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java @@ -14,7 +14,6 @@ import org.jeecg.modules.wms.config.material.entity.Material; import org.jeecg.modules.wms.config.material.service.IMaterialService; import org.jeecg.modules.wms.config.zone.entity.Zone; import org.jeecg.modules.wms.config.zone.service.IZoneService; -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; import org.jeecg.modules.wms.shipment.shipmentHeader.mapper.ShipmentDetailMapper; @@ -25,6 +24,7 @@ import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -33,7 +33,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.monitor4all.logRecord.annotation.OperationLog; import cn.monitor4all.logRecord.context.LogRecordContext; -import org.springframework.util.CollectionUtils; /** * @Description: 出库单详情 @@ -218,13 +217,13 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, } } - @Override - @Transactional(rollbackFor = Exception.class) - public Result removeDetailListById(List<String> idList) { - Result result = null; - for (String id : idList) { - result = shipmentHeaderService.deleteShipmentDetail(id); - } - return result; - } +// @Override +// @Transactional(rollbackFor = Exception.class) +// public Result removeDetailListById(List<String> idList) { +// Result result = null; +// for (String id : idList) { +// result = shipmentHeaderService.deleteShipmentDetail(id); +// } +// return result; +// } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java index f047763..303a7c2 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java @@ -139,8 +139,11 @@ public class CycleCountDetailController extends HuahengBaseController { @ApiOperation(value = "盘点明细表-通过id删除", notes = "盘点明细表-通过id删除") @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name = "id", required = true) String id) { - cycleCountDetailService.delMain(id); - return Result.OK("删除成功!"); + if (cycleCountDetailService.delMain(id)) { + return Result.OK("删除成功!"); + } else { + return Result.OK("删除失败!"); + } } /** @@ -152,8 +155,11 @@ public class CycleCountDetailController extends HuahengBaseController { @ApiOperation(value = "盘点明细表-批量删除", notes = "盘点明细表-批量删除") @DeleteMapping(value = "/deleteBatch") public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { - this.cycleCountDetailService.delBatchMain(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); + if (this.cycleCountDetailService.delBatchMain(Arrays.asList(ids.split(",")))) { + return Result.OK("批量删除成功!"); + } else { + return Result.OK("批量删除失败!"); + } } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java index 65b484b..7bdbe77 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java @@ -1,27 +1,27 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.util.Date; + +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; + import com.baomidou.mybatisplus.annotation.IdType; 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; /** * @Description: 盘点明细表 - * @Author: jeecg-boot - * @Date: 2023-01-30 - * @Version: V1.0 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 */ -@ApiModel(value="cycle_count_detail对象", description="盘点明细表") +@ApiModel(value = "cycle_count_detail对象", description = "盘点明细表") @Data @TableName("cycle_count_detail") public class CycleCountDetail implements Serializable { @@ -31,85 +31,90 @@ public class CycleCountDetail implements Serializable { @TableId(type = IdType.AUTO) @ApiModelProperty(value = "主键") private Integer id; - /**盘点主单id*/ - @Excel(name = "盘点主单id", width = 15) + /** 盘点主单id */ + @Excel(name = "盘点主单id", width = 15) @ApiModelProperty(value = "盘点主单id") private Integer cycleCountHeadId; - /**盘点主单code*/ - @Excel(name = "盘点主单code", width = 15) + /** 盘点主单code */ + @Excel(name = "盘点主单code", width = 15) @ApiModelProperty(value = "盘点主单code") private String cycleCountHeadCode; - /**任务表头*/ - @Excel(name = "任务表头", width = 15) + /** 任务表头 */ + @Excel(name = "任务表头", width = 15) @ApiModelProperty(value = "任务表头") private Integer taskHeaderId; - /**仓库*/ - @Excel(name = "仓库", width = 15) + /** 仓库 */ + @Excel(name = "仓库", width = 15) @ApiModelProperty(value = "仓库") private String warehouseCode; - /**货主*/ - @Excel(name = "货主", width = 15) + /** 货主 */ + @Excel(name = "货主", width = 15) @ApiModelProperty(value = "货主") private String companyCode; - /**库存明细头*/ - @Excel(name = "库存明细头", width = 15) + /** 库存明细头 */ + @Excel(name = "库存明细头", width = 15) @ApiModelProperty(value = "库存明细头") private Integer inventoryHeaderId; - /**库位*/ - @Excel(name = "库位", width = 15) + /** 库区类型 */ + @Excel(name = "库区类型", width = 15) + @ApiModelProperty(value = "库区类型") + @Dict(dicCode = "zoneType") + private String zoneType; + /** 库位 */ + @Excel(name = "库位", width = 15) @ApiModelProperty(value = "库位") private String locationCode; - /**容器*/ - @Excel(name = "容器", width = 15) + /** 容器 */ + @Excel(name = "容器", width = 15) @ApiModelProperty(value = "容器") private String containerCode; - /**库存状态*/ - @Excel(name = "库存状态", width = 15) + /** 库存状态 */ + @Excel(name = "库存状态", width = 15) @ApiModelProperty(value = "库存状态") @Dict(dicCode = "inventory_status") private String inventorySts; - /**系统数量*/ - @Excel(name = "系统数量", width = 15) + /** 系统数量 */ + @Excel(name = "系统数量", width = 15) @ApiModelProperty(value = "系统数量") private BigDecimal systemQty; - /**实盘数量*/ - @Excel(name = "实盘数量", width = 15) + /** 实盘数量 */ + @Excel(name = "实盘数量", width = 15) @ApiModelProperty(value = "实盘数量") private BigDecimal countedQty; - /**差异数量*/ - @Excel(name = "差异数量", width = 15) + /** 差异数量 */ + @Excel(name = "差异数量", width = 15) @ApiModelProperty(value = "差异数量") private BigDecimal gapQty; - /**失败原因*/ - @Excel(name = "失败原因", width = 15) + /** 失败原因 */ + @Excel(name = "失败原因", width = 15) @ApiModelProperty(value = "失败原因") private String rejectionNote; - /**完成用户*/ - @Excel(name = "完成用户", width = 15) + /** 完成用户 */ + @Excel(name = "完成用户", width = 15) @ApiModelProperty(value = "完成用户") private String completedBy; - /**完成时间*/ - @Excel(name = "完成时间", width = 15) + /** 完成时间 */ + @Excel(name = "完成时间", width = 15) @ApiModelProperty(value = "完成时间") private Date completedAt; - /**盘点明细状态*/ - @Excel(name = "盘点明细状态", width = 15) + /** 盘点明细状态 */ + @Excel(name = "盘点明细状态", width = 15) @ApiModelProperty(value = "盘点明细状态") - @Dict(dicCode = "cyclecount_status") + @Dict(dicCode = "cycleCount_status") private Integer enableStatus; - /**创建人*/ + /** 创建人 */ @ApiModelProperty(value = "创建人") private String createBy; - /**创建日期*/ + /** 创建日期 */ @ApiModelProperty(value = "创建日期") private Date createTime; - /**更新人*/ + /** 更新人 */ @ApiModelProperty(value = "更新人") private String updateBy; - /**更新日期*/ + /** 更新日期 */ @ApiModelProperty(value = "更新日期") private Date updateTime; - /**所属部门*/ + /** 所属部门 */ @ApiModelProperty(value = "所属部门") private String sysOrgCode; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java index 7ffd95c..189e15f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java @@ -1,28 +1,27 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity; import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; + import com.baomidou.mybatisplus.annotation.IdType; 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 java.math.BigDecimal; -import java.util.Date; -import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.UnsupportedEncodingException; +import lombok.Data; /** * @Description: 盘点容器明细表 - * @Author: jeecg-boot - * @Date: 2023-01-30 - * @Version: V1.0 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 */ -@ApiModel(value="cycle_count_detail_child对象", description="盘点容器明细表") +@ApiModel(value = "cycle_count_detail_child对象", description = "盘点容器明细表") @Data @TableName("cycle_count_detail_child") public class CycleCountDetailChild implements Serializable { @@ -32,87 +31,91 @@ public class CycleCountDetailChild implements Serializable { @TableId(type = IdType.AUTO) @ApiModelProperty(value = "主键") private Integer id; - /**盘点主单code*/ - @Excel(name = "盘点主单code", width = 15) + /** 盘点主单code */ + @Excel(name = "盘点主单code", width = 15) @ApiModelProperty(value = "盘点主单code") private String cyclecountheadcode; - /**盘点明细ID主id*/ + /** 盘点明细ID主id */ @ApiModelProperty(value = "盘点明细ID主id") private Integer cycleCountDetailid; - /**盘点明细子单状态*/ - @Excel(name = "盘点明细子单状态", width = 15) + /** 盘点明细子单状态 */ + @Excel(name = "盘点明细子单状态", width = 15) @ApiModelProperty(value = "盘点明细子单状态") @Dict(dicCode = "cyclecount_status") private Integer childStatus; - /**库位*/ - @Excel(name = "库位", width = 15) + /** 库区类型 */ + @Excel(name = "库区类型", width = 15) + @ApiModelProperty(value = "库区类型") + private String zoneType; + /** 库位 */ + @Excel(name = "库位", width = 15) @ApiModelProperty(value = "库位") private String locationCode; - /**容器*/ - @Excel(name = "容器", width = 15) + /** 容器 */ + @Excel(name = "容器", width = 15) @ApiModelProperty(value = "容器") private String containerCode; - /**物料编码*/ - @Excel(name = "物料编码", width = 15) + /** 物料编码 */ + @Excel(name = "物料编码", width = 15) @ApiModelProperty(value = "物料编码") private String materialCode; - /**物料名称*/ - @Excel(name = "物料名称", width = 15) + /** 物料名称 */ + @Excel(name = "物料名称", width = 15) @ApiModelProperty(value = "物料名称") private String materialName; - /**物料规格*/ - @Excel(name = "物料规格", width = 15) + /** 物料规格 */ + @Excel(name = "物料规格", width = 15) @ApiModelProperty(value = "物料规格") private String materialSpec; - /**物料单位*/ - @Excel(name = "物料单位", width = 15) + /** 物料单位 */ + @Excel(name = "物料单位", width = 15) @ApiModelProperty(value = "物料单位") private String materialUnit; - /**任务明细头*/ + /** 任务明细头 */ @Excel(name = "任务明细头", width = 15) @ApiModelProperty(value = "任务明细头") private Integer taskDetailId; - /**系统数量*/ - @Excel(name = "系统数量", width = 15) + /** 系统数量 */ + @Excel(name = "系统数量", width = 15) @ApiModelProperty(value = "系统数量") private BigDecimal systemQty; - /**实盘数量*/ - @Excel(name = "实盘数量", width = 15) + /** 实盘数量 */ + @Excel(name = "实盘数量", width = 15) @ApiModelProperty(value = "实盘数量") private BigDecimal countedQty; - /**差异数量*/ - @Excel(name = "差异数量", width = 15) + /** 差异数量 */ + @Excel(name = "差异数量", width = 15) @ApiModelProperty(value = "差异数量") private BigDecimal gapQty; - /**库存明细id*/ - @Excel(name = "库存明细id", width = 15) + /** 库存明细id */ + @Excel(name = "库存明细id", width = 15) @ApiModelProperty(value = "库存明细id") private Integer inventoryDetaiId; - /**批次*/ + /** 批次 */ @Excel(name = "批次*/", width = 15) @ApiModelProperty(value = "批次*/") private String batch; - /**批号*/ + /** 批号 */ @Excel(name = "批号", width = 15) @ApiModelProperty(value = "批号") private String lot; - /**库存状态*/ + /** 库存状态 */ @Excel(name = "库存状态", width = 15) @ApiModelProperty(value = "库存状态") private String inventoryStatus; - /**创建人*/ + /** 创建人 */ @ApiModelProperty(value = "创建人") private String createBy; - /**创建日期*/ + /** 创建日期 */ @ApiModelProperty(value = "创建日期") private Date createTime; - /**更新人*/ + /** 更新人 */ @ApiModelProperty(value = "更新人") private String updateBy; - /**更新日期*/ + /** 更新日期 */ @ApiModelProperty(value = "更新日期") private Date updateTime; - /**所属部门*/ + /** 所属部门 */ @ApiModelProperty(value = "所属部门") private String sysOrgCode; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java index ffb3fb1..57a65f1 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java @@ -1,28 +1,34 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service; +import java.util.List; + import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.wms.config.material.entity.Material; import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; + import com.baomidou.mybatisplus.extension.service.IService; -import java.util.List; /** * @Description: 盘点容器明细表 - * @Author: jeecg-boot - * @Date: 2023-01-30 - * @Version: V1.0 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 */ public interface ICycleCountDetailChildService extends IService<CycleCountDetailChild> { - - Result confirmGapQty(String id, String countedQty,String state); + Result confirmGapQty(String id, String countedQty, String state); /** * 盘点报表查询 - * @param queryReportCycleCountDto 查询参数 - * @return 盘点报表信息 + * @param queryReportCycleCountDto 查询参数 + * @return 盘点报表信息 */ List<ReportCycleCountDto> getCycleCountReport(QueryReportCycleCountDto queryReportCycleCountDto); + + /** + * 完成平库盘点登记 + * @return + */ + Result completePingkuConfirmGapQty(String id, String countedQty); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java index cf5893c..887a300 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java @@ -36,7 +36,7 @@ public interface ICycleCountDetailService extends IService<CycleCountDetail> { /** * 批量删除一对多 */ - public void delBatchMain(Collection<? extends Serializable> idList); + public boolean delBatchMain(Collection<? extends Serializable> idList); Result createCycleCoutTaskByDetailId(Integer cycleCoutdetailId, String toPort, String warehouseCode); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java index 67a813d..2541b3d 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl; import java.math.BigDecimal; import java.util.Collections; +import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -10,8 +11,22 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; +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.service.IInventoryDetailService; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; import org.jeecg.modules.wms.report.dto.QueryReportCycleCountDto; import org.jeecg.modules.wms.report.dto.ReportCycleCountDto; +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; 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; @@ -20,10 +35,12 @@ import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeade import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl.CycleCountHeaderServiceImpl; import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; 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.Transactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; @@ -47,8 +64,27 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta private CycleCountHeaderServiceImpl cycleCountHeaderService; @Resource private ITaskDetailService taskDetailService; + @Resource + private CycleCountDetailChildServiceImpl cycleCountDetailChildService; + @Resource + private IInventoryHeaderService inventoryHeaderService; + @Resource + private IInventoryDetailService inventoryDetailService; + @Resource + private IReceiptHeaderService receiptHeaderService; + @Resource + private IReceiptDetailService receiptDetailService; + @Resource + private IInventoryTransactionService inventoryTransactionService; + @Resource + private IShipmentHeaderService shipmentHeaderService; + @Resource + private IShipmentDetailService shipmentDetailService; + @Resource + private ITaskHeaderService taskHeaderService; @Override + @Transactional public Result confirmGapQty(String id, String countedQty, String state) { // 接收子单ID和实盘数量 // 任务未完成可多次登记。 @@ -65,7 +101,10 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta if (StringUtils.isNull(detailChild)) { return Result.error("明细子单不存在!"); } - + String zoneType = detailChild.getZoneType(); + if (StringUtils.isEmpty(zoneType)) { + return Result.error("实盘登记, 盘点明细" + id + "库区类型为空!"); + } BigDecimal qty = new BigDecimal(countedQty); if (qty.compareTo(BigDecimal.ZERO) == -1) { return Result.error("实盘登记数不能小于0"); @@ -132,17 +171,20 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta throw new JeecgBootException("更新盘点表单头失败"); } - TaskDetail taskDetail = new TaskDetail(); - taskDetail.setId(detailChild.getTaskDetailId()); - taskDetail.setCircleQty(qty); - taskDetail.setCircleStatus(QuantityConstant.CIRCLE_REGISTER_STATUS_COMPLETE); - if (!taskDetailService.updateById(taskDetail)) { - throw new JeecgBootException("更新任务详情失败"); + if (zoneType.equals("P")) { + Result result = cycleCountDetailChildService.completePingkuConfirmGapQty(id, countedQty); + if (!result.isSuccess()) { + throw new JeecgBootException("调整平库库存失败"); + } + } else { + TaskDetail taskDetail = new TaskDetail(); + taskDetail.setId(detailChild.getTaskDetailId()); + taskDetail.setCircleQty(qty); + taskDetail.setCircleStatus(QuantityConstant.CIRCLE_REGISTER_STATUS_COMPLETE); + if (!taskDetailService.updateById(taskDetail)) { + throw new JeecgBootException("更新任务详情失败"); + } } - // Result<Integer> result = new Result<Integer>(); - // result.setCode(200); - // result.setMessage("调整成功"); - // result.setResult(cycleCountHeader.getId()); return Result.OK("调整成功"); } @@ -150,4 +192,264 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta public List<ReportCycleCountDto> getCycleCountReport(QueryReportCycleCountDto queryReportCycleCountDto) { return super.baseMapper.selectCycleCount(queryReportCycleCountDto, Collections.singletonList(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)); } + + @Override + @Transactional + public Result completePingkuConfirmGapQty(String id, String countedQty) { + CycleCountDetailChild cycleCountDetailChild = cycleCountDetailChildService.getById(id); + if (cycleCountDetailChild == null) { + return Result.error("完成盘点登记时,盘点容器明细表为空" + id); + } + CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(cycleCountDetailChild.getCycleCountDetailid()); + if (cycleCountDetail == null) { + return Result.error("完成盘点登记时,盘点单详情为空" + cycleCountDetailChild.getCycleCountDetailid()); + } + CycleCountHeader cycleCountHeader = cycleCountHeaderService.getById(cycleCountDetail.getCycleCountHeadId()); + if (cycleCountHeader == null) { + return Result.error("完成盘点登记时,盘点主单为空" + cycleCountDetail.getCycleCountHeadId()); + } + // 2.盘点单主单据查明细单据list + LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = new LambdaQueryWrapper<CycleCountDetailChild>(); + childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, cycleCountDetail.getId()); + List<CycleCountDetailChild> cycleCountDetailChildList = cycleCountDetailChildService.list(childLambdaQueryWrapper); + if (StringUtils.isEmpty(cycleCountDetailChildList)) { + return Result.error("完成盘点任务时,盘点单详情明细为空" + cycleCountDetail.getId()); + } + // 3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单 + InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryHeaderId()); + if (inventoryHeader == null) { + return Result.error("完成盘点任务时,没有找到库存头" + cycleCountDetail.getInventoryHeaderId()); + } + int outboundOrderId = 0; + String outboundOrderCode = null; + int warehousingOrderId = 0; + String warehousingOrderCode = null; + boolean success = false; + for (CycleCountDetailChild child : cycleCountDetailChildList) { + if (child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)) { + continue; + } + if (child.getCountedQty().compareTo(BigDecimal.ZERO) == 0) { + continue; + } + String toLocationCode = inventoryHeader.getLocationCode(); + String warehouseCode = cycleCountHeader.getWarehouseCode(); + String companyCode = cycleCountHeader.getCompanyCode(); + if (child.getInventoryDetaiId() != null) { + InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); + if (inventoryDetail == null) { + throw new JeecgBootException("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); + } + success = inventoryDetailService.updateQtyAndTaskQtyAndLocationCode(child.getCountedQty(), BigDecimal.ZERO, toLocationCode, inventoryDetail.getId()); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新库存详情失败"); + } + } else { + InventoryDetail inventoryDetail = new InventoryDetail(); + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); + inventoryDetail.setWarehouseCode(warehouseCode); + inventoryDetail.setCompanyCode(companyCode); + inventoryDetail.setZoneCode(inventoryHeader.getZoneCode()); + inventoryDetail.setContainerCode(inventoryHeader.getContainerCode()); + inventoryDetail.setLocationCode(toLocationCode); + inventoryDetail.setMaterialCode(child.getMaterialCode()); + inventoryDetail.setMaterialName(child.getMaterialName()); + inventoryDetail.setMaterialSpec(child.getMaterialSpec()); + inventoryDetail.setMaterialUnit(child.getMaterialUnit()); + inventoryDetail.setQty(child.getCountedQty()); + inventoryDetail.setTaskQty(BigDecimal.ZERO); + inventoryDetail.setInventoryStatus(child.getInventoryStatus()); + inventoryDetail.setBatch(child.getBatch()); + success = inventoryDetailService.save(inventoryDetail); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 保存库存详情失败"); + } + child.setInventoryDetaiId(inventoryDetail.getId()); + } + + child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); + if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1) { + if (warehousingOrderId == 0) { + ReceiptHeader receiptHeader = new ReceiptHeader(); + receiptHeader.setWarehouseCode(warehouseCode); + receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_QTR); + receiptHeader.setRemark("盘盈 单号" + cycleCountDetail.getCycleCountHeadCode()); + Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); + if (!result.isSuccess()) { + return result; + } + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + success = receiptHeaderService.updateById(receiptHeader); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新入库表单头失败"); + } + // 生成入库单并且赋值给warehousingOrderId + warehousingOrderId = receiptHeader.getId(); + warehousingOrderCode = receiptHeader.getCode(); + } + + // 生成明细 + ReceiptDetail receiptDetail = new ReceiptDetail(); + receiptDetail.setReceiptId(warehousingOrderId); + receiptDetail.setReceiptCode(warehousingOrderCode); + receiptDetail.setWarehouseCode(warehouseCode); + receiptDetail.setCompanyCode(companyCode); + receiptDetail.setMaterialCode(child.getMaterialCode()); + receiptDetail.setMaterialName(child.getMaterialName()); + receiptDetail.setMaterialSpec(child.getMaterialSpec()); + receiptDetail.setMaterialUnit(child.getMaterialUnit()); + receiptDetail.setQty(child.getGapQty().abs()); + receiptDetail.setTaskQty(child.getGapQty().abs()); + receiptDetail.setInventoryStatus(child.getInventoryStatus()); + receiptDetail.setBatch(child.getBatch()); + receiptDetail.setLot(child.getLot()); + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + success = receiptDetailService.save(receiptDetail); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 新增入库表单详情失败"); + } + // 增加库存交易记录 + InventoryTransaction inventoryTransaction = new InventoryTransaction(); + inventoryTransaction.setWarehouseCode(warehouseCode); + inventoryTransaction.setCompanyCode(companyCode); + inventoryTransaction.setZoneCode(inventoryHeader.getZoneCode()); + inventoryTransaction.setContainerCode(child.getContainerCode()); + inventoryTransaction.setToLocationCode(child.getLocationCode()); + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEINTO); + inventoryTransaction.setReceiptId(receiptDetail.getReceiptId()); + inventoryTransaction.setReceiptCode(receiptDetail.getReceiptCode()); + inventoryTransaction.setReceiptType(QuantityConstant.RECEIPT_BILL_TYPE_QTR); + inventoryTransaction.setReceiptDetailId(receiptDetail.getId()); + inventoryTransaction.setMaterialCode(child.getMaterialCode()); + inventoryTransaction.setMaterialName(child.getMaterialName()); + inventoryTransaction.setMaterialSpec(child.getMaterialSpec()); + inventoryTransaction.setMaterialUnit(child.getMaterialUnit()); + inventoryTransaction.setInventoryStatus(child.getInventoryStatus()); + inventoryTransaction.setQty(child.getGapQty()); + inventoryTransaction.setReceiptQty(child.getGapQty()); + inventoryTransaction.setBatch(child.getBatch()); + inventoryTransaction.setLot(child.getLot()); + success = inventoryTransactionService.save(inventoryTransaction); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 新增库存交易详情失败"); + } + success = receiptHeaderService.updateReceiptHeader(warehousingOrderId); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新入库单失败"); + } + } + + if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1) { + if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1) { + success = inventoryDetailService.removeById(child.getInventoryDetaiId()); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 删除库存详情失败"); + } + } + if (outboundOrderId == 0) { + ShipmentHeader shipmentHeader = new ShipmentHeader(); + shipmentHeader.setWarehouseCode(warehouseCode); + shipmentHeader.setCompanyCode(companyCode); + shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_QTC); + shipmentHeader.setRemark("盘亏 单号" + cycleCountDetail.getCycleCountHeadCode()); + Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader); + if (!result.isSuccess()) { + return result; + } + shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + success = shipmentHeaderService.updateById(shipmentHeader); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新出库单详情失败"); + } + // 生成出库单并且赋值给outboundOrderId + outboundOrderId = shipmentHeader.getId(); + outboundOrderCode = shipmentHeader.getCode(); + } + // 生成明细 + ShipmentDetail shipmentDetail = new ShipmentDetail(); + shipmentDetail.setShipmentId(outboundOrderId); + shipmentDetail.setShipmentCode(outboundOrderCode); + shipmentDetail.setWarehouseCode(warehouseCode); + shipmentDetail.setCompanyCode(companyCode); + shipmentDetail.setMaterialCode(child.getMaterialCode()); + shipmentDetail.setMaterialName(child.getMaterialName()); + shipmentDetail.setMaterialSpec(child.getMaterialSpec()); + shipmentDetail.setMaterialUnit(child.getMaterialUnit()); + shipmentDetail.setQty(child.getGapQty().abs()); + shipmentDetail.setTaskQty(child.getGapQty().abs()); + shipmentDetail.setInventoryStatus(child.getInventoryStatus()); + shipmentDetail.setBatch(child.getBatch()); + shipmentDetail.setLot(child.getLot()); + shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + success = shipmentDetailService.save(shipmentDetail); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 保存出库单详情失败"); + } + InventoryTransaction inventoryTransaction = new InventoryTransaction(); + inventoryTransaction.setWarehouseCode(warehouseCode); + inventoryTransaction.setCompanyCode(companyCode); + inventoryTransaction.setZoneCode(inventoryHeader.getZoneCode()); + inventoryTransaction.setContainerCode(child.getContainerCode()); + inventoryTransaction.setFromLocationCode(child.getLocationCode()); + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEOUT); + inventoryTransaction.setShipmentId(shipmentDetail.getShipmentId()); + inventoryTransaction.setShipmentCode(shipmentDetail.getShipmentCode()); + inventoryTransaction.setShipmentType(QuantityConstant.SHIPMENT_BILL_TYPE_QTC); + inventoryTransaction.setShipmentDetailId(shipmentDetail.getId()); + inventoryTransaction.setMaterialCode(child.getMaterialCode()); + inventoryTransaction.setMaterialName(child.getMaterialName()); + inventoryTransaction.setMaterialSpec(child.getMaterialSpec()); + inventoryTransaction.setMaterialUnit(child.getMaterialUnit()); + inventoryTransaction.setInventoryStatus(child.getInventoryStatus()); + inventoryTransaction.setQty(child.getGapQty()); + inventoryTransaction.setShipmentQty(child.getGapQty()); + inventoryTransaction.setBatch(child.getBatch()); + inventoryTransaction.setLot(child.getLot()); + success = inventoryTransactionService.save(inventoryTransaction); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 保存出库单详情失败"); + } + success = shipmentHeaderService.updateShipmentHeader(outboundOrderId); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新出库单失败"); + } + } + success = cycleCountDetailChildService.updateById(child); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新盘点详情失败"); + } + } + + if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO) < 1) { + success = inventoryHeaderService.removeById(inventoryHeader.getId()); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 删除库存头失败"); + } + } + + boolean complete = true; + // 盘点明细状态 + for (CycleCountDetailChild child : cycleCountDetailChildList) { + if (child.getChildStatus().intValue() != QuantityConstant.CYCLECOUNT_STATUS_COMPLETED) { + complete = false; + } + } + if (complete) { + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); + cycleCountDetail.setCompletedAt(new Date()); + success = cycleCountDetailService.updateById(cycleCountDetail); + if (!success) { + throw new JeecgBootException("完成盘点任务时, 更新盘点单详情失败"); + } + } + + // 更新主单状态 + cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode()); + if (!taskHeaderService.combineInventoryDetail(inventoryHeader.getContainerCode(), inventoryHeader.getWarehouseCode())) { + throw new JeecgBootException("完成盘点任务时, 更新库存失败"); + } + return Result.ok("完成盘点任务成功"); + } } 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 54525fe..9bebe5f 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 @@ -14,9 +14,12 @@ import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.impl.ContainerServiceImpl; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.impl.LocationServiceImpl; +import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; import org.jeecg.modules.wms.config.material.entity.Material; import org.jeecg.modules.wms.config.material.service.impl.MaterialServiceImpl; import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; +import org.jeecg.modules.wms.config.zone.entity.Zone; +import org.jeecg.modules.wms.config.zone.service.IZoneService; 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.service.IInventoryDetailService; @@ -87,6 +90,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap private IInventoryHeaderService inventoryHeaderService; @Resource private ContainerServiceImpl containerService; + @Resource + private ILocationTypeService locationTypeService; + @Resource + private IZoneService zoneService; @Override @Transactional @@ -140,13 +147,22 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap @Override @Transactional - public void delBatchMain(Collection<? extends Serializable> idList) { + public boolean delBatchMain(Collection<? extends Serializable> idList) { for (Serializable id : idList) { LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, id.toString()); - cycleCountDetailChildMapper.delete(cycleCountDetailChildLambdaQueryWrapper); - cycleCountDetailMapper.deleteById(id); + int delete = cycleCountDetailChildMapper.delete(cycleCountDetailChildLambdaQueryWrapper); + if (delete == 0) { + return false; + } + delete = cycleCountDetailMapper.deleteById(id); + if (delete > 0) { + + } else { + return false; + } } + return true; } @Override @@ -172,17 +188,29 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap return Result.error("当前容器已锁定 请检查数据 库存里面不是锁定 实际上容器里面锁定了"); } - Location locationByCode = locationService.getLocationByCode(inventoryDetails.get(0).getLocationCode(), warehouseCode); - if (locationByCode.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { + Location location = locationService.getLocationByCode(inventoryDetails.get(0).getLocationCode(), warehouseCode); + if (location.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { return Result.error("当前库位已锁定 请检查数据 库存里面不是锁定 实际上库位里面锁定了"); } InventoryHeader inventoryHeader = inventoryHeaderService.getById(taskId); if (inventoryHeader == null) { return Result.error("根据库存头ID:" + taskId + "没有找到库存头"); } - + String zoneCode = location.getZoneCode(); + if (StringUtils.isEmpty(zoneCode)) { + return Result.error("添加库存盘点时,盘点库存的库区编码为空"); + } + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if (zone == null) { + return Result.error("添加库存盘点时,没有找到盘点库存的库区"); + } + String zoneType = zone.getType(); + if (StringUtils.isEmpty(zoneType)) { + return Result.error("添加库存盘点时,盘点库存的库区类型编码为空"); + } CycleCountDetail cycleCountDetail = new CycleCountDetail(); cycleCountDetail.setCycleCountHeadId(headerId); + cycleCountDetail.setZoneType(zoneType); cycleCountDetail.setContainerCode(inventoryDetails.get(0).getContainerCode()); cycleCountDetail.setCycleCountHeadCode(code); cycleCountDetail.setCompanyCode(inventoryDetails.get(0).getCompanyCode()); @@ -199,7 +227,12 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap CycleCountDetailChild cycleCountDetailChild = new CycleCountDetailChild(); cycleCountDetailChild.setCycleCountDetailid(cycleCountDetail.getId()); cycleCountDetailChild.setCyclecountheadcode(code); - cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILD); + if (zoneType.equals(QuantityConstant.ZONE_TYPE_FLAT)) { + cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK); + } else { + cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILD); + } + cycleCountDetailChild.setZoneType(zoneType); cycleCountDetailChild.setLocationCode(inventoryDetail.getLocationCode()); cycleCountDetailChild.setContainerCode(inventoryDetail.getContainerCode()); cycleCountDetailChild.setMaterialCode(inventoryDetail.getMaterialCode()); @@ -393,14 +426,17 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap } if (cycleCountDetail.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_BUILD)) { - return Result.error("当前盘点明细是新建状态 不能调整"); + String zoneType = cycleCountDetail.getZoneType(); + if (!zoneType.equals(QuantityConstant.ZONE_TYPE_FLAT)) { + return Result.error("当前盘点明细是新建状态 不能调整"); + } } if (cycleCountDetail.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)) { return Result.error("当前盘点明细是完成状态 不能调整"); } if (cycleCountDetailChild.getCountedQty().compareTo(BigDecimal.ZERO) == 0) { - return Result.error("别闹"); + return Result.error("盘点登记时,盘点登记数量不能为0"); } cycleCountDetailChild.setCyclecountheadcode(cycleCountDetail.getCycleCountHeadCode()); 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 f715fbf..3e2e85b 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 @@ -1116,7 +1116,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空目标库位失败"); } } - inventoryHeaderService.clearInentory(containerCode, warehouseCode); + if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { + inventoryHeaderService.clearInentory(containerCode, warehouseCode); + } } return result; } @@ -2748,8 +2750,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setMaterialSpec(child.getMaterialSpec()); inventoryTransaction.setMaterialUnit(child.getMaterialUnit()); inventoryTransaction.setInventoryStatus(child.getInventoryStatus()); - inventoryTransaction.setQty(child.getCountedQty()); - inventoryTransaction.setReceiptQty(child.getCountedQty()); + inventoryTransaction.setQty(child.getGapQty()); + inventoryTransaction.setReceiptQty(child.getGapQty()); inventoryTransaction.setBatch(child.getBatch()); inventoryTransaction.setLot(child.getLot()); success = inventoryTransactionService.save(inventoryTransaction); @@ -2828,8 +2830,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setMaterialSpec(child.getMaterialSpec()); inventoryTransaction.setMaterialUnit(child.getMaterialUnit()); inventoryTransaction.setInventoryStatus(child.getInventoryStatus()); - inventoryTransaction.setQty(child.getCountedQty()); - inventoryTransaction.setShipmentQty(child.getCountedQty()); + inventoryTransaction.setQty(child.getGapQty()); + inventoryTransaction.setShipmentQty(child.getGapQty()); inventoryTransaction.setBatch(child.getBatch()); inventoryTransaction.setLot(child.getLot()); success = inventoryTransactionService.save(inventoryTransaction);