MES:
四楼激光切割工位板材领料和板材入库根据采购订单绑定销售订单逻辑修改
master
xins 6 months ago
parent 39e3c34ecd
commit 25cb4da81d

@ -124,4 +124,9 @@ public enum BusinessType
*/
BIND,
/**
*
*/
CHECK,
}

@ -34,6 +34,11 @@ public class WmsConfig
*/
private Long fourthFloorProductWarehouseId;
/**
* ID
*/
private Long fourthFloorPalteWarehouseId;
public String getFifthAssembleStationCode() {
return fifthAssembleStationCode;
@ -66,4 +71,12 @@ public class WmsConfig
public void setFourthFloorProductWarehouseId(Long fourthFloorProductWarehouseId) {
this.fourthFloorProductWarehouseId = fourthFloorProductWarehouseId;
}
public Long getFourthFloorPalteWarehouseId() {
return fourthFloorPalteWarehouseId;
}
public void setFourthFloorPalteWarehouseId(Long fourthFloorPalteWarehouseId) {
this.fourthFloorPalteWarehouseId = fourthFloorPalteWarehouseId;
}
}

@ -1,5 +1,6 @@
package com.hw.wms.controller;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
@ -12,6 +13,7 @@ import com.hw.wms.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import java.util.List;
@ -101,6 +103,15 @@ public class WmsApiController extends BaseController {
return toAjax(wmsRawInstockService.insertWmsRawInstock(wmsRawInstockVo));
}
/**
*
*/
@Log(title = "原材料出库记录", businessType = BusinessType.CHECK)
@PostMapping(("/checkSuitableSaleOrderMaterial"))
public AjaxResult checkSuitableSaleOrderMaterial(@RequestBody WmsRawOutstock wmsRawOutstock) {
JSONObject returnJson = wmsRawOutstockService.checkSuitableSaleOrderMaterial(wmsRawOutstock);
return AjaxResult.success(returnJson);
}
/**
*

@ -2,7 +2,9 @@ package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.common.core.constant.MesConstants;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
@ -14,101 +16,144 @@ import com.hw.common.core.web.domain.BaseEntity;
* @author xs
* @date 2023-12-21
*/
public class WmsRawStock extends BaseEntity
{
public class WmsRawStock extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 原材料库存ID */
/**
* ID
*/
private Long rawStockId;
/** 仓库ID */
/**
* ID
*/
@Excel(name = "仓库ID")
private Long warehouseId;
/** 仓库名称 */
/**
*
*/
@Excel(name = "仓库名称")
private String warehouseName;
/** 仓库楼层 */
/**
*
*/
@Excel(name = "仓库楼层")
private Long warehouseFloor;
/** 库位编码 */
/**
*
*/
@Excel(name = "库位编码")
private String locationCode;
/** 库存类型1原材料 2半成品 */
/**
* 1 2
*/
@Excel(name = "库存类型")
private String stockType;
/** 物料ID */
/**
* ID
*/
@Excel(name = "物料ID")
private Long materialId;
/** 物料编号 */
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/** 物料名称 */
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/** 入库批次号 */
/**
*
*/
@Excel(name = "入库批次号")
private String instockBatch;
/**托盘码*/
/**
*
*/
private String palletInfoCode;
private Long saleOrderId;
private String safeFlag;
/** 入库时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date instockDate;
/** 最晚出库时间;入库时,根据物料信“存放周期“计算出来的时间 */
/**
* ;
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最晚出库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastOutstockTime;
/** 质检状态(1检验中,2质检通过,3质检不通过) */
/**
* (1,2,3)
*/
@Excel(name = "质检状态")
private String qualityStatus;
/** 完整标识 */
/**
*
*/
@Excel(name = "完整标识")
private String completeFlag;
/** 总数量 */
/**
*
*/
@Excel(name = "总数量")
private BigDecimal totalAmount;
/** 冻结数量 */
/**
*
*/
@Excel(name = "冻结数量")
private BigDecimal frozenAmount;
/** 占用数量 */
/**
*
*/
@Excel(name = "占用数量")
private BigDecimal occupyAmount;
/** 供应商ID */
/**
* ID
*/
@Excel(name = "供应商ID")
private Long supplierId;
/** 创建时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
/** 最后更新时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
/** 有效标记 */
/**
*
*/
@Excel(name = "有效标记")
private String activeFlag;
@ -136,22 +181,19 @@ public class WmsRawStock extends BaseEntity
this.materialName = materialName;
}
public void setRawStockId(Long rawStockId)
{
public void setRawStockId(Long rawStockId) {
this.rawStockId = rawStockId;
}
public Long getRawStockId()
{
public Long getRawStockId() {
return rawStockId;
}
public void setWarehouseId(Long warehouseId)
{
public void setWarehouseId(Long warehouseId) {
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
public Long getWarehouseId() {
return warehouseId;
}
@ -163,40 +205,35 @@ public class WmsRawStock extends BaseEntity
this.warehouseFloor = warehouseFloor;
}
public void setLocationCode(String locationCode)
{
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public String getLocationCode()
{
public String getLocationCode() {
return locationCode;
}
public void setStockType(String stockType)
{
public void setStockType(String stockType) {
this.stockType = stockType;
}
public String getStockType()
{
public String getStockType() {
return stockType;
}
public void setMaterialId(Long materialId)
{
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialId()
{
public Long getMaterialId() {
return materialId;
}
public void setInstockBatch(String instockBatch)
{
public void setInstockBatch(String instockBatch) {
this.instockBatch = instockBatch;
}
public String getInstockBatch()
{
public String getInstockBatch() {
return instockBatch;
}
@ -224,31 +261,27 @@ public class WmsRawStock extends BaseEntity
this.safeFlag = safeFlag;
}
public void setInstockDate(Date instockDate)
{
public void setInstockDate(Date instockDate) {
this.instockDate = instockDate;
}
public Date getInstockDate()
{
public Date getInstockDate() {
return instockDate;
}
public void setLastOutstockTime(Date lastOutstockTime)
{
public void setLastOutstockTime(Date lastOutstockTime) {
this.lastOutstockTime = lastOutstockTime;
}
public Date getLastOutstockTime()
{
public Date getLastOutstockTime() {
return lastOutstockTime;
}
public void setQualityStatus(String qualityStatus)
{
public void setQualityStatus(String qualityStatus) {
this.qualityStatus = qualityStatus;
}
public String getQualityStatus()
{
public String getQualityStatus() {
return qualityStatus;
}
@ -260,70 +293,67 @@ public class WmsRawStock extends BaseEntity
this.completeFlag = completeFlag;
}
public void setTotalAmount(BigDecimal totalAmount)
{
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public BigDecimal getTotalAmount()
{
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setFrozenAmount(BigDecimal frozenAmount)
{
public void setFrozenAmount(BigDecimal frozenAmount) {
this.frozenAmount = frozenAmount;
}
public BigDecimal getFrozenAmount()
{
public BigDecimal getFrozenAmount() {
return frozenAmount;
}
public void setOccupyAmount(BigDecimal occupyAmount)
{
public void setOccupyAmount(BigDecimal occupyAmount) {
this.occupyAmount = occupyAmount;
}
public BigDecimal getOccupyAmount()
{
public BigDecimal getOccupyAmount() {
return occupyAmount;
}
public void setSupplierId(Long supplierId)
{
public void setSupplierId(Long supplierId) {
this.supplierId = supplierId;
}
public Long getSupplierId()
{
public Long getSupplierId() {
return supplierId;
}
public void setCreateDate(Date createDate)
{
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getCreateDate()
{
public Date getCreateDate() {
return createDate;
}
public void setUpdateDate(Date updateDate)
{
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
public Date getUpdateDate() {
return updateDate;
}
public void setActiveFlag(String activeFlag)
{
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag()
{
public String getActiveFlag() {
return activeFlag;
}
public String getLocationAndMaterial() {
return "库位:" + locationCode + ",物料条码:" + instockBatch +
",安全库存:"+(safeFlag.equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)?"是":"否")+";";
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -126,6 +126,14 @@ public interface IWmsRawOutstockService
*/
public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo);
/**
*
* @param wmsRawOutstock
* @return
*/
public JSONObject checkSuitableSaleOrderMaterial(WmsRawOutstock wmsRawOutstock);
/**
*
* @param wmsRawOutstock

@ -966,15 +966,18 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/**
*
*
*
* @param wmsRawOutstock
* @return
*/
@Transactional
@Override
public int directRawOutstock(WmsRawOutstock wmsRawOutstock) {
//出库要求 0申请出库1申请审核出库2直接出库
public JSONObject checkSuitableSaleOrderMaterial(WmsRawOutstock wmsRawOutstock) {
String directOutstockCode = "1";
String confirmOutstockCode = "2";
String cannotOutstockCode = "3";
JSONObject returnJson = new JSONObject();
String materialBarcode = wmsRawOutstock.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) {
@ -985,11 +988,107 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("物料编码有误");
}
//验证销售订单绑定关系,或者是否安全库存
Long saleOrderId = wmsRawOutstock.getSaleOrderId();
if (saleOrderId != null) {
//如果出库的物料是安全库存,则判断是否有绑定的销售订单信息
if ((baseBarcodeInfo.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES))) {
String returnMsg = getSuitableSaleOrderMaterials(saleOrderId);
if (StringUtils.isEmpty(returnMsg)) {//如果没有,可以直接出库
returnJson.put("code", directOutstockCode);
} else {//如果有,可以二次提示是否需要出库
returnJson.put("code", confirmOutstockCode);
returnJson.put("msg", returnMsg);
}
return returnJson;
} else {//如果非安全库存需要判断销售订单ID是否相同
if (baseBarcodeInfo.getSaleOrderId() == null || !saleOrderId.equals(baseBarcodeInfo.getSaleOrderId())) {
String returnMsg = getSuitableSaleOrderMaterials(saleOrderId);
if (StringUtils.isEmpty(returnMsg)) {//如果没有
returnMsg = getSuitableSafeMaterials(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
}
if (StringUtils.isEmpty(returnMsg)) {
throw new ServiceException("请出库对应销售订单的板材【已经没有此销售订单的库存和安全库存】");
} else {//如果有,不能出库
returnJson.put("code", cannotOutstockCode);
returnJson.put("msg", returnMsg);
}
return returnJson;
} else {
returnJson.put("code", directOutstockCode);
return returnJson;
}
}
} else {//如果没有销售订单,则需要出安全库存
if (!baseBarcodeInfo.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)) {
String returnMsg = getSuitableSafeMaterials(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
if (StringUtils.isEmpty(returnMsg)) {
throw new ServiceException("请出库安全库存的板材【已经没有安全库存】");
} else {
returnJson.put("code", cannotOutstockCode);
returnJson.put("msg", returnMsg);
}
return returnJson;
}
}
return returnJson;
}
public String getSuitableSaleOrderMaterials(Long saleOrderId) {
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setSaleOrderId(saleOrderId);
queryRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId());
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(queryRawStock);
List<WmsRawStock> availableRawStocks = wmsRawStocks.stream().filter(wmsRawStock ->
(wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount())
.subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (availableRawStocks != null && !availableRawStocks.isEmpty()) {
List<String> returnMsg = availableRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList());
return returnMsg.toString();
}
return "";
}
public String getSuitableSafeMaterials(String safeFlag) {
WmsRawStock querySafeRawStock = new WmsRawStock();
querySafeRawStock.setSafeFlag(safeFlag);
querySafeRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId());
List<WmsRawStock> safeRawStocks = wmsRawStockMapper.selectWmsRawStockList(querySafeRawStock);
List<WmsRawStock> availableSafeRawStocks = safeRawStocks.stream().filter(wmsRawStock ->
(wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount())
.subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (availableSafeRawStocks != null && !availableSafeRawStocks.isEmpty()) {
List<String> returnMsg = availableSafeRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList());
return returnMsg.toString();
}
return "";
}
/**
*
*
* @param wmsRawOutstock
* @return
*/
@Transactional
@Override
public int directRawOutstock(WmsRawOutstock wmsRawOutstock) {
//出库要求 0申请出库1申请审核出库2直接出库
String materialBarcode = wmsRawOutstock.getMaterialBarcode();
String locationCode = wmsRawOutstock.getLocationCode();
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位编码错误");
}
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) {
throw new ServiceException("物料编码有误");
}
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
BigDecimal outstockAmount = wmsRawOutstock.getOutstockAmount();
String batchCode = baseBarcodeInfo.getBatchCode();
@ -1012,16 +1111,15 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
this.insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode,
userName, currentDate);
directOutstockUpdateRawStock(locationCode, batchCode, outstockAmount, userName, currentDate);
directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate);
return 1;
}
public void directOutstockUpdateRawStock(String locationCode, String batchCode, BigDecimal outstockAmount,
public void directOutstockUpdateRawStock(String locationCode, String materialBarcode, BigDecimal outstockAmount,
String userName, Date currentDate) {
//TODO:批次码
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode);
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (wmsRawStock == null) {
throw new ServiceException("没找到库存信息");
} else {

@ -13,6 +13,8 @@
<result property="materialId" column="material_id"/>
<result property="instockBatch" column="instock_batch"/>
<result property="palletInfoCode" column="pallet_info_code"/>
<result property="saleOrderId" column="sale_order_id"/>
<result property="safeFlag" column="safe_flag"/>
<result property="instockDate" column="instock_date"/>
<result property="lastOutstockTime" column="last_outstock_time"/>
<result property="qualityStatus" column="quality_status"/>
@ -43,6 +45,8 @@
mbmi.material_name,
wrs.instock_batch,
wrs.pallet_info_code,
wrs.sale_order_id,
wrs.safe_flag,
wrs.instock_date,
wrs.last_outstock_time,
wrs.quality_status,
@ -68,6 +72,8 @@
<if test="locationCode != null and locationCode != ''">and wrs.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wrs.stock_type = #{stockType}</if>
<if test="materialId != null ">and wrs.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wrs.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wrs.safe_flag = #{safeFlag}</if>
<if test="instockBatch != null and instockBatch != ''">and wrs.instock_batch = #{instockBatch}</if>
<if test="instockDate != null ">and wrs.instock_date = #{instockDate}</if>
<if test="lastOutstockTime != null ">and wrs.last_outstock_time = #{lastOutstockTime}</if>

@ -183,6 +183,17 @@ export function addRawInstock(data) {
})
}
//激光切割工位板材出库
export function checkSuitableSaleOrderMaterial(data) {
return request({
url: '/wms/api/checkSuitableSaleOrderMaterial',
method: 'post',
data: data
})
}
//激光切割工位板材出库
export function directRawOutstock(data) {
return request({

@ -219,6 +219,7 @@ import {
startNextProductPlanDetailAttach,
getPlanDrawings,
addRawInstock,
checkSuitableSaleOrderMaterial,
directRawOutstock,
} from "@/api/board";
@ -263,7 +264,14 @@ export default {
materialBarcode: [
{required: true, message: "物料条码不能为空", trigger: "blur"}
],
}
},
OUTSTOCKCODE: {
directOutstockCode: "1",
confirmOutstockCode: "2",
cannotOutstockCode: "3"
},
}
},
async mounted() {
@ -285,6 +293,7 @@ export default {
this.form.materialId = e.rows[0]?.materialId
this.form.materialCode = e.rows[0]?.materialCode
this.form.materialName = e.rows[0]?.materialName
this.form.saleOrderId = e.rows[0]?.saleOrderId
this.form.planDetailStatus = setState(val.data.planDetailStatus)
})
})
@ -462,7 +471,8 @@ export default {
this.$store.dispatch('LogOut').then(() => {
location.href = '/login?isStationId=true';
})
}).catch(() => {});
}).catch(() => {
});
},
next1() {
this.nowNum1 += 1
@ -485,6 +495,7 @@ export default {
this.form.materialId = e.materialId
this.form.materialCode = e.materialCode
this.form.materialName = e.materialName
this.form.saleOrderId = e.saleOrderId
this.form.planDetailStatus = setState(val.data.planDetailStatus)
})
},
@ -834,6 +845,7 @@ export default {
this.form.materialId = val.materialId
this.form.materialCode = val.materialCode
this.form.materialName = val.materialName
this.form.saleOrderId = val.saleOrderId
this.form.planDetailStatus = setState(val1.data.planDetailStatus)
})
const data = await getPlanDrawings({planId: val.planId, attachId: val.attachId})
@ -920,14 +932,40 @@ export default {
this.wmsForm.planDetailCode = this.form.planDetailCode;
this.wmsForm.operationType = '1';//
this.wmsForm.taskType = '1';//
this.wmsForm.saleOrderId = this.form.saleOrderId;
checkSuitableSaleOrderMaterial(this.wmsForm).then(response => {
let returnCode = response.data.code;
let returnMsg = response.data.msg;
if (returnCode == this.OUTSTOCKCODE.directOutstockCode) {
this.directRawOutstock();
} else if (returnCode == this.OUTSTOCKCODE.confirmOutstockCode) {
this.$confirm('此库存为安全库存,确认要出安全库存么?有以下销售订单库存可以优先出:'+returnMsg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.directRawOutstock();
}).catch(() => {
});
} else {
this.$modal.msgWarning("请出库:"+returnMsg);
}
});
}
},
directRawOutstock() {
directRawOutstock(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材领取成功");
this.cancel();
});
}
},
},
@ -981,6 +1019,7 @@ export default {
/deep/ .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: #fff0;
}
/deep/ .el-table__expand-icon {
color: #fff
}

Loading…
Cancel
Save