MES:
1、一楼工位申请领料根据采购订单绑定销售订单逻辑修改
2、五楼拆分工位申请领柜体和五楼装配工位申请领料根据采购订单绑定销售订单逻辑修改
master
xins 6 months ago
parent 63b54ecbb3
commit a7ea6ce762

@ -64,7 +64,7 @@ public class WmsApiController extends BaseController {
// String ancestors = mesMaterialBom.getAncestors(); // String ancestors = mesMaterialBom.getAncestors();
// ancestors = "0," + ancestors; // ancestors = "0," + ancestors;
// mesMaterialBom.setAncestors(ancestors); // mesMaterialBom.setAncestors(ancestors);
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalJoinList(queryStockTotal); List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalJoinListBySaleOrder(queryStockTotal);
return success(list); return success(list);
} }

@ -94,7 +94,7 @@ public class WmsMobileController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("wms:mobile:addrawinstock") // @RequiresPermissions("wms:mobile:addrawinstock")
@Log(title = "原材料入库记录", businessType = BusinessType.INSERT) @Log(title = "原材料入库记录", businessType = BusinessType.INSERT)
@PostMapping(("/addRawInstock")) @PostMapping(("/addRawInstock"))
public AjaxResult addRawInstock(@Validated @RequestBody WmsRawInstockVo wmsRawInstockVo) { public AjaxResult addRawInstock(@Validated @RequestBody WmsRawInstockVo wmsRawInstockVo) {

@ -206,6 +206,8 @@ public class WmsRawOutstock extends BaseEntity {
private String materialBarcode; private String materialBarcode;
private Long saleOrderId;
/** /**
* *
*/ */
@ -515,6 +517,14 @@ public class WmsRawOutstock extends BaseEntity {
this.materialBarcode = materialBarcode; this.materialBarcode = materialBarcode;
} }
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -158,6 +158,11 @@ public class WmsRawOutstockDetail extends BaseEntity {
private String auditStatus; private String auditStatus;
private String palletInfoCode; private String palletInfoCode;
/**仓库总库存信息ID*/
private Long stockTotalId;
public void setRawOutstockDetailId(Long rawOutstockDetailId) { public void setRawOutstockDetailId(Long rawOutstockDetailId) {
this.rawOutstockDetailId = rawOutstockDetailId; this.rawOutstockDetailId = rawOutstockDetailId;
} }
@ -390,6 +395,14 @@ public class WmsRawOutstockDetail extends BaseEntity {
this.palletInfoCode = palletInfoCode; this.palletInfoCode = palletInfoCode;
} }
public Long getStockTotalId() {
return stockTotalId;
}
public void setStockTotalId(Long stockTotalId) {
this.stockTotalId = stockTotalId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -414,6 +427,7 @@ public class WmsRawOutstockDetail extends BaseEntity {
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate()) .append("updateDate", getUpdateDate())
.append("stackAmount", getStackAmount()) .append("stackAmount", getStackAmount())
.append("stockTotalId", getStockTotalId())
.toString(); .toString();
} }
} }

@ -41,6 +41,11 @@ public class WmsStockTotal extends BaseEntity
@Excel(name = "物料ID") @Excel(name = "物料ID")
private Long materialId; private Long materialId;
private Long saleOrderId;
private String safeFlag;
/** 物料编号 */ /** 物料编号 */
@Excel(name = "物料编号") @Excel(name = "物料编号")
private String materialCode; private String materialCode;
@ -129,6 +134,23 @@ public class WmsStockTotal extends BaseEntity
{ {
return materialId; return materialId;
} }
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public void setTotalAmount(BigDecimal totalAmount) public void setTotalAmount(BigDecimal totalAmount)
{ {
this.totalAmount = totalAmount; this.totalAmount = totalAmount;

@ -65,11 +65,11 @@ public interface WmsStockTotalMapper
/** /**
* * ()
* *
* @param wmsStockTotal * @param wmsStockTotal
* @return * @return
*/ */
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal); public List<WmsStockTotal> selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal);
} }

@ -66,5 +66,5 @@ public interface IWmsStockTotalService
* @param wmsStockTotal * @param wmsStockTotal
* @return * @return
*/ */
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal); public List<WmsStockTotal> selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal);
} }

@ -52,6 +52,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
@Autowired @Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper; private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsStockTotalMapper wmsStockTotalMapper;
@Autowired @Autowired
private WmsConfig wmsConfig; private WmsConfig wmsConfig;
@ -467,6 +470,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
* *
* *
* wms_raw_outstock_detail * wms_raw_outstock_detail
*
* @param wmsRawOutstock * @param wmsRawOutstock
* @return * @return
*/ */
@ -476,8 +480,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String planCode = wmsRawOutstock.getPlanCode(); String planCode = wmsRawOutstock.getPlanCode();
String planDetailCode = wmsRawOutstock.getPlanDetailCode(); String planDetailCode = wmsRawOutstock.getPlanDetailCode();
if (StringUtils.isEmpty(planCode)) { if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) {
throw new ServiceException("请选择生产详细信息再领料"); throw new ServiceException("请选择计划明细信息再领料");
} }
Long warehouseId = wmsRawOutstock.getWarehouseId(); Long warehouseId = wmsRawOutstock.getWarehouseId();
@ -501,87 +505,40 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String taskCode = Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode); String taskCode = Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode);
//传入的申请领料list遍历 //传入的申请领料list遍历
rawOutstockDetails.forEach(rawOutstockDetail -> { rawOutstockDetails.forEach(rawOutstockDetail -> {
Long stockTotalId = rawOutstockDetail.getStockTotalId();
WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId);
BigDecimal totalAmount = wmsStockTotal.getTotalAmount();
BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount();
BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount);
BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ? BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ?
BigDecimal.ZERO : rawOutstockDetail.getPlanAmount();//申请数量 BigDecimal.ZERO : rawOutstockDetail.getPlanAmount();//申请数量
Long materialId = rawOutstockDetail.getMaterialId();
if (planAmount.compareTo(BigDecimal.ZERO) > 0) { if (planAmount.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal realRawStock = BigDecimal.ZERO;//实际库存总量 //可出库数量大于0
WmsRawStock queryRawStock = new WmsRawStock(); if (planAmount.compareTo(availableAmount) <= 0) {
queryRawStock.setWarehouseId(warehouseId); //占用数量更改
queryRawStock.setMaterialId(materialId); wmsStockTotal.setOccupyAmount(occupyAmount.add(availableAmount));
queryRawStock.setCompleteFlag(WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAY_YES); wmsStockTotal.setUpdateDate(currentDate);
// queryRawStock.setQualityStatus(queryQualityStatus);//todo先不过滤质检状态 wmsStockTotal.setUpdateBy(userName);
//TODO:需要先查看wms_raw_stock_occupy是否有此生产订单的占用明细,有的话需要计算并且更新 wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal);
//判断库位和可用数量(总数量减冻结数量和占用数量),按先进先出(按入库时间排序获取)
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStocks4Apply(queryRawStock); WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(baseWarehouse, planCode, planDetailCode,
if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) { rawOutstockDetail.getMaterialId(), taskCode, taskType, wmsRawOutstock.getApplyReason(),
for (WmsRawStock wmsRawStock : wmsRawStocks) { planAmount, currentDate, userName);
BigDecimal totalAmount = wmsRawStock.getTotalAmount(); toInsertedRawOutstocks.add(toInsertedRawOutstock);
BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); } else {
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); throw new ServiceException("物料[" + rawOutstockDetail.getMaterialName() + "]库存不够,申请数量不能大于" + availableAmount);
realRawStock = realRawStock.add(availableAmount);
//可出库数量大于0
if (availableAmount.compareTo(BigDecimal.ZERO) > 0) {
//如果申请数量大于此库位可出库的数量则继续进行下一库位判断
if (planAmount.compareTo(availableAmount) > 0) {
//占用数量更改
wmsRawStock.setOccupyAmount(occupyAmount.add(availableAmount));
wmsRawStock.setUpdateDate(currentDate);
wmsRawStock.setUpdateBy(userName);
//如果同一个物料有多条记录的处理(最好避免前端可以传多条同一个物料的申请),
//提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
//原材料出库记录(有break以下方法需要写在此处)
WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType,
planAmount, currentDate, userName);
toInsertedRawOutstocks.add(toInsertedRawOutstock);
planAmount = planAmount.subtract(availableAmount);
} else if (planAmount.compareTo(availableAmount) == 0) {//计划数量等于可出库数量
//占用数量更改
wmsRawStock.setOccupyAmount(occupyAmount.add(availableAmount));
wmsRawStock.setUpdateDate(currentDate);
wmsRawStock.setUpdateBy(userName);
//如果同一个物料有多条记录的处理,提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
//原材料出库记录(有break以下方法需要写在此处)
WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType,
planAmount, currentDate, userName);
toInsertedRawOutstocks.add(toInsertedRawOutstock);
planAmount = BigDecimal.ZERO;
break;
} else if (planAmount.compareTo(availableAmount) < 0) {
//占用数量更改
wmsRawStock.setOccupyAmount(occupyAmount.add(planAmount));
wmsRawStock.setUpdateDate(currentDate);
wmsRawStock.setUpdateBy(userName);
//如果同一个物料有多条记录的处理,提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
//原材料出库记录(有break以下方法需要写在此处)
WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType,
planAmount, currentDate, userName);
toInsertedRawOutstocks.add(toInsertedRawOutstock);
planAmount = BigDecimal.ZERO;
break;
}
}
}
} }
//以上将申请的数量跟库存数量比对如果库存数量足够则planAmount减去库存会=0,如果不够则剩余的planAmount会>0
if (planAmount.compareTo(BigDecimal.ZERO) > 0) {
throw new ServiceException("物料名称为[" + rawOutstockDetail.getMaterialName() + "]库存不足,只有" + realRawStock);
}
} }
}); });
wmsRawOutstockMapper.batchWmsRawOutstock(toInsertedRawOutstocks); if (!toInsertedRawOutstocks.isEmpty()) {
wmsRawOutstockMapper.batchWmsRawOutstock(toInsertedRawOutstocks);
}
return 1; return 1;
} }
@ -590,7 +547,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/** /**
* *
* *
* @param wmsRawStock
* @param baseWarehouse * @param baseWarehouse
* @param planCode * @param planCode
* @param planDetailCode * @param planDetailCode
@ -601,8 +557,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
* @param userName * @param userName
* @return * @return
*/ */
private WmsRawOutstock getWmsRawOutstock(WmsRawStock wmsRawStock, WmsBaseWarehouse baseWarehouse, private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse,
String planCode, String planDetailCode, Long materialId, String taskCode, String taskType, String planCode, String planDetailCode, Long materialId, String taskCode, String taskType,String applyReason,
BigDecimal planAmount, Date currentDate, String userName) { BigDecimal planAmount, Date currentDate, String userName) {
//出库要求 0申请出库1申请审核出库2直接出库 //出库要求 0申请出库1申请审核出库2直接出库
String outRequirement = baseWarehouse.getOutRequirement(); String outRequirement = baseWarehouse.getOutRequirement();
@ -624,19 +580,20 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
toInsertedRawOutstock.setTaskCode(taskCode); toInsertedRawOutstock.setTaskCode(taskCode);
toInsertedRawOutstock.setWarehouseId(wmsRawStock.getWarehouseId()); toInsertedRawOutstock.setWarehouseId(baseWarehouse.getWarehouseId());
toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode()); // toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode());
toInsertedRawOutstock.setStationId(SecurityUtils.getStationId()); toInsertedRawOutstock.setStationId(SecurityUtils.getStationId());
toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode()); // toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode());
toInsertedRawOutstock.setOperationType(operationType); toInsertedRawOutstock.setOperationType(operationType);
toInsertedRawOutstock.setApplyBy(userName); toInsertedRawOutstock.setApplyBy(userName);
toInsertedRawOutstock.setApplyReason(applyReason);
toInsertedRawOutstock.setApplyDate(currentDate); toInsertedRawOutstock.setApplyDate(currentDate);
toInsertedRawOutstock.setEndStationCode(SecurityUtils.getStationCode()); toInsertedRawOutstock.setEndStationCode(SecurityUtils.getStationCode());
toInsertedRawOutstock.setMaterialId(materialId); toInsertedRawOutstock.setMaterialId(materialId);
toInsertedRawOutstock.setOutstockAmount(planAmount); toInsertedRawOutstock.setOutstockAmount(planAmount);
toInsertedRawOutstock.setPlanCode(planCode); toInsertedRawOutstock.setPlanCode(planCode);
toInsertedRawOutstock.setPlanDetailCode(planDetailCode); toInsertedRawOutstock.setPlanDetailCode(planDetailCode);
toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch()); // toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());
toInsertedRawOutstock.setTaskType(taskType); toInsertedRawOutstock.setTaskType(taskType);
toInsertedRawOutstock.setCreateTime(currentDate); toInsertedRawOutstock.setCreateTime(currentDate);
toInsertedRawOutstock.setCreateBy(userName); toInsertedRawOutstock.setCreateBy(userName);
@ -833,7 +790,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
private WmsRawOutstock agvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId, private WmsRawOutstock agvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation
oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
String taskType, String userName, Date currentDate) { String taskType, String userName, Date currentDate) {
WmsRawOutstock rawOutstock = new WmsRawOutstock(); WmsRawOutstock rawOutstock = new WmsRawOutstock();
rawOutstock.setWarehouseId(oriBaseLocation.getWarehouseId()); rawOutstock.setWarehouseId(oriBaseLocation.getWarehouseId());
@ -863,7 +821,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
private WmsRawInstock agvRawInstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId, private WmsRawInstock agvRawInstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation
targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
String userName, Date currentDate) { String userName, Date currentDate) {
WmsRawInstock rawInstock = new WmsRawInstock(); WmsRawInstock rawInstock = new WmsRawInstock();
rawInstock.setWarehouseId(wmsAgvRawOutstockVo.getWarehouseId()); rawInstock.setWarehouseId(wmsAgvRawOutstockVo.getWarehouseId());

@ -98,16 +98,15 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService
/** /**
* ,Join material * (),Join material
* *
* @param wmsStockTotal * @param wmsStockTotal
* @return * @return
*/ */
@Override @Override
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal) public List<WmsStockTotal> selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal)
{ {
//todo:还需要计算锁库的数量 return wmsStockTotalMapper.selectWmsStockTotalJoinListBySaleOrder(wmsStockTotal);
return wmsStockTotalMapper.selectWmsStockTotalJoinList(wmsStockTotal);
} }
} }

