出库单据

This commit is contained in:
张怡蓉
2025-09-17 18:02:58 +08:00
parent 2d7587fa8c
commit 326e74a825
15 changed files with 1564 additions and 73 deletions

View File

@@ -32,6 +32,7 @@ import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService;
import com.ruoyi.pda.domain.TrayCodeMakeSure;
import com.ruoyi.pda.service.PdaService;
import com.ruoyi.stock.stock.domain.BasStock;
import com.ruoyi.stock.stock.mapper.BasStockMapper;
import com.ruoyi.stock.stock.service.IBasStockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -76,6 +77,8 @@ public class MydoJobServiceImpl implements IMydoJobService {
private IToWcsService iToWcsService;
@Autowired
private ITransferBillCallbackService transferBillCallbackService;
@Autowired
private BasStockMapper basStockMapper;
/**
@@ -361,12 +364,12 @@ public class MydoJobServiceImpl implements IMydoJobService {
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
for (MydoJobDetail detail : mydoJobDetails) {
//修改库存的出库数量
BasStock basStock = basStockService.selectBasStockByStockId(detail.getStockId());
BasStock basStock = basStockMapper.selectBasStockByStockId(detail.getStockId());
if (basStock != null) {
BigDecimal outQuantity = Convert.toBigDecimal(basStock.getOutQuantity());
BigDecimal substract = outQuantity.subtract(Convert.toBigDecimal(detail.getOutQuantity()));
basStock.setOutQuantity(String.valueOf(substract));
basStockService.updateBasStock(basStock);
basStockMapper.updateBasStock(basStock);
}
//修改单据数量
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(detail.getInOrOutDId());
@@ -388,12 +391,12 @@ public class MydoJobServiceImpl implements IMydoJobService {
updateMydoJob(job);
insertHistory(jobId);
//通知wcs
AjaxResult ajaxResult = iToWcsService.cancelTaskByTaskNo(job.getTaskNo());
if (ajaxResult.isSuccess()) {
return AjaxResult.success();
} else {
throw new RuntimeException(Convert.toStr(ajaxResult.get("msg")));
}
// AjaxResult ajaxResult = iToWcsService.cancelTaskByTaskNo(job.getTaskNo());
// if (ajaxResult.isSuccess()){
// return AjaxResult.success();
// }else {
// throw new RuntimeException(Convert.toStr(ajaxResult.get("msg")));
// }
}
} catch (Exception e) {
@@ -401,7 +404,7 @@ public class MydoJobServiceImpl implements IMydoJobService {
log.error("任务处理异常", e);
return AjaxResult.error();
}
return AjaxResult.error();
return AjaxResult.success();
}
@Override

View File

@@ -0,0 +1,104 @@
package com.ruoyi.out.handAllotStock.controller;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.out.handAllotStock.domain.ViewHandAllotStock;
import com.ruoyi.out.handAllotStock.service.IViewHandAllotStockService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 手动分配库存Controller
*
* @author ruoyi
* @date 2025-09-16
*/
@RestController
@RequestMapping("/out/handAllotStock")
public class ViewHandAllotStockController extends BaseController
{
@Autowired
private IViewHandAllotStockService viewHandAllotStockService;
/**
* 查询手动分配库存列表
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:list')")
@GetMapping("/list")
public TableDataInfo list(ViewHandAllotStock viewHandAllotStock)
{
startPage();
List<ViewHandAllotStock> list = viewHandAllotStockService.selectViewHandAllotStockList(viewHandAllotStock);
return getDataTable(list);
}
/**
* 导出手动分配库存列表
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:export')")
@Log(title = "手动分配库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ViewHandAllotStock viewHandAllotStock)
{
List<ViewHandAllotStock> list = viewHandAllotStockService.selectViewHandAllotStockList(viewHandAllotStock);
ExcelUtil<ViewHandAllotStock> util = new ExcelUtil<ViewHandAllotStock>(ViewHandAllotStock.class);
util.exportExcel(response, list, "手动分配库存数据");
}
/**
* 获取手动分配库存详细信息
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:query')")
@GetMapping(value = "/{stockId}")
public AjaxResult getInfo(@PathVariable("stockId") String stockId)
{
return success(viewHandAllotStockService.selectViewHandAllotStockByStockId(stockId));
}
/**
* 新增手动分配库存
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:add')")
@Log(title = "手动分配库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ViewHandAllotStock viewHandAllotStock)
{
return toAjax(viewHandAllotStockService.insertViewHandAllotStock(viewHandAllotStock));
}
/**
* 修改手动分配库存
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:edit')")
@Log(title = "手动分配库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ViewHandAllotStock viewHandAllotStock)
{
return toAjax(viewHandAllotStockService.updateViewHandAllotStock(viewHandAllotStock));
}
/**
* 删除手动分配库存
*/
@PreAuthorize("@ss.hasPermi('out:handAllotStock:remove')")
@Log(title = "手动分配库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{stockIds}")
public AjaxResult remove(@PathVariable String[] stockIds)
{
return toAjax(viewHandAllotStockService.deleteViewHandAllotStockByStockIds(stockIds));
}
}

View File

@@ -0,0 +1,579 @@
package com.ruoyi.out.handAllotStock.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 手动分配库存对象 view_hand_allot_stock
*
* @author ruoyi
* @date 2025-09-16
*/
public class ViewHandAllotStock extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 库存编码 */
@Excel(name = "库存编码")
private String stockId;
/** 货位编码 */
@Excel(name = "货位编码")
private String cargoSpaceId;
/** 库存状态 */
@Excel(name = "库存状态")
private String stockStatus;
/** 物品状态 */
@Excel(name = "物品状态")
private String productStatus;
/** 批次号 */
@Excel(name = "批次号")
private String lotNo;
/** 入库时间 */
@Excel(name = "入库时间")
private String inDate;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String backDate;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String productGuid;
/** 数量 */
@Excel(name = "数量")
private BigDecimal quantity;
/** 作业编码 */
@Excel(name = "作业编码")
private String jobId;
/** 托盘条码 */
@Excel(name = "托盘条码")
private String trayCode;
/** 出库数量 */
@Excel(name = "出库数量")
private String outQuantity;
/** 入库子单号 */
@Excel(name = "入库子单号")
private String stockinDetailId;
/** 入库单号 */
@Excel(name = "入库单号")
private String stockinId;
/** 入库类型 */
@Excel(name = "入库类型")
private String inType;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String inClassId;
/** 仓库编码 */
@Excel(name = "仓库编码")
private String warehouseId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String stackingId;
/** 规格 */
@Excel(name = "规格")
private String spare1;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String spare2;
/** 单位 */
@Excel(name = "单位")
private String spare3;
/** 型号 */
@Excel(name = "型号")
private String spare4;
/** 颜色 */
@Excel(name = "颜色")
private String spare5;
/** 序列号 */
@Excel(name = "序列号")
private String spare6;
/** 品号 */
@Excel(name = "品号")
private String productId;
/** 品名 */
@Excel(name = "品名")
private String productName;
/** 电压 */
@Excel(name = "电压")
private String voltage;
/** 功率 */
@Excel(name = "功率")
private String power;
/** 相位 */
@Excel(name = "相位")
private String phase;
/** 净重 */
@Excel(name = "净重")
private BigDecimal netWeight;
/** 毛重 */
@Excel(name = "毛重")
private BigDecimal grossWeight;
/** 分销 */
@Excel(name = "分销")
private String distribution;
/** 机型 */
@Excel(name = "机型")
private String model;
/** 订单号 */
@Excel(name = "订单号")
private String orderId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String spare7;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String spare8;
/** 货位名称 */
@Excel(name = "货位名称")
private String cargoSpaceName;
public void setStockId(String stockId)
{
this.stockId = stockId;
}
public String getStockId()
{
return stockId;
}
public void setCargoSpaceId(String cargoSpaceId)
{
this.cargoSpaceId = cargoSpaceId;
}
public String getCargoSpaceId()
{
return cargoSpaceId;
}
public void setStockStatus(String stockStatus)
{
this.stockStatus = stockStatus;
}
public String getStockStatus()
{
return stockStatus;
}
public void setProductStatus(String productStatus)
{
this.productStatus = productStatus;
}
public String getProductStatus()
{
return productStatus;
}
public void setLotNo(String lotNo)
{
this.lotNo = lotNo;
}
public String getLotNo()
{
return lotNo;
}
public void setInDate(String inDate)
{
this.inDate = inDate;
}
public String getInDate()
{
return inDate;
}
public void setBackDate(String backDate)
{
this.backDate = backDate;
}
public String getBackDate()
{
return backDate;
}
public void setProductGuid(String productGuid)
{
this.productGuid = productGuid;
}
public String getProductGuid()
{
return productGuid;
}
public void setQuantity(BigDecimal quantity)
{
this.quantity = quantity;
}
public BigDecimal getQuantity()
{
return quantity;
}
public void setJobId(String jobId)
{
this.jobId = jobId;
}
public String getJobId()
{
return jobId;
}
public void setTrayCode(String trayCode)
{
this.trayCode = trayCode;
}
public String getTrayCode()
{
return trayCode;
}
public void setOutQuantity(String outQuantity)
{
this.outQuantity = outQuantity;
}
public String getOutQuantity()
{
return outQuantity;
}
public void setStockinDetailId(String stockinDetailId)
{
this.stockinDetailId = stockinDetailId;
}
public String getStockinDetailId()
{
return stockinDetailId;
}
public void setStockinId(String stockinId)
{
this.stockinId = stockinId;
}
public String getStockinId()
{
return stockinId;
}
public void setInType(String inType)
{
this.inType = inType;
}
public String getInType()
{
return inType;
}
public void setInClassId(String inClassId)
{
this.inClassId = inClassId;
}
public String getInClassId()
{
return inClassId;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setStackingId(String stackingId)
{
this.stackingId = stackingId;
}
public String getStackingId()
{
return stackingId;
}
public void setSpare1(String spare1)
{
this.spare1 = spare1;
}
public String getSpare1()
{
return spare1;
}
public void setSpare2(String spare2)
{
this.spare2 = spare2;
}
public String getSpare2()
{
return spare2;
}
public void setSpare3(String spare3)
{
this.spare3 = spare3;
}
public String getSpare3()
{
return spare3;
}
public void setSpare4(String spare4)
{
this.spare4 = spare4;
}
public String getSpare4()
{
return spare4;
}
public void setSpare5(String spare5)
{
this.spare5 = spare5;
}
public String getSpare5()
{
return spare5;
}
public void setSpare6(String spare6)
{
this.spare6 = spare6;
}
public String getSpare6()
{
return spare6;
}
public void setProductId(String productId)
{
this.productId = productId;
}
public String getProductId()
{
return productId;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public String getProductName()
{
return productName;
}
public void setVoltage(String voltage)
{
this.voltage = voltage;
}
public String getVoltage()
{
return voltage;
}
public void setPower(String power)
{
this.power = power;
}
public String getPower()
{
return power;
}
public void setPhase(String phase)
{
this.phase = phase;
}
public String getPhase()
{
return phase;
}
public void setNetWeight(BigDecimal netWeight)
{
this.netWeight = netWeight;
}
public BigDecimal getNetWeight()
{
return netWeight;
}
public void setGrossWeight(BigDecimal grossWeight)
{
this.grossWeight = grossWeight;
}
public BigDecimal getGrossWeight()
{
return grossWeight;
}
public void setDistribution(String distribution)
{
this.distribution = distribution;
}
public String getDistribution()
{
return distribution;
}
public void setModel(String model)
{
this.model = model;
}
public String getModel()
{
return model;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setSpare7(String spare7)
{
this.spare7 = spare7;
}
public String getSpare7()
{
return spare7;
}
public void setSpare8(String spare8)
{
this.spare8 = spare8;
}
public String getSpare8()
{
return spare8;
}
public void setCargoSpaceName(String cargoSpaceName)
{
this.cargoSpaceName = cargoSpaceName;
}
public String getCargoSpaceName()
{
return cargoSpaceName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("stockId", getStockId())
.append("cargoSpaceId", getCargoSpaceId())
.append("stockStatus", getStockStatus())
.append("productStatus", getProductStatus())
.append("lotNo", getLotNo())
.append("inDate", getInDate())
.append("backDate", getBackDate())
.append("productGuid", getProductGuid())
.append("quantity", getQuantity())
.append("jobId", getJobId())
.append("trayCode", getTrayCode())
.append("outQuantity", getOutQuantity())
.append("stockinDetailId", getStockinDetailId())
.append("stockinId", getStockinId())
.append("inType", getInType())
.append("inClassId", getInClassId())
.append("warehouseId", getWarehouseId())
.append("stackingId", getStackingId())
.append("spare1", getSpare1())
.append("spare2", getSpare2())
.append("spare3", getSpare3())
.append("spare4", getSpare4())
.append("spare5", getSpare5())
.append("spare6", getSpare6())
.append("productId", getProductId())
.append("productName", getProductName())
.append("voltage", getVoltage())
.append("power", getPower())
.append("phase", getPhase())
.append("netWeight", getNetWeight())
.append("grossWeight", getGrossWeight())
.append("distribution", getDistribution())
.append("model", getModel())
.append("orderId", getOrderId())
.append("spare7", getSpare7())
.append("spare8", getSpare8())
.append("cargoSpaceName", getCargoSpaceName())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.out.handAllotStock.mapper;
import java.util.List;
import com.ruoyi.out.handAllotStock.domain.ViewHandAllotStock;
/**
* 手动分配库存Mapper接口
*
* @author ruoyi
* @date 2025-09-16
*/
public interface ViewHandAllotStockMapper
{
/**
* 查询手动分配库存
*
* @param stockId 手动分配库存主键
* @return 手动分配库存
*/
public ViewHandAllotStock selectViewHandAllotStockByStockId(String stockId);
/**
* 查询手动分配库存列表
*
* @param viewHandAllotStock 手动分配库存
* @return 手动分配库存集合
*/
public List<ViewHandAllotStock> selectViewHandAllotStockList(ViewHandAllotStock viewHandAllotStock);
/**
* 新增手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
public int insertViewHandAllotStock(ViewHandAllotStock viewHandAllotStock);
/**
* 修改手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
public int updateViewHandAllotStock(ViewHandAllotStock viewHandAllotStock);
/**
* 删除手动分配库存
*
* @param stockId 手动分配库存主键
* @return 结果
*/
public int deleteViewHandAllotStockByStockId(String stockId);
/**
* 批量删除手动分配库存
*
* @param stockIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteViewHandAllotStockByStockIds(String[] stockIds);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.out.handAllotStock.service;
import java.util.List;
import com.ruoyi.out.handAllotStock.domain.ViewHandAllotStock;
/**
* 手动分配库存Service接口
*
* @author ruoyi
* @date 2025-09-16
*/
public interface IViewHandAllotStockService
{
/**
* 查询手动分配库存
*
* @param stockId 手动分配库存主键
* @return 手动分配库存
*/
public ViewHandAllotStock selectViewHandAllotStockByStockId(String stockId);
/**
* 查询手动分配库存列表
*
* @param viewHandAllotStock 手动分配库存
* @return 手动分配库存集合
*/
public List<ViewHandAllotStock> selectViewHandAllotStockList(ViewHandAllotStock viewHandAllotStock);
/**
* 新增手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
public int insertViewHandAllotStock(ViewHandAllotStock viewHandAllotStock);
/**
* 修改手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
public int updateViewHandAllotStock(ViewHandAllotStock viewHandAllotStock);
/**
* 批量删除手动分配库存
*
* @param stockIds 需要删除的手动分配库存主键集合
* @return 结果
*/
public int deleteViewHandAllotStockByStockIds(String[] stockIds);
/**
* 删除手动分配库存信息
*
* @param stockId 手动分配库存主键
* @return 结果
*/
public int deleteViewHandAllotStockByStockId(String stockId);
}

View File

@@ -0,0 +1,93 @@
package com.ruoyi.out.handAllotStock.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.out.handAllotStock.mapper.ViewHandAllotStockMapper;
import com.ruoyi.out.handAllotStock.domain.ViewHandAllotStock;
import com.ruoyi.out.handAllotStock.service.IViewHandAllotStockService;
/**
* 手动分配库存Service业务层处理
*
* @author ruoyi
* @date 2025-09-16
*/
@Service
public class ViewHandAllotStockServiceImpl implements IViewHandAllotStockService
{
@Autowired
private ViewHandAllotStockMapper viewHandAllotStockMapper;
/**
* 查询手动分配库存
*
* @param stockId 手动分配库存主键
* @return 手动分配库存
*/
@Override
public ViewHandAllotStock selectViewHandAllotStockByStockId(String stockId)
{
return viewHandAllotStockMapper.selectViewHandAllotStockByStockId(stockId);
}
/**
* 查询手动分配库存列表
*
* @param viewHandAllotStock 手动分配库存
* @return 手动分配库存
*/
@Override
public List<ViewHandAllotStock> selectViewHandAllotStockList(ViewHandAllotStock viewHandAllotStock)
{
return viewHandAllotStockMapper.selectViewHandAllotStockList(viewHandAllotStock);
}
/**
* 新增手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
@Override
public int insertViewHandAllotStock(ViewHandAllotStock viewHandAllotStock)
{
return viewHandAllotStockMapper.insertViewHandAllotStock(viewHandAllotStock);
}
/**
* 修改手动分配库存
*
* @param viewHandAllotStock 手动分配库存
* @return 结果
*/
@Override
public int updateViewHandAllotStock(ViewHandAllotStock viewHandAllotStock)
{
return viewHandAllotStockMapper.updateViewHandAllotStock(viewHandAllotStock);
}
/**
* 批量删除手动分配库存
*
* @param stockIds 需要删除的手动分配库存主键
* @return 结果
*/
@Override
public int deleteViewHandAllotStockByStockIds(String[] stockIds)
{
return viewHandAllotStockMapper.deleteViewHandAllotStockByStockIds(stockIds);
}
/**
* 删除手动分配库存信息
*
* @param stockId 手动分配库存主键
* @return 结果
*/
@Override
public int deleteViewHandAllotStockByStockId(String stockId)
{
return viewHandAllotStockMapper.deleteViewHandAllotStockByStockId(stockId);
}
}

View File

@@ -137,4 +137,15 @@ public class OutStockoutController extends BaseController {
public AjaxResult autoAllot(@RequestParam("stockoutId") String stockoutId) {
return outStockoutService.autoAllot(stockoutId);
}
/**
* 手动分配
*/
@PreAuthorize("@ss.hasPermi('out:outStockout:manualAllot')")
@Log(title = "出库单手动分配", businessType = BusinessType.OTHER)
@GetMapping("/manualAllot")
public AjaxResult manualAllot(@RequestParam("stockList") String[] stockList, @RequestParam("stockoutDetailId") String stockoutDetailId) {
return outStockoutService.manualAllot(stockList, stockoutDetailId);
}
}

View File

@@ -66,4 +66,6 @@ public interface OutStockoutMapper
void autoAllot(HashMap<String, String> map);
OutStockout selectOutStockoutByStockoutId(String stockoutId);
void manualAllot(HashMap<String, String> map);
}

View File

@@ -71,4 +71,6 @@ public interface IOutStockoutService
AjaxResult autoAllot(String stockoutId);
List<OutStockout> selectOutStockoutListApi(OutStockout outStockoutParam);
AjaxResult manualAllot(String[] stockList,String stockoutDetailId);
}

View File

@@ -197,4 +197,23 @@ public class OutStockoutServiceImpl implements IOutStockoutService
public List<OutStockout> selectOutStockoutListApi(OutStockout outStockout) {
return outStockoutMapper.selectOutStockoutList(outStockout);
}
@Override
public AjaxResult manualAllot(String[] stockList, String stockoutDetailId) {
HashMap<String, String> map = new HashMap<>();
StringBuilder stringBuilder = new StringBuilder();
for (String stock : stockList) {
map.put("v_stockout_detail_id", stockoutDetailId);
map.put("v_stock_id", stock);
outStockoutMapper.manualAllot(map);
toWcsService.pushOutMydoJob();
if (!"10".equals(map.get("v_result"))){
stringBuilder.append(",").append(map.get("v_resultString"));
}
}
if (!StrUtil.isEmpty(stringBuilder.toString())){
return AjaxResult.warn(stringBuilder.toString());
}
return AjaxResult.success();
}
}

View File

@@ -159,6 +159,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
}
</select>
<select id="manualAllot" parameterType="java.util.Map" statementType="CALLABLE">
{
call proc_out_hand_allocation(
#{v_stockout_detail_id,mode=IN,jdbcType=VARCHAR},
#{v_stock_id,mode=IN,jdbcType=VARCHAR},
#{v_result,mode=OUT,jdbcType=VARCHAR},
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
)
}
</select>
<select id="selectOutStockoutByStockoutId" resultMap="OutStockoutResult">
select distinct o.stockout_guid,
o.stockout_id,

View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.out.handAllotStock.mapper.ViewHandAllotStockMapper">
<resultMap type="ViewHandAllotStock" id="ViewHandAllotStockResult">
<result property="stockId" column="stock_id" />
<result property="cargoSpaceId" column="cargo_space_id" />
<result property="stockStatus" column="stock_status" />
<result property="productStatus" column="product_status" />
<result property="lotNo" column="lot_no" />
<result property="inDate" column="in_date" />
<result property="backDate" column="back_date" />
<result property="productGuid" column="product_guid" />
<result property="quantity" column="quantity" />
<result property="jobId" column="job_id" />
<result property="trayCode" column="tray_code" />
<result property="outQuantity" column="out_quantity" />
<result property="stockinDetailId" column="stockin_detail_id" />
<result property="stockinId" column="stockin_id" />
<result property="inType" column="in_type" />
<result property="inClassId" column="in_class_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="stackingId" column="stacking_id" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare3" column="spare3" />
<result property="spare4" column="spare4" />
<result property="spare5" column="spare5" />
<result property="spare6" column="spare6" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="voltage" column="voltage" />
<result property="power" column="power" />
<result property="phase" column="phase" />
<result property="netWeight" column="net_weight" />
<result property="grossWeight" column="gross_weight" />
<result property="distribution" column="distribution" />
<result property="model" column="model" />
<result property="orderId" column="order_id" />
<result property="spare7" column="spare7" />
<result property="spare8" column="spare8" />
<result property="cargoSpaceName" column="cargo_space_name" />
</resultMap>
<sql id="selectViewHandAllotStockVo">
select stock_id, cargo_space_id, stock_status, product_status, lot_no, in_date, back_date, product_guid, quantity, job_id, tray_code, out_quantity, stockin_detail_id, stockin_id, in_type, in_class_id, warehouse_id, stacking_id, spare1, spare2, spare3, spare4, spare5, spare6, product_id, product_name, voltage, power, phase, net_weight, gross_weight, distribution, model, order_id, spare7, spare8, cargo_space_name from view_hand_allot_stock
</sql>
<select id="selectViewHandAllotStockList" parameterType="ViewHandAllotStock" resultMap="ViewHandAllotStockResult">
<include refid="selectViewHandAllotStockVo"/>
<where>
<if test="stockId != null and stockId != ''"> and stock_id = #{stockId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="stockStatus != null and stockStatus != ''"> and stock_status = #{stockStatus}</if>
<if test="productStatus != null and productStatus != ''"> and product_status = #{productStatus}</if>
<if test="lotNo != null and lotNo != ''"> and lot_no = #{lotNo}</if>
<if test="inDate != null and inDate != ''"> and in_date = #{inDate}</if>
<if test="backDate != null and backDate != ''"> and back_date = #{backDate}</if>
<if test="productGuid != null and productGuid != ''"> and product_guid = #{productGuid}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
<if test="outQuantity != null and outQuantity != ''"> and out_quantity = #{outQuantity}</if>
<if test="stockinDetailId != null and stockinDetailId != ''"> and stockin_detail_id = #{stockinDetailId}</if>
<if test="stockinId != null and stockinId != ''"> and stockin_id = #{stockinId}</if>
<if test="inType != null and inType != ''"> and in_type = #{inType}</if>
<if test="inClassId != null and inClassId != ''"> and in_class_id = #{inClassId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="stackingId != null and stackingId != ''"> and stacking_id = #{stackingId}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
<if test="spare4 != null and spare4 != ''"> and spare4 = #{spare4}</if>
<if test="spare5 != null and spare5 != ''"> and spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''"> and spare6 = #{spare6}</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="voltage != null and voltage != ''"> and voltage = #{voltage}</if>
<if test="power != null and power != ''"> and power = #{power}</if>
<if test="phase != null and phase != ''"> and phase = #{phase}</if>
<if test="netWeight != null "> and net_weight = #{netWeight}</if>
<if test="grossWeight != null "> and gross_weight = #{grossWeight}</if>
<if test="distribution != null and distribution != ''"> and distribution = #{distribution}</if>
<if test="model != null and model != ''"> and model = #{model}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="spare7 != null and spare7 != ''"> and spare7 = #{spare7}</if>
<if test="spare8 != null and spare8 != ''"> and spare8 = #{spare8}</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and cargo_space_name like concat('%', #{cargoSpaceName}, '%')</if>
</where>
</select>
<select id="selectViewHandAllotStockByStockId" parameterType="String" resultMap="ViewHandAllotStockResult">
<include refid="selectViewHandAllotStockVo"/>
where stock_id = #{stockId}
</select>
<insert id="insertViewHandAllotStock" parameterType="ViewHandAllotStock">
insert into view_hand_allot_stock
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockId != null and stockId != ''">stock_id,</if>
<if test="cargoSpaceId != null">cargo_space_id,</if>
<if test="stockStatus != null">stock_status,</if>
<if test="productStatus != null">product_status,</if>
<if test="lotNo != null">lot_no,</if>
<if test="inDate != null">in_date,</if>
<if test="backDate != null">back_date,</if>
<if test="productGuid != null">product_guid,</if>
<if test="quantity != null">quantity,</if>
<if test="jobId != null">job_id,</if>
<if test="trayCode != null">tray_code,</if>
<if test="outQuantity != null">out_quantity,</if>
<if test="stockinDetailId != null">stockin_detail_id,</if>
<if test="stockinId != null">stockin_id,</if>
<if test="inType != null">in_type,</if>
<if test="inClassId != null">in_class_id,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="stackingId != null">stacking_id,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="spare5 != null">spare5,</if>
<if test="spare6 != null">spare6,</if>
<if test="productId != null">product_id,</if>
<if test="productName != null">product_name,</if>
<if test="voltage != null">voltage,</if>
<if test="power != null">power,</if>
<if test="phase != null">phase,</if>
<if test="netWeight != null">net_weight,</if>
<if test="grossWeight != null">gross_weight,</if>
<if test="distribution != null">distribution,</if>
<if test="model != null">model,</if>
<if test="orderId != null">order_id,</if>
<if test="spare7 != null">spare7,</if>
<if test="spare8 != null">spare8,</if>
<if test="cargoSpaceName != null">cargo_space_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockId != null and stockId != ''">#{stockId},</if>
<if test="cargoSpaceId != null">#{cargoSpaceId},</if>
<if test="stockStatus != null">#{stockStatus},</if>
<if test="productStatus != null">#{productStatus},</if>
<if test="lotNo != null">#{lotNo},</if>
<if test="inDate != null">#{inDate},</if>
<if test="backDate != null">#{backDate},</if>
<if test="productGuid != null">#{productGuid},</if>
<if test="quantity != null">#{quantity},</if>
<if test="jobId != null">#{jobId},</if>
<if test="trayCode != null">#{trayCode},</if>
<if test="outQuantity != null">#{outQuantity},</if>
<if test="stockinDetailId != null">#{stockinDetailId},</if>
<if test="stockinId != null">#{stockinId},</if>
<if test="inType != null">#{inType},</if>
<if test="inClassId != null">#{inClassId},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="stackingId != null">#{stackingId},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="spare5 != null">#{spare5},</if>
<if test="spare6 != null">#{spare6},</if>
<if test="productId != null">#{productId},</if>
<if test="productName != null">#{productName},</if>
<if test="voltage != null">#{voltage},</if>
<if test="power != null">#{power},</if>
<if test="phase != null">#{phase},</if>
<if test="netWeight != null">#{netWeight},</if>
<if test="grossWeight != null">#{grossWeight},</if>
<if test="distribution != null">#{distribution},</if>
<if test="model != null">#{model},</if>
<if test="orderId != null">#{orderId},</if>
<if test="spare7 != null">#{spare7},</if>
<if test="spare8 != null">#{spare8},</if>
<if test="cargoSpaceName != null">#{cargoSpaceName},</if>
</trim>
</insert>
<update id="updateViewHandAllotStock" parameterType="ViewHandAllotStock">
update view_hand_allot_stock
<trim prefix="SET" suffixOverrides=",">
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
<if test="stockStatus != null">stock_status = #{stockStatus},</if>
<if test="productStatus != null">product_status = #{productStatus},</if>
<if test="lotNo != null">lot_no = #{lotNo},</if>
<if test="inDate != null">in_date = #{inDate},</if>
<if test="backDate != null">back_date = #{backDate},</if>
<if test="productGuid != null">product_guid = #{productGuid},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="jobId != null">job_id = #{jobId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="outQuantity != null">out_quantity = #{outQuantity},</if>
<if test="stockinDetailId != null">stockin_detail_id = #{stockinDetailId},</if>
<if test="stockinId != null">stockin_id = #{stockinId},</if>
<if test="inType != null">in_type = #{inType},</if>
<if test="inClassId != null">in_class_id = #{inClassId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="stackingId != null">stacking_id = #{stackingId},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
<if test="spare6 != null">spare6 = #{spare6},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="voltage != null">voltage = #{voltage},</if>
<if test="power != null">power = #{power},</if>
<if test="phase != null">phase = #{phase},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="grossWeight != null">gross_weight = #{grossWeight},</if>
<if test="distribution != null">distribution = #{distribution},</if>
<if test="model != null">model = #{model},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="spare7 != null">spare7 = #{spare7},</if>
<if test="spare8 != null">spare8 = #{spare8},</if>
<if test="cargoSpaceName != null">cargo_space_name = #{cargoSpaceName},</if>
</trim>
where stock_id = #{stockId}
</update>
<delete id="deleteViewHandAllotStockByStockId" parameterType="String">
delete from view_hand_allot_stock where stock_id = #{stockId}
</delete>
<delete id="deleteViewHandAllotStockByStockIds" parameterType="String">
delete from view_hand_allot_stock where stock_id in
<foreach item="stockId" collection="array" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
</mapper>

View File

@@ -67,5 +67,31 @@ export function getOutStockoutDetail(query) {
})
}
// 查询手动分配库存列表
export function listOut(query) {
return request({
url: '/out/handAllotStock/list',
method: 'get',
params: query
})
}
export function manualAllot(params)
{
const searchParams = new URLSearchParams();
if (Array.isArray(params.stockList)) {
params.stockList.forEach(stock => searchParams.append('stockList', stock.stockId));
}
if (params.stockoutDetailId) {
searchParams.append('stockoutDetailId', params.stockoutDetailId);
}
return request({
url: '/out/outStockout/manualAllot?' + searchParams.toString(),
method: 'get'
})
}

View File

@@ -21,25 +21,25 @@
/>
</el-form-item>
<el-form-item label="托盘条码" prop="trayCode"> <!-- 托盘条码 -->
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘条码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="托盘条码" prop="trayCode"> &lt;!&ndash; 托盘条码 &ndash;&gt;-->
<!-- <el-input-->
<!-- v-model="queryParams.trayCode"-->
<!-- placeholder="请输入托盘条码"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="作业类型" prop="inOrOut"> <!-- 作业类型 -->
<el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>
<el-option
v-for="dict in dict.type.out_job_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="作业类型" prop="inOrOut"> &lt;!&ndash; 作业类型 &ndash;&gt;-->
<!-- <el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.out_job_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="开始时间" prop="startTime"> <!-- 开始时间 -->
<el-date-picker clearable
@@ -59,20 +59,20 @@
</el-date-picker>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId"> <!-- 仓库 -->
<el-select
v-model="queryParams.warehouseId"
placeholder="请选择仓库"
clearable
>
<el-option
v-for="dict in warehouseOptions"
:key="dict.warehouseId"
:label="dict.warehouseName"
:value="dict.warehouseId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="仓库" prop="warehouseId"> &lt;!&ndash; 仓库 &ndash;&gt;-->
<!-- <el-select-->
<!-- v-model="queryParams.warehouseId"-->
<!-- placeholder="请选择仓库"-->
<!-- clearable-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="dict in warehouseOptions"-->
<!-- :key="dict.warehouseId"-->
<!-- :label="dict.warehouseName"-->
<!-- :value="dict.warehouseId"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <!-- 搜索 -->
@@ -124,19 +124,22 @@
</el-table-column>
<el-table-column label="任务号" align="left" prop="taskNo" /> <!-- 任务号 -->
<!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;-->
<el-table-column label="托盘码" align="left" prop="trayCode" /> <!-- 托盘码 -->
<!-- <el-table-column label="托盘码" align="left" prop="trayCode" /> &lt;!&ndash; 托盘码 &ndash;&gt;-->
<!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;-->
<el-table-column label="货位ID" align="left" prop="cargoSpaceName" /> <!-- 货位ID -->
<el-table-column label="优先级" align="right" prop="priority" /> <!-- 优先级 -->
<el-table-column label="执行阶段" align="left" prop="executionPhase"> <!-- 执行阶段 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>
<el-table-column label="货位" align="left" prop="cargoSpaceName" /> <!-- 货位ID -->
<el-table-column label="订单号" align="left" prop="lineId" /> <!-- 结束时间 -->
<!-- <el-table-column label="优先级" align="left" prop="priority" /> &lt;!&ndash; 优先级 &ndash;&gt;-->
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> &lt;!&ndash; 执行阶段 &ndash;&gt;-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="出口ID" align="left" prop="exitId"/> <!-- 出口ID -->
<el-table-column label="创建时间" align="left" prop="createTime" width="180"/> <!-- 创建时间 -->
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/> <!-- 开始时间 -->
<el-table-column label="结束时间" align="left" prop="finishTime" width="180"/> <!-- 结束时间 -->
<el-table-column label="出口ID" align="left" prop="exitId" /> <!-- 出口ID -->
<!-- <el-table-column :label="$t('outJobManagement.warehouseId')" align="left" prop="warehouseId" /> &lt;!&ndash; 仓库ID &ndash;&gt;-->
<el-table-column label="仓库ID" align="left" prop="warehouseName" /> <!-- 仓库ID -->
</el-table>
@@ -154,9 +157,21 @@
<el-table-column label="子任务ID" align="left" prop="jobDetailId" /> <!-- 子任务ID -->
<el-table-column label="库存ID" align="left" prop="stockId" /> <!-- 库存ID -->
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" /> <!-- 子单据ID -->
<el-table-column label="物料编码" align="left" prop="productId" /> <!-- 物料编码 -->
<el-table-column label="物料编码" align="left" prop="extraField.materialDesc" /> <!-- 物料编码 -->
<el-table-column label="物料编码" align="left" prop="productId" />
<el-table-column label="物料名称" align="left" prop="productName" />
<el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 -->
<el-table-column label="批次号" align="left" prop="lotNo" />
<el-table-column label="机型" align="left" prop="unit"/><!--机型-->
<el-table-column label="分销" align="left" prop="spare9"/><!--分销-->
<el-table-column label="规格" align="left" prop="spec"/><!--规格-->
<el-table-column label="型号" align="left" prop="spare1"/><!--型号-->
<el-table-column label="净重" align="left" prop="spare2"/><!--净重-->
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色-->
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号-->
<el-table-column label="电压" align="left" prop="spare5"/><!--电压-->
<el-table-column label="功率" align="left" prop="spare6"/><!--功率-->
<el-table-column label="相位" align="left" prop="spare7"/><!--相位-->
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重-->
</el-table>
<pagination

