| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | alter table stock_inventory |
| | | add warehouse varchar(255) null comment 'ä»åº'; |
| | | alter table stock_uninventory |
| | | add warehouse varchar(255) null comment 'ä»åº'; |
| | | alter table stock_in_record |
| | | add warehouse varchar(255) null comment 'ä»åº'; |
| | |
| | | @Excel(name = "æ¹å·") |
| | | private String batchNo; |
| | | |
| | | @Excel(name = "ä»åº") |
| | | private String warehouse; |
| | | |
| | | @Excel(name = "åæ ¼åºåæ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "ä»åº") |
| | | private String warehouse; |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "ä»åº") |
| | | private String warehouse; |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "ä»åº") |
| | | private String warehouse; |
| | | |
| | | } |
| | |
| | | setBatchNo(stockInRecord.getBatchNo()); |
| | | setRemark(stockInRecord.getRemark()); |
| | | setWarnNum(stockInRecord.getWarnNum()); |
| | | setWarehouse(stockInRecord.getWarehouse()); |
| | | setVersion(1); |
| | | }}); |
| | | } else { |
| | |
| | | setQualitity(stockInRecord.getStockInNum()); |
| | | setBatchNo(stockInRecord.getBatchNo()); |
| | | setRemark(stockInRecord.getRemark()); |
| | | setWarehouse(stockInRecord.getWarehouse()); |
| | | setVersion(1); |
| | | }}); |
| | | } else { |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysDictDataService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | |
| | | private final StockUninventoryService stockUninventoryService; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ProductModelMapper productModelMapper; |
| | | private final ISysDictDataService sysDictDataService; |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | |
| | | stockInRecordDto.setRemark(stockInventoryDto.getRemark()); |
| | | stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum()); |
| | | stockInRecordDto.setCreateTime(stockInventoryDto.getCreateTime()); |
| | | stockInRecordDto.setWarehouse(stockInventoryDto.getWarehouse()); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | return true; |
| | | } |
| | |
| | | int successCount = 0; |
| | | |
| | | for (StockInventoryExportData dto : list) { |
| | | // éªè¯ä»åºæ¯å¦åå¨äºåå
¸ä¸ |
| | | if (StringUtils.isNotEmpty(dto.getWarehouse())) { |
| | | String warehouseLabel = sysDictDataService.selectDictLabel("warehouse", dto.getWarehouse()); |
| | | if (StringUtils.isEmpty(warehouseLabel)) { |
| | | throw new RuntimeException("ä»åºå¼ " + dto.getWarehouse() + " ä¸åå¨äºåå
¸ä¸"); |
| | | } |
| | | } |
| | | |
| | | // æå»ºæ¥æ¾é® |
| | | String key = dto.getProductName() + "|" + dto.getModel(); |
| | | SalesLedgerProduct matchedProduct = productMap.get(key); |
| | |
| | | stockInventoryDto.setQualitity(dto.getQualifiedQuantity()); |
| | | stockInventoryDto.setRemark(dto.getRemark()); |
| | | stockInventoryDto.setWarnNum(dto.getWarnNum()); |
| | | stockInventoryDto.setWarehouse(dto.getWarehouse()); |
| | | |
| | | // éªè¯åæ ¼å»ç»æ°é |
| | | if (ObjectUtils.isNotEmpty(dto.getQualifiedLockedQuantity())) { |
| | |
| | | stockUninventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()); |
| | | stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity()); |
| | | stockUninventoryDto.setRemark(dto.getRemark()); |
| | | stockUninventoryDto.setWarehouse(dto.getWarehouse()); |
| | | |
| | | // éªè¯ä¸åæ ¼å»ç»æ°é |
| | | if (ObjectUtils.isNotEmpty(dto.getUnQualifiedLockedQuantity())) { |
| | |
| | | <if test="ew.lockedQuantity != null and ew.lockedQuantity !=''"> |
| | | locked_quantity = locked_quantity + #{ew.lockedQuantity}, |
| | | </if> |
| | | <if test="ew.warehouse != null and ew.warehouse !=''"> |
| | | warehouse = #{ew.warehouse}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | select si.id, |
| | | si.warehouse, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) as locked_quantity, |
| | | si.product_model_id, |
| | |
| | | unit, |
| | | product_name, |
| | | product_id, |
| | | MAX(warehouse) as warehouse, |
| | | 'combined' as stockType |
| | | from ( |
| | | select |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | si.warehouse, |
| | | ( |
| | | select IFNULL(SUM(sor.stock_out_num), 0) |
| | | from stock_out_record sor |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | su.warehouse, |
| | | 0 as qualifiedPendingOut, |
| | | ( |
| | | select IFNULL(SUM(sor.stock_out_num), 0) |
| | |
| | | model, |
| | | unit, |
| | | product_name, |
| | | product_id |
| | | order by combined.create_time desc |
| | | product_id, |
| | | warehouse |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | |
| | | unit, |
| | | product_name, |
| | | product_id, |
| | | MAX(warehouse) as warehouse, |
| | | 'combined' as stockType |
| | | from ( |
| | | select |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | si.warehouse, |
| | | ( |
| | | select IFNULL(SUM(sor.stock_out_num), 0) |
| | | from stock_out_record sor |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | su.warehouse, |
| | | 0 as qualifiedPendingOut, |
| | | ( |
| | | select IFNULL(SUM(sor.stock_out_num), 0) |
| | |
| | | and combined.product_id in (select id from product_tree) |
| | | </if> |
| | | </where> |
| | | group by batch_no, product_model_id, model, unit, product_name, product_id |
| | | group by batch_no, product_model_id, model, unit, product_name, product_id, warehouse |
| | | </select> |
| | | <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | select sir.*,si.qualitity as current_stock, |
| | |
| | | unit, |
| | | product_name, |
| | | product_id, |
| | | MAX(warehouse) as warehouse, |
| | | |
| | | MAX(create_time) as create_time, |
| | | MAX(update_time) as update_time, |
| | |
| | | COALESCE(si.warn_num, 0) as warn_num, |
| | | si.version, |
| | | si.remark, |
| | | si.warehouse, |
| | | |
| | | ( |
| | | select IFNULL(SUM(sor.stock_out_num), 0) |
| | |
| | | 0 as warn_num, |
| | | su.version, |
| | | su.remark, |
| | | su.warehouse, |
| | | |
| | | 0 as qualifiedPendingOut, |
| | | |
| | |
| | | model, |
| | | unit, |
| | | product_name, |
| | | product_id |
| | | product_id, |
| | | warehouse |
| | | order by |
| | | batch_no |
| | | </select> |
| | |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | <if test="ew.warehouse != null and ew.warehouse !=''"> |
| | | warehouse = #{ew.warehouse}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |