修改平库盘点逻辑 库存物料状态、库存状态、货位状态、货位是否锁定逻辑修改
This commit is contained in:
@@ -23,7 +23,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 盘点差异Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-28
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public class CheckDifferenceRecordController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CheckDifferenceRecord checkDifferenceRecord)
|
||||
{
|
||||
return toAjax(checkDifferenceRecordService.insertCheckDifferenceRecord(checkDifferenceRecord));
|
||||
return checkDifferenceRecordService.insertCheckDifferenceRecord(checkDifferenceRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,18 +2,19 @@ package com.ruoyi.check.difference.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.check.difference.domain.CheckDifferenceRecord;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 盘点差异Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-28
|
||||
*/
|
||||
public interface ICheckDifferenceRecordService
|
||||
public interface ICheckDifferenceRecordService
|
||||
{
|
||||
/**
|
||||
* 查询盘点差异
|
||||
*
|
||||
*
|
||||
* @param checkGuid 盘点差异主键
|
||||
* @return 盘点差异
|
||||
*/
|
||||
@@ -21,7 +22,7 @@ public interface ICheckDifferenceRecordService
|
||||
|
||||
/**
|
||||
* 查询盘点差异列表
|
||||
*
|
||||
*
|
||||
* @param checkDifferenceRecord 盘点差异
|
||||
* @return 盘点差异集合
|
||||
*/
|
||||
@@ -29,15 +30,15 @@ public interface ICheckDifferenceRecordService
|
||||
|
||||
/**
|
||||
* 新增盘点差异
|
||||
*
|
||||
*
|
||||
* @param checkDifferenceRecord 盘点差异
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCheckDifferenceRecord(CheckDifferenceRecord checkDifferenceRecord);
|
||||
public AjaxResult insertCheckDifferenceRecord(CheckDifferenceRecord checkDifferenceRecord);
|
||||
|
||||
/**
|
||||
* 修改盘点差异
|
||||
*
|
||||
*
|
||||
* @param checkDifferenceRecord 盘点差异
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ public interface ICheckDifferenceRecordService
|
||||
|
||||
/**
|
||||
* 批量删除盘点差异
|
||||
*
|
||||
*
|
||||
* @param checkGuids 需要删除的盘点差异主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ public interface ICheckDifferenceRecordService
|
||||
|
||||
/**
|
||||
* 删除盘点差异信息
|
||||
*
|
||||
*
|
||||
* @param checkGuid 盘点差异主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.ruoyi.check.difference.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||
@@ -58,21 +60,33 @@ public class CheckDifferenceRecordServiceImpl implements ICheckDifferenceRecordS
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCheckDifferenceRecord(CheckDifferenceRecord checkDifferenceRecord)
|
||||
public AjaxResult insertCheckDifferenceRecord(CheckDifferenceRecord checkDifferenceRecord)
|
||||
{
|
||||
if (checkDifferenceRecord.getRecordType()==1){
|
||||
String stockId = checkDifferenceRecord.getStockId();
|
||||
BasStock basStock = basStockService.selectBasStockByStockId(stockId);
|
||||
if (!"1".equals(basStock.getProductStatus())){
|
||||
return AjaxResult.warn("库存非正常状态");
|
||||
}
|
||||
basStock.setProductStatus("2");
|
||||
basStockService.updateBasStock(basStock);
|
||||
checkDifferenceRecord.setOldQuantity(basStock.getQuantity());
|
||||
}else if (checkDifferenceRecord.getRecordType()==2){
|
||||
checkDifferenceRecord.setOldQuantity("0");
|
||||
}else if (checkDifferenceRecord.getRecordType()==3){
|
||||
BasStock basStock = basStockService.selectBasStockByStockId(checkDifferenceRecord.getStockId());
|
||||
if (!"1".equals(basStock.getProductStatus())){
|
||||
return AjaxResult.warn("库存非正常状态");
|
||||
}
|
||||
basStock.setProductStatus("2");
|
||||
basStockService.updateBasStock(basStock);
|
||||
checkDifferenceRecord.setNewQuantity("0");
|
||||
}
|
||||
checkDifferenceRecord.setCreateTime(DateUtils.getNowDate());
|
||||
checkDifferenceRecord.setCreateTime(new Date());
|
||||
checkDifferenceRecord.setCheckGuid(IdUtil.fastSimpleUUID());
|
||||
checkDifferenceRecord.setStatus("0");
|
||||
return checkDifferenceRecordMapper.insertCheckDifferenceRecord(checkDifferenceRecord);
|
||||
checkDifferenceRecordMapper.insertCheckDifferenceRecord(checkDifferenceRecord);
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.ruoyi.check.flat;
|
||||
|
||||
import com.ruoyi.check.difference.domain.CheckDifferenceRecord;
|
||||
import com.ruoyi.check.difference.service.ICheckDifferenceRecordService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 平库盘点
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/check/flatStockCheck")
|
||||
public class FlatStockCheckController {
|
||||
|
||||
@Autowired
|
||||
private ICheckDifferenceRecordService checkDifferenceRecordService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody CheckDifferenceRecord checkDifferenceRecord) {
|
||||
int i = checkDifferenceRecordService.insertCheckDifferenceRecord(checkDifferenceRecord);
|
||||
return i > 0 ? AjaxResult.success(): AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -176,29 +176,60 @@ public class MydoJobServiceImpl implements IMydoJobService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult manualCompleted(MydoJob mydoJob) {
|
||||
//插入库存
|
||||
|
||||
String jobId = mydoJob.getJobId();
|
||||
MydoJob job = selectMydoJobByJobId(jobId);
|
||||
if (job == null) {
|
||||
return AjaxResult.warn("任务不存在");
|
||||
}
|
||||
if ("5".equals(job.getInOrOut())){
|
||||
//料箱盘点入库作业
|
||||
if ("6".equals(job.getInOrOut())){
|
||||
//托盘盘点入库,放入原货位,直接修改货位状态,库存状态
|
||||
|
||||
//修改货位
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setStatus("7");
|
||||
basCargoSpace.setStatus("8");
|
||||
basCargoSpace.setTrayCode(job.getTrayCode());
|
||||
basCargoSpace.setCargoSpaceId(job.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
|
||||
|
||||
//修改物料状态
|
||||
BasStock basStockParam = new BasStock();
|
||||
basStockParam.setTrayCode(job.getTrayCode());
|
||||
List<BasStock> basStocks = basStockService.selectBasStockList(basStockParam);
|
||||
for (BasStock basStock : basStocks) {
|
||||
basStock.setProductStatus("2");
|
||||
basStockService.updateBasStock(basStock);
|
||||
}
|
||||
|
||||
//插入历史表
|
||||
insertHistory(mydoJob.getJobId());
|
||||
return AjaxResult.success();
|
||||
|
||||
}else if ("5".equals(job.getInOrOut())){
|
||||
//料箱盘点入库
|
||||
MydoJobDetail param = new MydoJobDetail();
|
||||
param.setJobId(jobId);
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(param);
|
||||
if (CollUtil.isNotEmpty(mydoJobDetails)) {
|
||||
List<BasStock> list = new ArrayList<>();
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetails) {
|
||||
list.add(getStockByInStockinDetail(mydoJobDetail, job));
|
||||
}
|
||||
basStockService.insertBasStockList(list);
|
||||
mydoJob.setStatus("4");
|
||||
updateMydoJob(mydoJob);
|
||||
//修改货位
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setStatus("8");
|
||||
basCargoSpace.setTrayCode(job.getTrayCode());
|
||||
basCargoSpace.setCargoSpaceId(job.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
//插入历史表
|
||||
insertHistory(mydoJob.getJobId());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
//正常入库作业
|
||||
|
||||
MydoJobDetail param = new MydoJobDetail();
|
||||
param.setJobId(jobId);
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(param);
|
||||
@@ -229,7 +260,11 @@ public class MydoJobServiceImpl implements IMydoJobService {
|
||||
stock.setStockId(basJobIdService.getJobId("KC"));
|
||||
stock.setCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
stock.setStockStatus("1");
|
||||
stock.setProductStatus("1");
|
||||
if ("5".equals(mydoJob.getInOrOut())){
|
||||
stock.setProductStatus("2");
|
||||
}else {
|
||||
stock.setProductStatus("1");
|
||||
}
|
||||
stock.setLotNo(mydoJobDetail.getLotNo());
|
||||
stock.setInDate(DateUtils.getTime());
|
||||
stock.setProductGuid(mydoJobDetail.getProductGuid());
|
||||
|
||||
@@ -2,18 +2,19 @@ package com.ruoyi.stock.stock.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 库存信息Mapper接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-24
|
||||
*/
|
||||
public interface BasStockMapper
|
||||
public interface BasStockMapper
|
||||
{
|
||||
/**
|
||||
* 查询库存信息
|
||||
*
|
||||
*
|
||||
* @param stockId 库存信息主键
|
||||
* @return 库存信息
|
||||
*/
|
||||
@@ -21,7 +22,7 @@ public interface BasStockMapper
|
||||
|
||||
/**
|
||||
* 查询库存信息列表
|
||||
*
|
||||
*
|
||||
* @param basStock 库存信息
|
||||
* @return 库存信息集合
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ public interface BasStockMapper
|
||||
|
||||
/**
|
||||
* 新增库存信息
|
||||
*
|
||||
*
|
||||
* @param basStock 库存信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public interface BasStockMapper
|
||||
|
||||
/**
|
||||
* 修改库存信息
|
||||
*
|
||||
*
|
||||
* @param basStock 库存信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ public interface BasStockMapper
|
||||
|
||||
/**
|
||||
* 删除库存信息
|
||||
*
|
||||
*
|
||||
* @param stockId 库存信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ public interface BasStockMapper
|
||||
|
||||
/**
|
||||
* 批量删除库存信息
|
||||
*
|
||||
*
|
||||
* @param stockIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -62,4 +63,6 @@ public interface BasStockMapper
|
||||
void insertBasStockList(List<BasStock> list);
|
||||
|
||||
List<BasStock> selectKtpStock(BasStock basStock);
|
||||
|
||||
int updateStockStatusByTrayCode(@Param("stockStatus") String stockStatus,@Param("trayCode") String trayCode);
|
||||
}
|
||||
|
||||
@@ -111,31 +111,27 @@ public class BasStockServiceImpl implements IBasStockService
|
||||
{
|
||||
BasStock oldBasStock = basStockMapper.selectBasStockByStockId(basStock.getStockId());
|
||||
insertMaintainRecord(oldBasStock,basStock,"2");
|
||||
BasCargoSpace oldBasCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(basStock.getCargoSpaceId());
|
||||
insertFreezeRecord(oldBasCargoSpace,basStock);
|
||||
insertFreezeRecord(oldBasStock,basStock);
|
||||
return basStockMapper.updateBasStock(basStock);
|
||||
}
|
||||
|
||||
private void insertFreezeRecord(BasCargoSpace oldBasCargoSpace, BasStock basStock) {
|
||||
if (!oldBasCargoSpace.getLocked().equals(basStock.getCargoSpaceStatus())){
|
||||
private void insertFreezeRecord(BasStock oldBasStock, BasStock basStock) {
|
||||
if (!oldBasStock.getStockStatus().equals(basStock.getStockStatus())){
|
||||
BasStockFreezeRecord basStockFreezeRecord = new BasStockFreezeRecord();
|
||||
basStockFreezeRecord.setWhGuid(IdUtil.fastSimpleUUID());
|
||||
basStockFreezeRecord.setCargoSpaceId(basStock.getCargoSpaceId());
|
||||
basStockFreezeRecord.setTrayCode(basStock.getTrayCode());
|
||||
basStockFreezeRecord.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
basStockFreezeRecord.setCreateTime(new Date());
|
||||
basStockFreezeRecord.setOldStatus(oldBasCargoSpace.getLocked());
|
||||
basStockFreezeRecord.setCurrStatus(basStock.getCargoSpaceStatus());
|
||||
basStockFreezeRecord.setOldStatus(oldBasStock.getStockStatus());
|
||||
basStockFreezeRecord.setCurrStatus(basStock.getStockStatus());
|
||||
basStockFreezeRecord.setWarehouseId(basStock.getWarehouseId());
|
||||
if ("N".equals(basStock.getCargoSpaceStatus())){
|
||||
basStockFreezeRecord.setMethod("解锁");
|
||||
if ("1".equals(basStock.getStockStatus())){
|
||||
basStockFreezeRecord.setMethod("解冻");
|
||||
}else {
|
||||
basStockFreezeRecord.setMethod("锁定");
|
||||
basStockFreezeRecord.setMethod("冻结");
|
||||
}
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setCargoSpaceId(basStock.getCargoSpaceId());
|
||||
basCargoSpace.setLocked(basStock.getCargoSpaceStatus());
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
basStockMapper.updateStockStatusByTrayCode(basStock.getStockStatus(),oldBasStock.getTrayCode());
|
||||
basStockFreezeRecordService.insertBasStockFreezeRecord(basStockFreezeRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="recordType != null "> and record_type = #{recordType}</if>
|
||||
<if test="productGuid != null and productGuid != ''"> and product_guid = #{productGuid}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCheckDifferenceRecordByCheckGuid" parameterType="String" resultMap="CheckDifferenceRecordResult">
|
||||
|
||||
@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="barCodeQuantity != null and barCodeQuantity != ''"> and bar_code_quantity = #{barCodeQuantity}</if>
|
||||
<if test="productGuid != null and productGuid != ''"> and product_guid = #{productGuid}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectBasStockFreezeRecordByWhGuid" parameterType="String" resultMap="BasStockFreezeRecordResult">
|
||||
|
||||
@@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="barCodeOldQuantity != null and barCodeOldQuantity != ''"> and bar_code_old_quantity = #{barCodeOldQuantity}</if>
|
||||
<if test="barCodeQuantity != null and barCodeQuantity != ''"> and bar_code_quantity = #{barCodeQuantity}</if>
|
||||
<if test="productGuid != null and productGuid != ''"> and product_guid = #{productGuid}</if>
|
||||
order by create_time desc
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -246,6 +246,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
where stock_id = #{stockId}
|
||||
</update>
|
||||
<update id="updateStockStatusByTrayCode">
|
||||
update bas_stock set stock_status = #{stockStatus} where tray_code = #{trayCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasStockByStockId" parameterType="String">
|
||||
delete from bas_stock where stock_id = #{stockId}
|
||||
|
||||
Reference in New Issue
Block a user