@ -291,9 +291,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="batchWmsRawOutstock"> <insert id="batchWmsRawOutstock">
insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date) values insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}) ( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason})
</foreach> </foreach>
</insert> </insert>

@ -10,6 +10,8 @@
<result property="warehouseFloor" column="warehouse_floor"/> <result property="warehouseFloor" column="warehouse_floor"/>
<result property="stockType" column="stock_type"/> <result property="stockType" column="stock_type"/>
<result property="materialId" column="material_id"/> <result property="materialId" column="material_id"/>
<result property="saleOrderId" column="sale_order_id"/>
<result property="safeFlag" column="safe_flag"/>
<result property="totalAmount" column="total_amount"/> <result property="totalAmount" column="total_amount"/>
<result property="frozenAmount" column="frozen_amount"/> <result property="frozenAmount" column="frozen_amount"/>
<result property="occupyAmount" column="occupy_amount"/> <result property="occupyAmount" column="occupy_amount"/>
@ -52,6 +54,8 @@
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if> <if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if> <if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
<if test="materialId != null ">and wst.material_id = #{materialId}</if> <if test="materialId != null ">and wst.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wst.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wst.safe_flag = #{safeFlag}</if>
<if test="totalAmount != null ">and wst.total_amount = #{totalAmount}</if> <if test="totalAmount != null ">and wst.total_amount = #{totalAmount}</if>
<if test="frozenAmount != null ">and wst.frozen_amount = #{frozenAmount}</if> <if test="frozenAmount != null ">and wst.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wst.occupy_amount = #{occupyAmount}</if> <if test="occupyAmount != null ">and wst.occupy_amount = #{occupyAmount}</if>
@ -131,9 +135,9 @@
</delete> </delete>
<select id="selectWmsStockTotalJoinList" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult"> <select id="selectWmsStockTotalJoinListBySaleOrder" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
select wst.stock_total_id, wst.warehouse_id, wst.warehouse_floor, wst.stock_type, wst.material_id, select wst.stock_total_id, wst.warehouse_id, wst.warehouse_floor, wst.stock_type, wst.material_id,
wst.total_amount, wst.frozen_amount, wst.occupy_amount, wst.total_amount, wst.frozen_amount, wst.occupy_amount,wst.safe_flag,
mbmi.material_code,mbmi.material_name mbmi.material_code,mbmi.material_name
from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id
@ -146,6 +150,8 @@
#{materialName}, #{materialName},
'%') '%')
</if> </if>
<if test="saleOrderId != null ">and (wst.sale_order_id = #{saleOrderId} or wst.safe_flag='1')</if>
<if test="saleOrderId == null ">and wst.safe_flag='1'</if>
</where> </where>
</select> </select>

@ -286,6 +286,15 @@
prop="materialName" prop="materialName"
> >
</el-table-column> </el-table-column>
<el-table-column
label="安全库存"
prop="safeFlag"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column <el-table-column
label="可用库存数量" label="可用库存数量"
prop="availableAmount" prop="availableAmount"
@ -302,14 +311,13 @@
width="120" width="120"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input-number
v-model="scope.row.planAmount" v-model="scope.row.planAmount"
:min="1" :max="maxPlanAmount"
:disabled="planAmountDisabled"
controls-position="right" controls-position="right"
style="width: 100%" style="width: 100%"
> >
</el-input> </el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -572,7 +580,7 @@ export default {
Chart, Chart,
PrintPage PrintPage
}, },
dicts: ['wms_raw_return_task_type'], dicts: ['wms_raw_return_task_type','mes_safe_flag'],
data() { data() {
return { return {
fileList: [], fileList: [],
@ -591,7 +599,7 @@ export default {
getMaterialsModel: false, getMaterialsModel: false,
applyMaterialTitle: '', applyMaterialTitle: '',
planAmount : null, planAmount : null,
planAmountDisabled : true, maxPlanAmount : 1,
taskType:'', taskType:'',
dialogVisible: false, dialogVisible: false,
form: {}, form: {},
@ -950,6 +958,7 @@ export default {
this.form.materialId = val.materialId this.form.materialId = val.materialId
this.form.materialCode = val.materialCode this.form.materialCode = val.materialCode
this.form.materialName = val.materialName this.form.materialName = val.materialName
this.form.saleOrderId = val.saleOrderId
if(data){ if(data){
this.form.planDetailStatus = setState(data.planDetailStatus) this.form.planDetailStatus = setState(data.planDetailStatus)
} }
@ -1339,27 +1348,18 @@ export default {
}); });
}); });
}, },
getOrderInfo(e) {
this.getInfo(e)
getNewestProductPlanDetail({planId: e.planId}).then(val => {
this.form = val.data
this.form.materialId = e.materialId
this.form.materialName = e.materialName
this.form.planDetailStatus = setState(val.data.planDetailStatus)
})
},
// //
getMaterials(returnFlag) { getMaterials(returnFlag) {
if (returnFlag == '1') { if (returnFlag == '1') {
this.applyMaterialTitle = "领柜体"; this.applyMaterialTitle = "领柜体";
this.planAmount = 1; this.planAmount = null;
this.planAmountDisabled = true; this.maxPlanAmount = 1;
this.taskType = '2';// this.taskType = '2';//
} else { } else {
this.applyMaterialTitle = "领料"; this.applyMaterialTitle = "领料";
this.planAmount = null; this.planAmount = null;
this.planAmountDisabled = false; this.maxPlanAmount = 1000000000;
this.taskType='1';// this.taskType='1';//
} }
@ -1370,6 +1370,7 @@ export default {
planId: this.form?.planId, planId: this.form?.planId,
planCode: this.form?.planCode, planCode: this.form?.planCode,
planDetailCode: this.form?.planDetailCode, planDetailCode: this.form?.planDetailCode,
saleOrderId: this.form?.saleOrderId,
applyReason: '', applyReason: '',
taskType: '1', taskType: '1',
wmsRawOutstockDetailList: [] wmsRawOutstockDetailList: []
@ -1391,13 +1392,16 @@ export default {
} }
getStockTotal({ getStockTotal({
warehouseId: this.form1.warehouseId, warehouseId: this.form1.warehouseId,
materialName: val materialName: val,
saleOrderId: this.form.saleOrderId,
}).then(e => { }).then(e => {
this.form1.wmsRawOutstockDetailList = e.data.map(r => { this.form1.wmsRawOutstockDetailList = e.data.map(r => {
return { return {
stockTotalId: r.stockTotalId,
materialId: r.materialId, materialId: r.materialId,
materialCode: r.materialCode, materialCode: r.materialCode,
materialName: r.materialName, materialName: r.materialName,
safeFlag: r.safeFlag,
availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount, availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount,
unavailableAmount: r.occupyAmount + r.frozenAmount, unavailableAmount: r.occupyAmount + r.frozenAmount,
planAmount: this.planAmount planAmount: this.planAmount

@ -341,6 +341,14 @@
prop="materialName" prop="materialName"
> >
</el-table-column> </el-table-column>
<el-table-column
label="安全库存"
prop="safeFlag"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column <el-table-column
label="可用库存数量" label="可用库存数量"
prop="availableAmount" prop="availableAmount"
@ -559,7 +567,7 @@ import {getToken} from "@/utils/auth";
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default { export default {
name: 'Board1', name: 'Board1',
dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type'], dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type',"mes_safe_flag"],
components: { components: {
Chart, Chart,
PrintPage PrintPage
@ -647,6 +655,7 @@ export default {
this.totalNum1 = Math.ceil(e.total / 5) this.totalNum1 = Math.ceil(e.total / 5)
this.nowMaterial = e.rows?.[0]?.materialName this.nowMaterial = e.rows?.[0]?.materialName
this.materialBomId = e.rows?.[0]?.materialBomId this.materialBomId = e.rows?.[0]?.materialBomId
this.saleOrderId = e.rows?.[0]?.saleOrderId
getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.rows?.[0]?.planId}).then(res => { getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.rows?.[0]?.planId}).then(res => {
this.tableData1 = res.rows this.tableData1 = res.rows
this.totalNum3 = Math.ceil(res.total / 5) this.totalNum3 = Math.ceil(res.total / 5)
@ -802,6 +811,7 @@ export default {
this.planId = e.row.planId this.planId = e.row.planId
this.materialBomId = e.row.materialBomId this.materialBomId = e.row.materialBomId
this.nowMaterial = e.row.materialName this.nowMaterial = e.row.materialName
this.saleOrderId = e.row.saleOrderId
this.nowNum3 = 1 this.nowNum3 = 1
await getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.row.planId}).then(res => { await getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.row.planId}).then(res => {
if (res.rows.length === 0) { if (res.rows.length === 0) {
@ -871,6 +881,7 @@ export default {
planId: val.row.planId, planId: val.row.planId,
planCode: val.row.planCode, planCode: val.row.planCode,
planDetailCode: val.row.planDetailCode, planDetailCode: val.row.planDetailCode,
saleOrderId : this.saleOrderId,
applyReason: '', applyReason: '',
taskType: '1', taskType: '1',
wmsRawOutstockDetailList: [] wmsRawOutstockDetailList: []
@ -900,13 +911,16 @@ export default {
searchMaterial(val) { searchMaterial(val) {
getStockTotal({ getStockTotal({
warehouseId: this.form.warehouseId, warehouseId: this.form.warehouseId,
saleOrderId: this.saleOrderId,
materialName: val materialName: val
}).then(e => { }).then(e => {
this.form.wmsRawOutstockDetailList = e.data.map(r => { this.form.wmsRawOutstockDetailList = e.data.map(r => {
return { return {
stockTotalId: r.stockTotalId,
materialId: r.materialId, materialId: r.materialId,
materialCode: r.materialCode, materialCode: r.materialCode,
materialName: r.materialName, materialName: r.materialName,
safeFlag: r.safeFlag,
availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount, availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount,
unavailableAmount: r.occupyAmount + r.frozenAmount, unavailableAmount: r.occupyAmount + r.frozenAmount,
planAmount: r.planAmount planAmount: r.planAmount

Loading…
Cancel
Save