View File

@@ -165,7 +165,8 @@
/>
<!-- 子表数据 -->
<el-table v-loading="detailLoading" :data="outStockDetailList.slice((detailQueryParams.pageNum-1)*detailQueryParams.pageSize, detailQueryParams.pageNum*detailQueryParams.pageSize)" style="margin-top: 20px;">
<el-table v-loading="detailLoading" :data="outStockDetailList" style="margin-top: 20px;" @selection-change="handleDetailSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="'出库子单编号'" align="center" prop="stockoutDetailId" /> <!-- 出库子单编号 -->
<el-table-column :label="'品号'" align="center" prop="productId" /> <!-- 物资编码 -->
<el-table-column :label="'品名'" align="center" prop="productName" />
@@ -173,8 +174,8 @@
<el-table-column :label="'序列号'" align="center" prop="printDate" /> <!--序列号-->
<el-table-column label="订单号" align="center" prop="orderId" />
<el-table-column :label="'计划数量'" align="center" prop="quantity" /> <!-- 计划数量 -->
<el-table-column :label="'实际数量'" align="center" prop="assignNum" /> <!-- 实际数量 -->
<el-table-column :label="'分配数量'" align="center" prop="allotQuantity" /> <!-- 分配数量 -->
<el-table-column :label="'实际数量'" align="center" prop="assignNum" /> <!-- 实际数量 -->
<el-table-column :label="'颜色'" align="center" prop="price"/><!--箱号-->
<el-table-column :label="'单位'" align="center" prop="unit"/><!--单位-->
<el-table-column :label="'规格'" align="center" prop="spec" /> <!--规格-->
@@ -186,17 +187,16 @@
<el-table-column label="毛重" align="center" prop="grossWeight" />
<el-table-column label="分销" align="center" prop="distribution" />
<el-table-column label="机型" align="center" prop="model" />
->
<el-table-column :label="'备注'" align="center" prop="remark" /> <!-- 备注 -->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="detailQueryParams.pageNum"
:limit.sync="detailQueryParams.pageSize"
@pagination="getDetailList"
/>
<!-- <pagination-->
<!-- v-show="detailTotal>0"-->
<!-- :total="detailTotal"-->
<!-- :page.sync="detailQueryParams.pageNum"-->
<!-- :limit.sync="detailQueryParams.pageSize"-->
<!-- @pagination="getDetailList"-->
<!-- />-->
<!-- 审核弹窗 -->
<el-dialog :title="'审核'" :visible.sync="auditDialogVisible" width="400px" append-to-body>
@@ -213,15 +213,105 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAudit">{{'确认'}}</el-button>
<el-button @click="cancelAudit">{{'取消'}}</el-button>
<el-button type="primary" @click="submitAudit">{{"确认"}}</el-button>
<el-button @click="cancelAudit">{{"取消"}}</el-button>
</div>
</el-dialog>
<!-- 手动分配库存明细弹窗 -->
<el-dialog title="库存明细" :visible.sync="stockDialogVisible" width="90%" append-to-body>
<!-- 数量统计信息 -->
<el-row style="margin-bottom: 15px; padding: 10px; background-color: #f5f7fa; border-radius: 4px;">
<el-col :span="8">
<span style="font-weight: bold;">计划数量: </span>
<span style="color: #409EFF; font-size: 16px;">{{ selectedDetailRows.length > 0 ? selectedDetailRows[0].quantity : 0 }}</span>
</el-col>
<el-col :span="8">
<span style="font-weight: bold;">已选库存数量: </span>
<span style="color: #67C23A; font-size: 16px;">{{ selectedStockQuantity }}</span>
</el-col>
<el-col :span="8">
<span style="font-weight: bold;">剩余可分配: </span>
<span :style="{ color: remainingQuantity >= 0 ? '#67C23A' : '#F56C6C', fontSize: '16px' }">{{ remainingQuantity }}</span>
</el-col>
</el-row>
<!-- 查询表单 -->
<el-form :model="stockQueryParams" ref="stockQueryForm" size="small" :inline="true" label-width="80px">
<el-form-item label="库存编码" prop="stockId">
<el-input
v-model="stockQueryParams.stockId"
placeholder="请输入库存编码"
clearable
@keyup.enter.native="handleStockQuery"
/>
</el-form-item>
<el-form-item label="货位编码" prop="cargoSpaceName">
<el-input
v-model="stockQueryParams.cargoSpaceName"
placeholder="请输入货位名称"
clearable
@keyup.enter.native="handleStockQuery"
/>
</el-form-item>
<el-form-item label="批次号" prop="lotNo">
<el-input
v-model="stockQueryParams.lotNo"
placeholder="请输入批次号"
clearable
@keyup.enter.native="handleStockQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleStockQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetStockQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 库存明细表格 -->
<el-table ref="stockTable" v-loading="stockLoading" :data="stockList" @selection-change="handleStockSelectionChange" max-height="400">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="库存编码" align="center" prop="stockId" />
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" />
<el-table-column label="批次号" align="center" prop="lotNo" />
<el-table-column label="品号" align="center" prop="productId" />
<el-table-column label="品名" align="center" prop="productName" />
<el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="规格" align="center" prop="spare1" />
<el-table-column label="单位" align="center" prop="spare3" />
<el-table-column label="型号" align="center" prop="spare4" />
<el-table-column label="颜色" align="center" prop="spare5" />
<el-table-column label="序列号" align="center" prop="spare6" />
<el-table-column label="电压" align="center" prop="voltage" />
<el-table-column label="功率" align="center" prop="power" />
<el-table-column label="相位" align="center" prop="phase" />
<el-table-column label="净重" align="center" prop="netWeight" />
<el-table-column label="毛重" align="center" prop="grossWeight" />
<el-table-column label="分销" align="center" prop="distribution" />
<el-table-column label="机型" align="center" prop="model" />
<el-table-column label="订单号" align="center" prop="orderId" />
</el-table>
<pagination
v-show="stockTotal>0"
:total="stockTotal"
:page.sync="stockQueryParams.pageNum"
:limit.sync="stockQueryParams.pageSize"
@pagination="getStockList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmStockAllot">确认分配</el-button>
<el-button @click="cancelStockAllot">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listOutStockout,autoAllot } from "@/api/out/outStockout"
import { listOutStockout,autoAllot,listOut,manualAllot} from "@/api/out/outStockout"
import { getOutStockoutDetail,updateOutStockStatus } from "@/api/out/outStockout"
import {listWarehouse} from "@/api/bas/warehouse";
@@ -244,12 +334,24 @@ export default {
outStockDetailList: [],
// 选中数据
selectedRows: [],
// 选中的子表数据
selectedDetailRows: [],
// 审核弹窗显示状态
auditDialogVisible: false,
// 审核表单数据
auditForm: {
exitId: null
},
// 库存明细弹窗显示状态
stockDialogVisible: false,
// 库存明细数据
stockList: [],
// 库存明细加载状态
stockLoading: false,
// 库存明细总条数
stockTotal: 0,
// 选中的库存数据
selectedStockRows: [],
// 审核表单验证规则
auditRules: {
exitId: [
@@ -258,8 +360,8 @@ export default {
},
// 出口选项
exitOptions: [
{ exitId: 'G1001', exitName: 'G1001'},
{ exitId: 'G1002', exitName: 'G1002'},
{ exitId: '1', exitName: '一楼'},
{ exitId: '2', exitName: '二楼'},
],
@@ -283,7 +385,7 @@ export default {
// 子表分页参数
detailQueryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 99,
status:null,
stockoutGuid:null
@@ -294,7 +396,31 @@ export default {
},
// 子表总条数
detailTotal: 0
detailTotal: 0,
// 库存查询参数
stockQueryParams: {
pageNum: 1,
pageSize: 10,
stockId: null,
cargoSpaceId: null,
lotNo: null,
productId: null,
productName: null
}
}
},
computed: {
// 计算选中库存的总数量
selectedStockQuantity() {
return this.selectedStockRows.reduce((total, stock) => {
console.log(total+ + (parseFloat(stock.quantity)))
return total + (parseFloat(stock.quantity) || 0)
}, 0)
},
// 计算剩余可分配数量
remainingQuantity() {
const planQuantity = this.selectedDetailRows.length > 0 ? (parseFloat(this.selectedDetailRows[0].quantity) || 0) : 0
return planQuantity - this.selectedStockQuantity
}
},
created() {
@@ -371,6 +497,10 @@ export default {
handleSelectionChange(selection) {
this.selectedRows = selection
},
/** 子表多选框选中数据 */
handleDetailSelectionChange(selection) {
this.selectedDetailRows = selection
},
/** 单据状态修改按钮操作 */
handleAudit(status) {
if (this.selectedRows.length === 0) {
@@ -449,16 +579,41 @@ export default {
},
/** 手动分配按钮操作 */
handleManualAllot() {
if (this.selectedDetailRows.length === 0) {
this.$modal.msgError('请选择子表数据')
return
}
if (this.selectedDetailRows.length > 1) {
this.$modal.msgError('只能选择一条子表数据进行手动分配')
return
}
// 检查主表状态
if(this.selectedRows.length >1){
this.$modal.msgError('只能选择一条主表数据进行手动分配')
return
}
if (this.selectedRows.length === 0) {
this.$modal.msgError(this.$t('outStockoutManage.pleaseSelectData'))
this.$modal.msgError('请先选择主表数据')
return
}
const stockoutIds = this.selectedRows.map(row => row.stockoutId)
let outstock = this.selectedRows[0]
if (outstock.status !== "1") {
this.$modal.msgError('单据已审核,无法手动分配')
if (outstock.status == "1") {
this.$modal.msgError('单据未审核,无法手动分配!')
return
}
if (outstock.status != "2" && outstock.status != "3") {
this.$modal.msgError('单据已结束,无法手动分配!')
return
}
if(this.selectedDetailRows[0].allotQuantity==this.selectedDetailRows[0].quantity){
this.$modal.msgError('该单据已分配完成,无法手动分配')
return
}
// 显示库存明细弹窗
this.stockDialogVisible = true
this.resetStockQuery()
this.getStockList()
},
/** 提交审核 */
@@ -490,6 +645,121 @@ export default {
this.currentAuditStatus = null
},
/** 获取库存明细列表 */
getStockList() {
this.stockLoading = true
this.stockQueryParams.productId = this.selectedDetailRows[0].productId
listOut(this.stockQueryParams).then(response => {
this.stockList = response.rows
this.stockTotal = response.total
this.stockLoading = false
}).catch(() => {
this.stockLoading = false
})
},
/** 库存查询按钮操作 */
handleStockQuery() {
this.stockQueryParams.pageNum = 1
this.getStockList()
},
/** 库存重置按钮操作 */
resetStockQuery() {
this.stockQueryParams = {
pageNum: 1,
pageSize: 10,
stockId: null,
cargoSpaceName: null,
lotNo: null,
productId: null,
productName: null
}
this.$refs.stockQueryForm && this.$refs.stockQueryForm.resetFields()
},
/** 库存多选框选中数据 */
handleStockSelectionChange(selection) {
// 计算新选中的总数量
const newTotalQuantity = selection.reduce((total, stock) => {
return total + (parseFloat(stock.quantity) || 0)
}, 0)
// 获取计划数量
const planQuantity = this.selectedDetailRows.length > 0 ? (parseFloat(this.selectedDetailRows[0].quantity) || 0) : 0
// 校验是否超过计划数量
if (newTotalQuantity > planQuantity) {
this.$modal.msgWarning(`选中库存数量(${newTotalQuantity})不能大于计划数量(${planQuantity})`)
// // 恢复到之前的选择状态
// this.$nextTick(() => {
// // 通过表格引用来恢复选择状态
// if (this.$refs.stockTable) {
// this.$refs.stockTable.clearSelection()
// this.selectedStockRows.forEach(row => {
// this.$refs.stockTable.toggleRowSelection(row, true)
// })
// }
// })
// return
}
this.selectedStockRows = selection
},
/** 确认分配 */
confirmStockAllot() {
if (this.selectedStockRows.length === 0) {
this.$modal.msgError('请选择要分配的库存')
return
}
if (this.selectedDetailRows.length === 0) {
this.$modal.msgError('请选择要分配的子表数据')
return
}
// 最终数量校验
const planQuantity = parseFloat(this.selectedDetailRows[0].quantity) || 0
if (this.selectedStockQuantity > planQuantity) {
this.$modal.msgError(`选中库存数量(${this.selectedStockQuantity})不能大于计划数量(${planQuantity})`)
return
}
// 构建分配参数
const allotParams = {
stockoutDetailId: this.selectedDetailRows[0].stockoutDetailId,
stockList: this.selectedStockRows.map(stock => ({
stockId: stock.stockId
}))
}
console.log('手动分配参数:', allotParams)
// 这里添加实际的分配API调用
manualAllot(allotParams).then(response => {
if(response.code=="200"){
this.$modal.msgSuccess('分配成功')
this.stockDialogVisible = false
this.getList()
this.getDetailList(this.selectedRows[0].stockoutGuid, this.selectedRows[0].status)
}else{
this.$modal.msgError(response.msg)
}
})
},
/** 取消分配 */
cancelStockAllot() {
this.stockDialogVisible = false
this.selectedStockRows = []
// this.selectedDetailRows = []
}
}
}