Commit 70157266 by yubin

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InventoryServiceImpl.java
parents 98bfcd2b e9e044a2
...@@ -8,12 +8,32 @@ export function listStocktakes(query) { ...@@ -8,12 +8,32 @@ export function listStocktakes(query) {
params: query params: query
}) })
} }
// 查询统计
export function listStocktakesCount(query) {
return request({
url: '/inventory/stocktakes/listCount',
method: 'get',
params: query
})
}
// 统计详情
export function getCountInfo(query) {
return request({
url: '/inventory/stocktakes/countInfo',
method: 'get',
params: query
})
}
// 查询盘点单主详细 // 查询盘点单主详细
export function getStocktakes(id) { export function getStocktakes(id, operationType) {
return request({ return request({
url: '/inventory/stocktakes/' + id, url: '/inventory/stocktakes/',
method: 'get' method: 'get',
params: {
id: id,
operationType: operationType
}
}) })
} }
......
...@@ -10,22 +10,21 @@ ...@@ -10,22 +10,21 @@
@click="handleAdd" @click="handleAdd"
v-hasPermi="['inventory:stocktakes:add']" v-hasPermi="['inventory:stocktakes:add']"
>新增</el-button> >新增</el-button>
<el-button <!-- <el-button-->
type="danger" <!-- type="danger"-->
plain <!-- plain-->
icon="el-icon-delete" <!-- icon="el-icon-delete"-->
size="medium" <!-- size="medium"-->
:disabled="multiple" <!-- :disabled="multiple"-->
@click="handleDelete" <!-- @click="handleDelete"-->
v-hasPermi="['inventory:stocktakes:remove']" <!-- v-hasPermi="['inventory:stocktakes:remove']"-->
>删除</el-button> <!-- >删除</el-button>-->
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-tickets" icon="el-icon-tickets"
size="medium" size="medium"
:disabled="single" @click="handleCount"
@click="handleConfirm"
v-hasPermi="['inventory:stocktakes:count']" v-hasPermi="['inventory:stocktakes:count']"
>处理结果统计</el-button> >处理结果统计</el-button>
</template> </template>
...@@ -80,24 +79,26 @@ ...@@ -80,24 +79,26 @@
<!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />--> <!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button--> <el-button
<!-- size="mini"--> size="mini"
<!-- type="text"--> type="text"
<!-- icon="el-icon-edit"--> icon="el-icon-view"
<!-- @click="handleUpdate(scope.row)"--> @click="handleViewInfo(scope.row)"
<!-- v-hasPermi="['inventory:stocktakes:edit']"--> v-hasPermi="['inventory:stocktakes:query']"
<!-- >修改</el-button>--> >查看</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleCheck(scope.row)" @click="handleCheck(scope.row)"
v-if="scope.row.stocktakeStatus === '1'"
v-hasPermi="['inventory:stocktakes:check']" v-hasPermi="['inventory:stocktakes:check']"
>盘点</el-button> >盘点</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
v-if="scope.row.stocktakeStatus === '1'"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['inventory:stocktakes:remove']" v-hasPermi="['inventory:stocktakes:remove']"
>删除</el-button> >删除</el-button>
...@@ -106,6 +107,7 @@ ...@@ -106,6 +107,7 @@
type="text" type="text"
icon="el-icon-circle-check" icon="el-icon-circle-check"
@click="handleConfirm(scope.row)" @click="handleConfirm(scope.row)"
v-if="scope.row.stocktakeStatus === '2'"
v-hasPermi="['inventory:stocktakes:confirm']" v-hasPermi="['inventory:stocktakes:confirm']"
>盘点确认</el-button> >盘点确认</el-button>
</template> </template>
...@@ -199,7 +201,20 @@ ...@@ -199,7 +201,20 @@
/> />
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitConfirmForm"> </el-button> <el-button type="primary"
v-if="this.buttonShow"
@click="submitConfirmForm"> </el-button>
<el-button @click="cancelConfirm"> </el-button>
</div>
</el-dialog>
<!-- 处理统计弹窗-->
<el-dialog :title="confirmTitle" :visible.sync="countOpen" width="1500px" append-to-body>
<el-form ref="confirmFormRef" :model="form" :rules="rules" label-width="80px">
<!-- 引入子表组件(核心:传递数据+监听事件) -->
<stocktake-count-table/>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelConfirm"> </el-button> <el-button @click="cancelConfirm"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -208,14 +223,15 @@ ...@@ -208,14 +223,15 @@
<script> <script>
import { listStocktakes, getStocktakes, delStocktakes, addStocktakes, updateStocktakes } from "@/api/inventory/stocktakes" import { listStocktakes, getStocktakes, delStocktakes, addStocktakes, updateStocktakes } from "@/api/inventory/stocktakes"
// 引入子表组件 // 引入子表组件--盘点
import stocktakeItemsTable from '@/views/inventory/stocktakes/stocktakeItemsTable.vue'; import stocktakeItemsTable from '@/views/inventory/stocktakes/stocktakeItemsTable.vue';
// 引入子表组件--统计
import stocktakeCountTable from '@/views/inventory/stocktakes/stocktakeCountTable.vue';
export default { export default {
name: "Stocktakes", name: "Stocktakes",
dicts: ['stocktake_status'], dicts: ['stocktake_status'],
// 注册子组件 // 注册子组件
components: { stocktakeItemsTable }, components: { stocktakeItemsTable,stocktakeCountTable },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -243,10 +259,12 @@ export default { ...@@ -243,10 +259,12 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
checkOpen: false, buttonShow: true,//是否展示确认按钮
confirmOpen: false, checkOpen: false, // 盘点弹窗
confirmOpen: false, // 盘点确认弹窗
checkTitle: "库存盘点", checkTitle: "库存盘点",
confirmTitle: "盘点确认", confirmTitle: "盘点确认",
countOpen: false, // 盘点统计弹窗
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -358,24 +376,45 @@ export default { ...@@ -358,24 +376,45 @@ export default {
handleCheck(row) { handleCheck(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getStocktakes(id).then(response => { getStocktakes(id,'check').then(response => {
this.form = response.data this.form = response.data
// 过滤 undefined 行,避免子组件渲染报错 // 过滤 undefined 行,避免子组件渲染报错
this.stocktakeItemsList = (response.data.stocktakeItemsList || []).filter(item => item); this.stocktakeItemsList = (response.data.stocktakeItemsList || []).filter(item => item);
this.checkOpen = true this.checkOpen = true
}) })
}, },
// 盘点确认按钮:打开确认弹窗 // 盘点确认按钮:打开弹窗
handleConfirm(row) { handleConfirm(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getStocktakes(id).then(response => { this.buttonShow = true
this.confirmTitle = '盘点确认'
getStocktakes(id,'confirm').then(response => {
this.form = response.data
// 过滤 undefined 行,避免子组件渲染报错
this.stocktakeItemsList = (response.data.stocktakeItemsList || []).filter(item => item);
this.confirmOpen = true;
})
},
// 详情按钮:打开弹窗
handleViewInfo(row) {
this.reset();
const id = row.id || this.ids
this.buttonShow = false
this.confirmTitle = '盘点查看'
getStocktakes(id,'check').then(response => {
this.form = response.data this.form = response.data
// 过滤 undefined 行,避免子组件渲染报错 // 过滤 undefined 行,避免子组件渲染报错
this.stocktakeItemsList = (response.data.stocktakeItemsList || []).filter(item => item); this.stocktakeItemsList = (response.data.stocktakeItemsList || []).filter(item => item);
this.confirmOpen = true; this.confirmOpen = true;
}) })
}, },
/** 处理结果统计按钮操作 */
handleCount() {
this.reset()
this.countOpen = true
this.confirmTitle = " 处理结果统计"
},
/** 子组件字段编辑事件(确保父组件数据同步) */ /** 子组件字段编辑事件(确保父组件数据同步) */
handleStocktakeItemChange(updatedRow) { handleStocktakeItemChange(updatedRow) {
// 找到更新的行,替换数据(确保引用一致) // 找到更新的行,替换数据(确保引用一致)
...@@ -441,7 +480,7 @@ export default { ...@@ -441,7 +480,7 @@ export default {
// 取消操作 // 取消操作
cancelCheck() { this.checkOpen = false; this.reset(); }, cancelCheck() { this.checkOpen = false; this.reset(); },
cancelConfirm() { this.confirmOpen = false; this.reset(); }, cancelConfirm() { this.confirmOpen = false; this.countOpen = false; this.reset(); },
/** 新增提交按钮 */ /** 新增提交按钮 */
submitForm() { submitForm() {
......
...@@ -4,16 +4,10 @@ import java.util.List; ...@@ -4,16 +4,10 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.TO.StocktakesTO; import com.ruoyi.inventory.domain.TO.StocktakesTO;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -65,10 +59,11 @@ public class StocktakesController extends BaseController ...@@ -65,10 +59,11 @@ public class StocktakesController extends BaseController
* 获取库存盘点详细信息 * 获取库存盘点详细信息
*/ */
@PreAuthorize("@ss.hasPermi('inventory:stocktakes:query')") @PreAuthorize("@ss.hasPermi('inventory:stocktakes:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/")
public AjaxResult getInfo(@PathVariable("id") String id) public AjaxResult getInfo(@RequestParam("id") String id,
@RequestParam(required = false) String operationType)
{ {
return success(stocktakesService.selectStocktakesById(id)); return success(stocktakesService.selectStocktakesById(id,operationType));
} }
/** /**
...@@ -103,4 +98,31 @@ public class StocktakesController extends BaseController ...@@ -103,4 +98,31 @@ public class StocktakesController extends BaseController
{ {
return toAjax(stocktakesService.deleteStocktakesByIds(ids)); return toAjax(stocktakesService.deleteStocktakesByIds(ids));
} }
/**
* @description: 查询处理统计
* @author cs
* @date 2025/12/8
* @version 1.0
*/
@GetMapping("/listCount")
public TableDataInfo listCount(StocktakesVo stocktakes)
{
startPage();
List<StocktakesVo> list = stocktakesService.selectStocktakesListCount(stocktakes);
return getDataTable(list);
}
/**
* @description: 查询处理统计-详情
* @author cs
* @date 2025/12/9
* @version 1.0
*/
@GetMapping("/countInfo")
public TableDataInfo countInfo(StocktakesVo stocktakes)
{
startPage();
List<StocktakesVo> list = stocktakesService.selectStocktakesCountInfo(stocktakes);
return getDataTable(list);
}
} }
...@@ -124,6 +124,18 @@ public class StocktakeItems extends BaseEntity ...@@ -124,6 +124,18 @@ public class StocktakeItems extends BaseEntity
@Excel(name = "排序号") @Excel(name = "排序号")
private String updateUserCode; private String updateUserCode;
/** 单价 */
@Excel(name = "单价")
private double unitPrice;
public double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
}
public String getInventoryId() { public String getInventoryId() {
return inventoryId; return inventoryId;
} }
......
...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.domain; ...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.domain;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
...@@ -71,7 +72,7 @@ public class Stocktakes extends BaseEntity ...@@ -71,7 +72,7 @@ public class Stocktakes extends BaseEntity
private String updateUserCode; private String updateUserCode;
/** 盘点单明细信息 */ /** 盘点单明细信息 */
private List<StocktakeItems> stocktakeItemsList; private List<StocktakeItemsTo> stocktakeItemsList;
public void setId(String id) public void setId(String id)
{ {
...@@ -203,12 +204,12 @@ public class Stocktakes extends BaseEntity ...@@ -203,12 +204,12 @@ public class Stocktakes extends BaseEntity
return updateUserCode; return updateUserCode;
} }
public List<StocktakeItems> getStocktakeItemsList() public List<StocktakeItemsTo> getStocktakeItemsList()
{ {
return stocktakeItemsList; return stocktakeItemsList;
} }
public void setStocktakeItemsList(List<StocktakeItems> stocktakeItemsList) public void setStocktakeItemsList(List<StocktakeItemsTo> stocktakeItemsList)
{ {
this.stocktakeItemsList = stocktakeItemsList; this.stocktakeItemsList = stocktakeItemsList;
} }
......
package com.ruoyi.inventory.domain.TO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.inventory.domain.StocktakeItems;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 盘点单明细对象 stocktake_items
*
* @author ruoyi
* @date 2025-12-02
*/
public class StocktakeItemsTo extends StocktakeItems
{
private String warehouseName;
private String locationName;
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
}
package com.ruoyi.inventory.domain.TO;
import com.ruoyi.inventory.domain.Stocktakes;
import java.util.Date;
/**
* 库存盘点对象 stocktakes
*
* @author ruoyi
* @date 2025-12-02
*/
public class StocktakesVo extends Stocktakes
{
/** 提交按钮类型,check是盘点,confirm 是确认盘点 */
private String sapNo;
private String plannedDates;
private String materialId;
private String warehousesName;
private String locationName;
private String warehousesId;
private String locationId;
private String tsCode;
private String hazardName;
private String varianceQuantity;
private String varianceAmount;
private String countQuantity;
private String countAmount;
// 计划日期数组(接收拆分后的值)
private String[] plannedDateArray;
// 仓库ID数组
private String[] warehouseIdArray;
// 库位ID数组
private String[] locationIdArray;
public String[] getPlannedDateArray() {
return plannedDateArray;
}
public void setPlannedDateArray(String[] plannedDateArray) {
this.plannedDateArray = plannedDateArray;
}
public String[] getWarehouseIdArray() {
return warehouseIdArray;
}
public void setWarehouseIdArray(String[] warehouseIdArray) {
this.warehouseIdArray = warehouseIdArray;
}
public String[] getLocationIdArray() {
return locationIdArray;
}
public void setLocationIdArray(String[] locationIdArray) {
this.locationIdArray = locationIdArray;
}
public String getMaterialId() {
return materialId;
}
public String getPlannedDates() {
return plannedDates;
}
public void setPlannedDates(String plannedDates) {
this.plannedDates = plannedDates;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getSapNo() {
return sapNo;
}
public void setSapNo(String sapNo) {
this.sapNo = sapNo;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getWarehousesId() {
return warehousesId;
}
public void setWarehousesId(String warehousesId) {
this.warehousesId = warehousesId;
}
public String getTsCode() {
return tsCode;
}
public void setTsCode(String tsCode) {
this.tsCode = tsCode;
}
public String getHazardName() {
return hazardName;
}
public void setHazardName(String hazardName) {
this.hazardName = hazardName;
}
public String getVarianceQuantity() {
return varianceQuantity;
}
public void setVarianceQuantity(String varianceQuantity) {
this.varianceQuantity = varianceQuantity;
}
public String getVarianceAmount() {
return varianceAmount;
}
public void setVarianceAmount(String varianceAmount) {
this.varianceAmount = varianceAmount;
}
public String getCountQuantity() {
return countQuantity;
}
public void setCountQuantity(String countQuantity) {
this.countQuantity = countQuantity;
}
public String getCountAmount() {
return countAmount;
}
public void setCountAmount(String countAmount) {
this.countAmount = countAmount;
}
}
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
/** /**
* 库存Mapper接口 * 库存Mapper接口
...@@ -79,11 +80,11 @@ public interface InventoryMapper ...@@ -79,11 +80,11 @@ public interface InventoryMapper
* @date 2025/12/3 * @date 2025/12/3
* @version 1.0 * @version 1.0
*/ */
List<StocktakeItems> selectstocktakeItemsList(); List<StocktakeItemsTo> selectstocktakeItemsList();
/** /**
* 按物料汇总统计库存 * 按物料汇总统计库存
* *
* @param inventory 库存查询条件 * @param inventory 库存查询条件
* @return 库存汇总统计集合 * @return 库存汇总统计集合
*/ */
...@@ -91,7 +92,7 @@ public interface InventoryMapper ...@@ -91,7 +92,7 @@ public interface InventoryMapper
/** /**
* 查询库存明细列表(根据物料标识及检索条件) * 查询库存明细列表(根据物料标识及检索条件)
* *
* @param inventory 库存查询条件 * @param inventory 库存查询条件
* @return 库存明细集合 * @return 库存明细集合
*/ */
......
package com.ruoyi.inventory.mapper; package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
/** /**
* 盘点单明细Mapper接口 * 盘点单明细Mapper接口
* *
* @author ruoyi * @author ruoyi
* @date 2025-12-02 * @date 2025-12-02
*/ */
public interface StocktakeItemsMapper public interface StocktakeItemsMapper
{ {
/** /**
* 查询盘点单明细 * 查询盘点单明细
* *
* @param id 盘点单明细主键 * @param id 盘点单明细主键
* @return 盘点单明细 * @return 盘点单明细
*/ */
...@@ -21,7 +25,7 @@ public interface StocktakeItemsMapper ...@@ -21,7 +25,7 @@ public interface StocktakeItemsMapper
/** /**
* 查询盘点单明细列表 * 查询盘点单明细列表
* *
* @param stocktakeItems 盘点单明细 * @param stocktakeItems 盘点单明细
* @return 盘点单明细集合 * @return 盘点单明细集合
*/ */
...@@ -29,7 +33,7 @@ public interface StocktakeItemsMapper ...@@ -29,7 +33,7 @@ public interface StocktakeItemsMapper
/** /**
* 新增盘点单明细 * 新增盘点单明细
* *
* @param stocktakeItems 盘点单明细 * @param stocktakeItems 盘点单明细
* @return 结果 * @return 结果
*/ */
...@@ -37,7 +41,7 @@ public interface StocktakeItemsMapper ...@@ -37,7 +41,7 @@ public interface StocktakeItemsMapper
/** /**
* 修改盘点单明细 * 修改盘点单明细
* *
* @param stocktakeItems 盘点单明细 * @param stocktakeItems 盘点单明细
* @return 结果 * @return 结果
*/ */
...@@ -45,7 +49,7 @@ public interface StocktakeItemsMapper ...@@ -45,7 +49,7 @@ public interface StocktakeItemsMapper
/** /**
* 删除盘点单明细 * 删除盘点单明细
* *
* @param id 盘点单明细主键 * @param id 盘点单明细主键
* @return 结果 * @return 结果
*/ */
...@@ -53,9 +57,15 @@ public interface StocktakeItemsMapper ...@@ -53,9 +57,15 @@ public interface StocktakeItemsMapper
/** /**
* 批量删除盘点单明细 * 批量删除盘点单明细
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteStocktakeItemsByIds(String[] ids); public int deleteStocktakeItemsByIds(String[] ids);
// 主表调用获取子表信息
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String, Object> query);
// 查询处理统计-详情
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes);
} }
package com.ruoyi.inventory.mapper; package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.inventory.domain.Stocktakes; import com.ruoyi.inventory.domain.Stocktakes;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
/** /**
* 盘点单主Mapper接口 * 盘点单主Mapper接口
...@@ -15,7 +18,6 @@ public interface StocktakesMapper ...@@ -15,7 +18,6 @@ public interface StocktakesMapper
/** /**
* 查询盘点单主 * 查询盘点单主
* *
* @param id 盘点单主主键
* @return 盘点单主 * @return 盘点单主
*/ */
public Stocktakes selectStocktakesById(String id); public Stocktakes selectStocktakesById(String id);
...@@ -84,4 +86,12 @@ public interface StocktakesMapper ...@@ -84,4 +86,12 @@ public interface StocktakesMapper
* @return 结果 * @return 结果
*/ */
public int deleteStocktakeItemsByStocktakeId(String id); public int deleteStocktakeItemsByStocktakeId(String id);
/**
* @description: 查询处理统计
* @author cs
* @date 2025/12/8
* @version 1.0
*/
public List<StocktakesVo> selectStocktakesListCount(StocktakesVo stocktakes);
} }
...@@ -7,18 +7,19 @@ import com.ruoyi.common.core.page.TableDataInfo; ...@@ -7,18 +7,19 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
/** /**
* 库存Service接口 * 库存Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2025-12-03 * @date 2025-12-03
*/ */
public interface IInventoryService public interface IInventoryService
{ {
/** /**
* 查询库存 * 查询库存
* *
* @param id 库存主键 * @param id 库存主键
* @return 库存 * @return 库存
*/ */
...@@ -26,7 +27,7 @@ public interface IInventoryService ...@@ -26,7 +27,7 @@ public interface IInventoryService
/** /**
* 查询库存列表 * 查询库存列表
* *
* @param inventory 库存 * @param inventory 库存
* @return 库存集合 * @return 库存集合
*/ */
...@@ -36,7 +37,7 @@ public interface IInventoryService ...@@ -36,7 +37,7 @@ public interface IInventoryService
/** /**
* 新增库存 * 新增库存
* *
* @param inventory 库存 * @param inventory 库存
* @return 结果 * @return 结果
*/ */
...@@ -51,7 +52,7 @@ public interface IInventoryService ...@@ -51,7 +52,7 @@ public interface IInventoryService
public int insertInventoryList(List<Inventory> inventoryList); public int insertInventoryList(List<Inventory> inventoryList);
/** /**
* 修改库存 * 修改库存
* *
* @param inventory 库存 * @param inventory 库存
* @return 结果 * @return 结果
*/ */
...@@ -67,7 +68,7 @@ public interface IInventoryService ...@@ -67,7 +68,7 @@ public interface IInventoryService
/** /**
* 批量删除库存 * 批量删除库存
* *
* @param ids 需要删除的库存主键集合 * @param ids 需要删除的库存主键集合
* @return 结果 * @return 结果
*/ */
...@@ -75,7 +76,7 @@ public interface IInventoryService ...@@ -75,7 +76,7 @@ public interface IInventoryService
/** /**
* 删除库存信息 * 删除库存信息
* *
* @param id 库存主键 * @param id 库存主键
* @return 结果 * @return 结果
*/ */
...@@ -88,11 +89,11 @@ public interface IInventoryService ...@@ -88,11 +89,11 @@ public interface IInventoryService
* @date 2025/12/3 * @date 2025/12/3
* @version 1.0 * @version 1.0
*/ */
public List<StocktakeItems> selectstocktakeItemsList(); public List<StocktakeItemsTo> selectstocktakeItemsList();
/** /**
* 按物料汇总统计库存 * 按物料汇总统计库存
* *
* @param inventory 库存查询条件 * @param inventory 库存查询条件
* @return 库存汇总统计集合 * @return 库存汇总统计集合
*/ */
...@@ -100,7 +101,7 @@ public interface IInventoryService ...@@ -100,7 +101,7 @@ public interface IInventoryService
/** /**
* 查询库存明细列表(根据物料标识及检索条件) * 查询库存明细列表(根据物料标识及检索条件)
* *
* @param inventory 库存查询条件 * @param inventory 库存查询条件
* @return 库存明细集合 * @return 库存明细集合
*/ */
......
package com.ruoyi.inventory.service; package com.ruoyi.inventory.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
/** /**
* 盘点单明细Service接口 * 盘点单明细Service接口
...@@ -19,6 +23,9 @@ public interface IStocktakeItemsService ...@@ -19,6 +23,9 @@ public interface IStocktakeItemsService
*/ */
public StocktakeItems selectStocktakeItemsById(String id); public StocktakeItems selectStocktakeItemsById(String id);
// 主表调用
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String,Object> query);
/** /**
* 查询盘点单明细列表 * 查询盘点单明细列表
* *
...@@ -58,4 +65,7 @@ public interface IStocktakeItemsService ...@@ -58,4 +65,7 @@ public interface IStocktakeItemsService
* @return 结果 * @return 结果
*/ */
public int deleteStocktakeItemsById(String id); public int deleteStocktakeItemsById(String id);
// 查询处理统计-详情
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes);
} }
package com.ruoyi.inventory.service; package com.ruoyi.inventory.service;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Stocktakes; import com.ruoyi.inventory.domain.Stocktakes;
import com.ruoyi.inventory.domain.TO.StocktakesTO; import com.ruoyi.inventory.domain.TO.StocktakesTO;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import org.springframework.web.bind.annotation.GetMapping;
/** /**
* 库存盘点Service接口 * 库存盘点Service接口
...@@ -15,10 +19,9 @@ public interface IStocktakesService ...@@ -15,10 +19,9 @@ public interface IStocktakesService
/** /**
* 查询库存盘点 * 查询库存盘点
* *
* @param id 库存盘点主键
* @return 库存盘点 * @return 库存盘点
*/ */
public Stocktakes selectStocktakesById(String id); public Stocktakes selectStocktakesById(String id,String operationType);
/** /**
* 查询库存盘点列表 * 查询库存盘点列表
...@@ -59,4 +62,22 @@ public interface IStocktakesService ...@@ -59,4 +62,22 @@ public interface IStocktakesService
* @return 结果 * @return 结果
*/ */
public int deleteStocktakesById(String id); public int deleteStocktakesById(String id);
/**
* @description: 查询处理统计
* @author cs
* @date 2025/12/8
* @version 1.0
*/
public List<StocktakesVo> selectStocktakesListCount(StocktakesVo stocktakes);
/**
* @description: 查询处理统计-详情
* @author cs
* @date 2025/12/9
* @version 1.0
*/
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes);
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.StocktakeItemsMapper; import com.ruoyi.inventory.mapper.StocktakeItemsMapper;
...@@ -33,6 +37,15 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService ...@@ -33,6 +37,15 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService
} }
/** /**
* @description: 主表调用获取子表信息
* @author cs
* @date 2025/12/5
* @version 1.0
*/
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String,Object> query){
return stocktakeItemsMapper.selectStocktakeItemsByMain(query);
}
/**
* 查询盘点单明细列表 * 查询盘点单明细列表
* *
* @param stocktakeItems 盘点单明细 * @param stocktakeItems 盘点单明细
...@@ -93,4 +106,24 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService ...@@ -93,4 +106,24 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService
{ {
return stocktakeItemsMapper.deleteStocktakeItemsById(id); return stocktakeItemsMapper.deleteStocktakeItemsById(id);
} }
// 查询处理统计-详情
@Override
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes){
String plannedDates = stocktakes.getPlannedDates();
String warehousesId = stocktakes.getWarehousesId();
String locationId = stocktakes.getLocationId();
if (plannedDates != null && !plannedDates.isEmpty()) {
stocktakes.setPlannedDateArray(plannedDates.split(","));
}
// 2. 拆分仓库ID
if (warehousesId != null && !warehousesId.isEmpty()) {
stocktakes.setWarehouseIdArray(warehousesId.split(","));
}
// 3. 拆分库位ID
if (locationId != null && !locationId.isEmpty()) {
stocktakes.setLocationIdArray(locationId.split(","));
}
return stocktakeItemsMapper.selectStocktakesCountInfo(stocktakes);
}
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.Date; import java.util.*;
import java.util.List;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.InventoryTransactions; import com.ruoyi.inventory.domain.InventoryTransactions;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesTO; import com.ruoyi.inventory.domain.TO.StocktakesTO;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import com.ruoyi.inventory.mapper.StocktakeItemsMapper; import com.ruoyi.inventory.mapper.StocktakeItemsMapper;
import com.ruoyi.inventory.service.IInventoryService; import com.ruoyi.inventory.service.IInventoryService;
import com.ruoyi.inventory.service.IInventoryTransactionsService; import com.ruoyi.inventory.service.IInventoryTransactionsService;
import com.ruoyi.inventory.service.IStocktakeItemsService; import com.ruoyi.inventory.service.IStocktakeItemsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.mapper.StocktakesMapper; import com.ruoyi.inventory.mapper.StocktakesMapper;
import com.ruoyi.inventory.domain.Stocktakes; import com.ruoyi.inventory.domain.Stocktakes;
import com.ruoyi.inventory.service.IStocktakesService; import com.ruoyi.inventory.service.IStocktakesService;
import org.springframework.web.bind.annotation.GetMapping;
/** /**
* 盘点单主Service业务层处理 * 盘点单主Service业务层处理
...@@ -51,9 +54,21 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -51,9 +54,21 @@ public class StocktakesServiceImpl implements IStocktakesService
* @return 盘点单主 * @return 盘点单主
*/ */
@Override @Override
public Stocktakes selectStocktakesById(String id) public Stocktakes selectStocktakesById(String id,String operationType)
{ {
return stocktakesMapper.selectStocktakesById(id); // 获取主表信息
Stocktakes stocktakes = stocktakesMapper.selectStocktakesById(id);
// 获取子表信息
Map<String,Object> query = new HashMap<>();
query.put("stocktake_id",id);
if("confirm".equals(operationType)){
// 盘点确认时只查看 变更的
query.put("adjusted",1);
}
List<StocktakeItemsTo> stocktakeItems = stocktakeItemsService.selectStocktakeItemsByMain(query);
stocktakes.setStocktakeItemsList(stocktakeItems);
return stocktakes;
} }
/** /**
...@@ -93,7 +108,7 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -93,7 +108,7 @@ public class StocktakesServiceImpl implements IStocktakesService
Inventory inventory = new Inventory(); Inventory inventory = new Inventory();
inventory.setInventoryStatus(1L); inventory.setInventoryStatus(1L);
inventory.setIsUsed(1L); inventory.setIsUsed(1L);
List<StocktakeItems> stocktakeItemsList = inventoryService.selectstocktakeItemsList(); List<StocktakeItemsTo> stocktakeItemsList = inventoryService.selectstocktakeItemsList();
stocktakes.setStocktakeItemsList(stocktakeItemsList); stocktakes.setStocktakeItemsList(stocktakeItemsList);
insertStocktakeItems(stocktakes); insertStocktakeItems(stocktakes);
return rows; return rows;
...@@ -122,8 +137,8 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -122,8 +137,8 @@ public class StocktakesServiceImpl implements IStocktakesService
Date nowDate = DateUtils.getNowDate();//统一调整时间 Date nowDate = DateUtils.getNowDate();//统一调整时间
if("check".equals(operationType)){ if("check".equals(operationType)){
// 盘点提交 // 盘点提交
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList(); List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItems stocktakeItems : stocktakeItemsList) { for (StocktakeItemsTo stocktakeItems : stocktakeItemsList) {
stocktakeItems.setAdjustedBy(loginUserId);//调整人 stocktakeItems.setAdjustedBy(loginUserId);//调整人
stocktakeItems.setAdjustedAt(nowDate);//调整时间 stocktakeItems.setAdjustedAt(nowDate);//调整时间
stocktakeItems.setUpdateUserCode(loginUserId);//更新人 stocktakeItems.setUpdateUserCode(loginUserId);//更新人
...@@ -150,15 +165,16 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -150,15 +165,16 @@ public class StocktakesServiceImpl implements IStocktakesService
if("confirm".equals(operationType)){ if("confirm".equals(operationType)){
// 确认盘点 提交 // 确认盘点 提交
// 库存表根据子表数据更新库存量 --因为盘点确认时查询的就是有调整的子表数据,又因为库存操作表需要的货主id子表中没有,所以需要根据id查询库存表 // 库存表根据子表数据更新库存量 --因为盘点确认时查询的就是有调整的子表数据,又因为库存操作表需要的货主id子表中没有,所以需要根据id查询库存表
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList(); List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItems stocktakeItems : stocktakeItemsList) { for (StocktakeItemsTo stocktakeItems : stocktakeItemsList) {
// 获取实际数量 // 获取实际数量
Long actualQuantity = stocktakeItems.getActualQuantity(); Long actualQuantity = stocktakeItems.getActualQuantity();
// 库存表id // 库存表id
String inventoryId = stocktakeItems.getInventoryId(); String inventoryId = stocktakeItems.getInventoryId();
// 变更前数量 之所以不用库存表中的数量,是因为变更是从盘点计划时开始算的
Long quantity = stocktakeItems.getSystemQuantity();
// 获取库存信息 // 获取库存信息
Inventory inv = inventoryService.selectInventoryById(inventoryId); Inventory inv = inventoryService.selectInventoryById(inventoryId);
Long quantity = inv.getQuantity(); // 变更前数量
inv.setUpdateTime(nowDate);//更新时间 inv.setUpdateTime(nowDate);//更新时间
inv.setUpdateUserCode(loginUserId);//更新人 inv.setUpdateUserCode(loginUserId);//更新人
inv.setQuantity(actualQuantity);// 更新实际数量 inv.setQuantity(actualQuantity);// 更新实际数量
...@@ -236,7 +252,7 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -236,7 +252,7 @@ public class StocktakesServiceImpl implements IStocktakesService
*/ */
public void insertStocktakeItems(Stocktakes stocktakes) public void insertStocktakeItems(Stocktakes stocktakes)
{ {
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList(); List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
String stocktakeid = stocktakes.getId(); // 盘点单号 String stocktakeid = stocktakes.getId(); // 盘点单号
String createUserCode = stocktakes.getCreateUserCode();// 创建人 String createUserCode = stocktakes.getCreateUserCode();// 创建人
Date createTime = stocktakes.getCreateTime();// 创建日期 Date createTime = stocktakes.getCreateTime();// 创建日期
...@@ -253,6 +269,7 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -253,6 +269,7 @@ public class StocktakesServiceImpl implements IStocktakesService
stocktakeItems.setCreateUserCode(createUserCode); stocktakeItems.setCreateUserCode(createUserCode);
stocktakeItems.setCreateTime(createTime); stocktakeItems.setCreateTime(createTime);
list.add(stocktakeItems); list.add(stocktakeItems);
} }
if (list.size() > 0) if (list.size() > 0)
{ {
...@@ -260,4 +277,29 @@ public class StocktakesServiceImpl implements IStocktakesService ...@@ -260,4 +277,29 @@ public class StocktakesServiceImpl implements IStocktakesService
} }
} }
} }
/**
* @description: 查询处理统计
* @author cs
* @date 2025/12/8
* @version 1.0
*/
@Override
public List<StocktakesVo> selectStocktakesListCount(StocktakesVo stocktakes)
{
List<StocktakesVo> list = stocktakesMapper.selectStocktakesListCount(stocktakes);
return list;
}
/**
* @description: 查询处理统计-详情
* @author cs
* @date 2025/12/9
* @version 1.0
*/
@Override
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes)
{
List<StocktakesVo> list = stocktakeItemsService.selectStocktakesCountInfo(stocktakes);
return list;
}
} }
...@@ -32,13 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,13 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="warehousesId" column="warehouses_id" /> <result property="warehousesId" column="warehouses_id" />
</resultMap> </resultMap>
<resultMap type="StocktakeItems" id="StocktakeItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="stocktakeId" column="stocktake_id" /> <result property="stocktakeId" column="stocktake_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" /> <result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationName" column="location_name" />
<result property="systemQuantity" column="system_quantity" /> <result property="systemQuantity" column="system_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="varianceQuantity" column="variance_quantity" /> <result property="varianceQuantity" column="variance_quantity" />
...@@ -52,7 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -52,7 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="adjustedAt" column="adjusted_at" /> <result property="adjustedAt" column="adjusted_at" />
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time" />
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="materialRange" column="material_range" />
<result property="locationRange" column="location_range" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<result property="inventoryId" column="inventory_id" />
<result property="unitPrice" column="unit_price" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.inventory.domain.vo.InventorySummaryVO" id="InventorySummaryResult"> <resultMap type="com.ruoyi.inventory.domain.vo.InventorySummaryVO" id="InventorySummaryResult">
...@@ -106,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -106,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 按物料汇总统计库存 --> <!-- 按物料汇总统计库存 -->
<select id="selectInventorySummaryList" parameterType="Inventory" resultMap="InventorySummaryResult"> <select id="selectInventorySummaryList" parameterType="Inventory" resultMap="InventorySummaryResult">
select select
i.material_id, i.material_id,
m.material_name, m.material_name,
case i.inventory_type when 1 then '普通' when 2 then '退库' else '未知' end as inventory_type_name, case i.inventory_type when 1 then '普通' when 2 then '退库' else '未知' end as inventory_type_name,
...@@ -189,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -189,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectstocktakeItemsList" resultMap="StocktakeItemsResult"> <select id="selectstocktakeItemsList" resultMap="StocktakeItemsResult">
select material_id, batch_id, location_id, warehouse_id, quantity as system_quantity select id as inventory_id,material_id, batch_id, location_id, warehouses_id as warehouse_id, quantity as system_quantity
from inventory from inventory
where is_used = 1 and inventory_status = 1 where is_used = 1 and inventory_status = 1
order by warehouse_id,location_id,material_id order by warehouse_id,location_id,material_id
......
...@@ -4,13 +4,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -4,13 +4,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.StocktakeItemsMapper"> <mapper namespace="com.ruoyi.inventory.mapper.StocktakeItemsMapper">
<resultMap type="StocktakeItems" id="StocktakeItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="stocktakeId" column="stocktake_id" /> <result property="stocktakeId" column="stocktake_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" /> <result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationName" column="location_name" />
<result property="systemQuantity" column="system_quantity" /> <result property="systemQuantity" column="system_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="varianceQuantity" column="variance_quantity" /> <result property="varianceQuantity" column="variance_quantity" />
...@@ -34,10 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -34,10 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
<result property="inventoryId" column="inventory_id" /> <result property="inventoryId" column="inventory_id" />
<result property="unitPrice" column="unit_price" />
</resultMap> </resultMap>
<sql id="selectStocktakeItemsVo"> <sql id="selectStocktakeItemsVo">
select id, inventory_id, stocktake_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from stocktake_items select id, inventory_id,unit_price, stocktake_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from stocktake_items
</sql> </sql>
<select id="selectStocktakeItemsList" parameterType="StocktakeItems" resultMap="StocktakeItemsResult"> <select id="selectStocktakeItemsList" parameterType="StocktakeItems" resultMap="StocktakeItemsResult">
...@@ -67,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -67,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if> <if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if> <if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
<if test="unitPrice != null and unitPrice != ''"> and unit_price = #{unitPrice}</if>
</where> </where>
</select> </select>
...@@ -75,6 +79,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -75,6 +79,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectStocktakeItemsByMain" parameterType="java.util.Map" resultMap="StocktakeItemsResult">
select st_it.id
, st_it.inventory_id
,st_it.unit_price
, st_it.stocktake_id
, st_it.material_id
, st_it.batch_code
, st_it.warehouse_id
, st_it.location_id
, st_it.system_quantity
, st_it.actual_quantity
, st_it.variance_quantity
, st_it.variance_amount
, st_it.stocktake_status
, st_it.counted_by
, st_it.counted_at
, st_it.adjusted
, st_it.adjustment_reason
, st_it.adjusted_by
, st_it.adjusted_at
, st_it.start_time
, st_it.end_time
, st_it.material_range
, st_it.location_range
,(select w.warehouses_name from warehouses w where st_it.warehouse_id = w.warehouses_code and w.is_used = 1) as warehouse_name
,(select sl.location_name from storage_locations sl where st_it.location_id = sl.location_code and sl.is_used = 1) as location_name
from stocktake_items st_it
where stocktake_id = #{stocktake_id} and is_used = 1
<if test="adjusted != null and adjusted != ''"> and adjusted = #{adjusted}</if>
</select>
<!-- 查询处理统计-详情-->
<select id="selectStocktakesCountInfo" resultType="com.ruoyi.inventory.domain.TO.StocktakesVo">
select
st_it.material_id as materialId
,ma.sap_no as sapNo
,date_format(st.planned_date,'%Y%m%d') as plannedDates
,w.warehouses_name as warehousesName
,sl.location_name as locationName
,st_it.warehouse_id as warehousesId
,st_it.location_id as locationID
,ma.ts_code as tsCode
,dict.dict_label as hazardName
,IFNULL(st_it.variance_quantity, '0') as varianceQuantity
,IFNULL(st_it.variance_amount, '0') as varianceAmount
from stocktakes st
left join stocktake_items st_it on st.id = st_it.stocktake_id and st_it.is_used = 1
left join materials ma on st_it.material_id = ma.sap_no and ma.is_used = 1
left join warehouses w on st_it.warehouse_id = w.warehouses_code and w.is_used = 1
left join storage_locations sl on st_it.location_id = sl.location_code and sl.is_used = 1
left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where
st.is_used = 1
<if test="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="plannedDateArray != null and plannedDateArray.length > 0">
and date_format(st.planned_date,'%Y%m%d') in
<foreach item="date" collection="plannedDateArray" open="(" separator="," close=")">
#{date}
</foreach>
</if>
<if test="warehouseIdArray != null and warehouseIdArray.length > 0">
and st_it.warehouse_id in
<foreach item="warehouse" collection="warehouseIdArray" open="(" separator="," close=")">
#{warehouse}
</foreach>
</if>
<if test="locationIdArray != null and locationIdArray.length > 0">
and st_it.location_id in
<foreach item="location" collection="locationIdArray" open="(" separator="," close=")">
#{location}
</foreach>
</if>
order by st.planned_date
</select>
<insert id="insertStocktakeItems" parameterType="StocktakeItems"> <insert id="insertStocktakeItems" parameterType="StocktakeItems">
insert into stocktake_items insert into stocktake_items
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -107,6 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -107,6 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUserCode != null">create_user_code,</if> <if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if> <if test="updateUserCode != null">update_user_code,</if>
<if test="unitPrice != null"> unit_price,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
...@@ -138,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -138,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUserCode != null">#{createUserCode},</if> <if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if> <if test="updateUserCode != null">#{updateUserCode},</if>
<if test="unitPrice != null"> #{unitPrice},</if>
</trim> </trim>
</insert> </insert>
...@@ -172,18 +252,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -172,18 +252,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUserCode != null">create_user_code = #{createUserCode},</if> <if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if> <if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
<if test="unitPrice != null"> unit_price = #{unitPrice},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteStocktakeItemsById" parameterType="String"> <update id="deleteStocktakeItemsById" parameterType="String">
delete from stocktake_items where id = #{id} update stocktake_items
</delete> set is_used = 0
where id = #{id}
</update>
<delete id="deleteStocktakeItemsByIds" parameterType="String"> <update id="deleteStocktakeItemsByIds" parameterType="String">
delete from stocktake_items where id in update from stocktake_items
set is_used = 0
where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -23,41 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -23,41 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
</resultMap> </resultMap>
<resultMap id="StocktakesStocktakeItemsResult" type="Stocktakes" extends="StocktakesResult">
<collection property="stocktakeItemsList" ofType="StocktakeItems" column="id" select="selectStocktakeItemsList" />
</resultMap>
<resultMap type="StocktakeItems" id="StocktakeItemsResult">
<result property="id" column="id" />
<result property="stocktakeId" column="stocktake_id" />
<result property="inventoryId" column="inventory_id" />
<result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="systemQuantity" column="system_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="varianceQuantity" column="variance_quantity" />
<result property="varianceAmount" column="variance_amount" />
<result property="stocktakeStatus" column="stocktake_status" />
<result property="countedBy" column="counted_by" />
<result property="countedAt" column="counted_at" />
<result property="adjusted" column="adjusted" />
<result property="adjustmentReason" column="adjustment_reason" />
<result property="adjustedBy" column="adjusted_by" />
<result property="adjustedAt" column="adjusted_at" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="materialRange" column="material_range" />
<result property="locationRange" column="location_range" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectStocktakesVo"> <sql id="selectStocktakesVo">
select id, stocktake_id, stocktake_type, warehouse_id, stocktake_status, planned_date, material_range, location_range, total_variance_amount, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from stocktakes select id, stocktake_id, stocktake_type, warehouse_id, stocktake_status, planned_date, material_range, location_range, total_variance_amount, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from stocktakes
...@@ -84,24 +50,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -84,24 +50,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if> <if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if> <if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
order by create_time,planned_date,update_time desc
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectStocktakesById" parameterType="String" resultMap="StocktakesStocktakeItemsResult"> <select id="selectStocktakesById" parameterType="String" resultMap="StocktakesResult">
select id, stocktake_id, stocktake_type, warehouse_id, stocktake_status, planned_date, material_range, location_range select id, stocktake_id, stocktake_type, warehouse_id, stocktake_status, planned_date, material_range, location_range
, total_variance_amount, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code , total_variance_amount, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from stocktakes from stocktakes
where id = #{id} where id = #{id}
</select> </select>
<!-- 查询处理统计-->
<select id="selectStocktakeItemsList" resultMap="StocktakeItemsResult"> <select id="selectStocktakesListCount" resultType="com.ruoyi.inventory.domain.TO.StocktakesVo">
select id, inventory_id, stocktake_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code select
from stocktake_items st_it.material_id as materialId
where stocktake_id = #{stocktake_id} and is_used = 1 ,ma.sap_no as sapNo
,GROUP_CONCAT(DISTINCT date_format(st.planned_date,'%Y%m%d') SEPARATOR ',') as plannedDates
,GROUP_CONCAT(DISTINCT w.warehouses_name SEPARATOR ',') as warehousesName
,GROUP_CONCAT(DISTINCT sl.location_name SEPARATOR ',') as locationName
,GROUP_CONCAT(DISTINCT st_it.warehouse_id SEPARATOR ',') as warehousesId
,GROUP_CONCAT(DISTINCT st_it.location_id SEPARATOR ',') as locationId
,ma.ts_code as tsCode
,GROUP_CONCAT(DISTINCT dict.dict_label SEPARATOR ',') as hazardName
,IFNULL(sum(st_it.variance_quantity), '0') as countQuantity
,IFNULL(sum(st_it.variance_amount), '0') as countAmount
from stocktakes st
left join stocktake_items st_it on st.id = st_it.stocktake_id and st_it.is_used = 1
left join materials ma on st_it.material_id = ma.sap_no and ma.is_used = 1
left join warehouses w on st_it.warehouse_id = w.warehouses_code and w.is_used = 1
left join storage_locations sl on st_it.location_id = sl.location_code and sl.is_used = 1
left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where
st.is_used = 1
<if test="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(st.planned_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(st.planned_date,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<if test="warehouseId != null "> and st_it.warehouse_id = #{warehouseId}</if>
<if test="locationId != null "> and st_it.location_id = #{locationId}</if>
group by st_it.material_id
</select> </select>
<insert id="insertStocktakes" parameterType="Stocktakes"> <insert id="insertStocktakes" parameterType="Stocktakes">
insert into stocktakes insert into stocktakes
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -193,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -193,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchStocktakeItems"> <insert id="batchStocktakeItems">
insert into stocktake_items( id, stocktake_id, inventory_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code) values insert into stocktake_items( id, stocktake_id, inventory_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.stocktakeId}, #{inventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode}) ( #{item.id}, #{item.stocktakeId}, #{item.inventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论