Merge remote-tracking branch 'origin/master'

master
夜笙歌 6 months ago
commit 99982d2762

@ -82,6 +82,7 @@ public class WmsScadaController extends BaseController {
/**此方法暂时不用*/
@Log(title = "原材料出库记录", businessType = BusinessType.AUDIT) @Log(title = "原材料出库记录", businessType = BusinessType.AUDIT)
@PostMapping(("/applyAgvRawOutstock")) @PostMapping(("/applyAgvRawOutstock"))
public AjaxResult applyAgvRawOutstock(@Validated @RequestBody WmsAgvRawOutstockVo wmsAgvRawOutstockVo) { public AjaxResult applyAgvRawOutstock(@Validated @RequestBody WmsAgvRawOutstockVo wmsAgvRawOutstockVo) {

@ -2,6 +2,7 @@ package com.hw.wms.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -14,30 +15,41 @@ import com.hw.common.core.web.domain.BaseEntity;
* @author xins * @author xins
* @date 2024-03-14 * @date 2024-03-14
*/ */
public class WmsStockTotal extends BaseEntity public class WmsStockTotal extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 总库存ID */ /**
* ID
*/
private Long stockTotalId; private Long stockTotalId;
/** 仓库ID */ /**
* ID
*/
@Excel(name = "仓库ID") @Excel(name = "仓库ID")
private Long warehouseId; private Long warehouseId;
/** 仓库名称 */ /**
*
*/
@Excel(name = "仓库名称") @Excel(name = "仓库名称")
private String warehouseName; private String warehouseName;
/** 仓库楼层 */ /**
*
*/
@Excel(name = "仓库楼层") @Excel(name = "仓库楼层")
private Long warehouseFloor; private Long warehouseFloor;
/** 库存类型1原材料2半成品3成品 */ /**
* 123
*/
@Excel(name = "库存类型1原材料2半成品3成品") @Excel(name = "库存类型1原材料2半成品3成品")
private String stockType; private String stockType;
/** 物料ID */ /**
* ID
*/
@Excel(name = "物料ID") @Excel(name = "物料ID")
private Long materialId; private Long materialId;
@ -46,37 +58,53 @@ public class WmsStockTotal extends BaseEntity
private String safeFlag; private String safeFlag;
/** 物料编号 */ /**
*
*/
@Excel(name = "物料编号") @Excel(name = "物料编号")
private String materialCode; private String materialCode;
/** 物料名称 */ /**
*
*/
@Excel(name = "物料名称") @Excel(name = "物料名称")
private String materialName; private String materialName;
/** 总数量;仓库存放的总数量 */ /**
* ;
*/
@Excel(name = "总数量;仓库存放的总数量") @Excel(name = "总数量;仓库存放的总数量")
private BigDecimal totalAmount; private BigDecimal totalAmount;
/** 冻结数量;手动冻结的,暂时可不用 */ /**
* ;
*/
@Excel(name = "冻结数量;手动冻结的,暂时可不用") @Excel(name = "冻结数量;手动冻结的,暂时可不用")
private BigDecimal frozenAmount; private BigDecimal frozenAmount;
/** 占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新; */ /**
* ;;
*/
@Excel(name = "占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新;") @Excel(name = "占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新;")
private BigDecimal occupyAmount; private BigDecimal occupyAmount;
/** 创建时间 */ /**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createDate; private Date createDate;
/** 最后更新时间 */ /**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateDate; private Date updateDate;
/** 有效标记 */ /**
*
*/
@Excel(name = "有效标记") @Excel(name = "有效标记")
private String activeFlag; private String activeFlag;
@ -89,49 +117,43 @@ public class WmsStockTotal extends BaseEntity
this.warehouseName = warehouseName; this.warehouseName = warehouseName;
} }
public void setStockTotalId(Long stockTotalId) public void setStockTotalId(Long stockTotalId) {
{
this.stockTotalId = stockTotalId; this.stockTotalId = stockTotalId;
} }
public Long getStockTotalId() public Long getStockTotalId() {
{
return stockTotalId; return stockTotalId;
} }
public void setWarehouseId(Long warehouseId)
{ public void setWarehouseId(Long warehouseId) {
this.warehouseId = warehouseId; this.warehouseId = warehouseId;
} }
public Long getWarehouseId() public Long getWarehouseId() {
{
return warehouseId; return warehouseId;
} }
public void setWarehouseFloor(Long warehouseFloor)
{ public void setWarehouseFloor(Long warehouseFloor) {
this.warehouseFloor = warehouseFloor; this.warehouseFloor = warehouseFloor;
} }
public Long getWarehouseFloor() public Long getWarehouseFloor() {
{
return warehouseFloor; return warehouseFloor;
} }
public void setStockType(String stockType)
{ public void setStockType(String stockType) {
this.stockType = stockType; this.stockType = stockType;
} }
public String getStockType() public String getStockType() {
{
return stockType; return stockType;
} }
public void setMaterialId(Long materialId)
{ public void setMaterialId(Long materialId) {
this.materialId = materialId; this.materialId = materialId;
} }
public Long getMaterialId() public Long getMaterialId() {
{
return materialId; return materialId;
} }
@ -151,58 +173,52 @@ public class WmsStockTotal extends BaseEntity
this.safeFlag = safeFlag; this.safeFlag = safeFlag;
} }
public void setTotalAmount(BigDecimal totalAmount) public void setTotalAmount(BigDecimal totalAmount) {
{
this.totalAmount = totalAmount; this.totalAmount = totalAmount;
} }
public BigDecimal getTotalAmount() public BigDecimal getTotalAmount() {
{
return totalAmount; return totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : totalAmount;
} }
public void setFrozenAmount(BigDecimal frozenAmount)
{ public void setFrozenAmount(BigDecimal frozenAmount) {
this.frozenAmount = frozenAmount; this.frozenAmount = frozenAmount;
} }
public BigDecimal getFrozenAmount() public BigDecimal getFrozenAmount() {
{ return frozenAmount == null || frozenAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : frozenAmount;
return frozenAmount;
} }
public void setOccupyAmount(BigDecimal occupyAmount)
{ public void setOccupyAmount(BigDecimal occupyAmount) {
this.occupyAmount = occupyAmount; this.occupyAmount = occupyAmount;
} }
public BigDecimal getOccupyAmount() public BigDecimal getOccupyAmount() {
{ return occupyAmount == null || occupyAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : occupyAmount;
return occupyAmount;
} }
public void setCreateDate(Date createDate)
{ public void setCreateDate(Date createDate) {
this.createDate = createDate; this.createDate = createDate;
} }
public Date getCreateDate() public Date getCreateDate() {
{
return createDate; return createDate;
} }
public void setUpdateDate(Date updateDate)
{ public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate; this.updateDate = updateDate;
} }
public Date getUpdateDate() public Date getUpdateDate() {
{
return updateDate; return updateDate;
} }
public void setActiveFlag(String activeFlag)
{ public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag; this.activeFlag = activeFlag;
} }
public String getActiveFlag() public String getActiveFlag() {
{
return activeFlag; return activeFlag;
} }

@ -114,7 +114,7 @@ public interface WmsRawOutstockMapper
/** /**
* ,join material * ,join material,warehouse
* *
* @param wmsRawOutstock * @param wmsRawOutstock
* @return * @return

@ -240,7 +240,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
BigDecimal planAmount = wmsRawOutstock.getOutstockAmount(); BigDecimal planAmount = wmsRawOutstock.getOutstockAmount();
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(instockBatch); WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(instockBatch);
if (wmsRawStock != null) { if (wmsRawStock != null) {
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ||
wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ?
BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
if (occupyAmount.compareTo(planAmount) >= 0) { if (occupyAmount.compareTo(planAmount) >= 0) {
wmsRawStock.setOccupyAmount(occupyAmount.subtract(planAmount)); wmsRawStock.setOccupyAmount(occupyAmount.subtract(planAmount));
@ -306,13 +307,19 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
} }
String batchCode = baseBarcodeInfo.getBatchCode(); WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位码有误");
}
//todo后续判断outrequirement
//判断是否有此出库任务,人工出库的同一个出库记录同一个库位、同一个物料对应一个明细agv的有可能是多个 //判断是否有此出库任务,人工出库的同一个出库记录同一个库位、同一个物料对应一个明细agv的有可能是多个
WmsRawOutstock wmsRawOutstock;
if (rawOutstockId != null) {
wmsRawOutstock = wmsRawOutstockMapper.selectWmsRawOutstockByRawOutstockId(rawOutstockId);
} else {
WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setLocationCode(locationCode); queryRawOutstock.setWarehouseId(baseLocation.getWarehouseId());
queryRawOutstock.setInstockBatch(batchCode); queryRawOutstock.setMaterialId(baseBarcodeInfo.getMaterialId());
queryRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); queryRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
queryRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); queryRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
queryRawOutstock.setRawOutstockId(rawOutstockId); queryRawOutstock.setRawOutstockId(rawOutstockId);
@ -326,7 +333,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("请选择具体出库任务后点击确认"); throw new ServiceException("请选择具体出库任务后点击确认");
} }
WmsRawOutstock wmsRawOutstock = wmsRawOutstocks.get(0); wmsRawOutstock = wmsRawOutstocks.get(0);
}
WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail(); WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail();
queryRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId()); queryRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId());
@ -369,20 +378,22 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setUpdateBy(userName); wmsRawOutstock.setUpdateBy(userName);
wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock); wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode, userName, currentDate); insertRawOutstockDetail(wmsRawOutstock, locationCode, materialBarcode, baseBarcodeInfo.getBatchCode(), userName, currentDate);
updateRawStock(locationCode, batchCode, outstockAmount, userName, currentDate); updateRawStock(materialBarcode, outstockAmount, userName, currentDate);
//trigger中更新stocktotal的占用数量和库存数量
return 1; return 1;
} }
public void insertRawOutstockDetail(WmsRawOutstock wmsRawOutstock, String materialBarcode, String batchCode, public void insertRawOutstockDetail(WmsRawOutstock wmsRawOutstock, String locationCode, String materialBarcode, String batchCode,
String userName, Date currentDate) { String userName, Date currentDate) {
WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail(); WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail();
wmsRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId()); wmsRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId());
wmsRawOutstockDetail.setTaskCode(wmsRawOutstock.getTaskCode()); wmsRawOutstockDetail.setTaskCode(wmsRawOutstock.getTaskCode());
wmsRawOutstockDetail.setWarehouseId(wmsRawOutstock.getWarehouseId()); wmsRawOutstockDetail.setWarehouseId(wmsRawOutstock.getWarehouseId());
wmsRawOutstockDetail.setLocationCode(wmsRawOutstock.getLocationCode()); wmsRawOutstockDetail.setLocationCode(locationCode);
wmsRawOutstockDetail.setMaterialId(wmsRawOutstock.getMaterialId()); wmsRawOutstockDetail.setMaterialId(wmsRawOutstock.getMaterialId());
wmsRawOutstockDetail.setMaterialBarcode(materialBarcode); wmsRawOutstockDetail.setMaterialBarcode(materialBarcode);
wmsRawOutstockDetail.setInstockBatch(batchCode); wmsRawOutstockDetail.setInstockBatch(batchCode);
@ -398,15 +409,14 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
public void updateRawStock(String locationCode, String batchCode, BigDecimal outstockAmount, String userName, Date currentDate) { public void updateRawStock(String materialBarcode, BigDecimal outstockAmount, String userName, Date currentDate) {
//更新原材料库存占用数量和总数量 //更新原材料库存占用数量和总数量
//todo 批次码 WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode);
if (wmsRawStock == null) { if (wmsRawStock == null) {
throw new ServiceException("没找到库存信息"); throw new ServiceException("没找到库存信息");
} else { } else {
BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount(); BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
BigDecimal updatedOccupyAmount = occupyAmount.subtract(outstockAmount); BigDecimal updatedOccupyAmount = occupyAmount.subtract(outstockAmount);
BigDecimal updatedTotalAmount = totalAmount.subtract(outstockAmount); BigDecimal updatedTotalAmount = totalAmount.subtract(outstockAmount);
updatedOccupyAmount = updatedOccupyAmount.compareTo(BigDecimal.ZERO) >= 0 ? updatedOccupyAmount : BigDecimal.ZERO; updatedOccupyAmount = updatedOccupyAmount.compareTo(BigDecimal.ZERO) >= 0 ? updatedOccupyAmount : BigDecimal.ZERO;
@ -508,8 +518,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
Long stockTotalId = rawOutstockDetail.getStockTotalId(); Long stockTotalId = rawOutstockDetail.getStockTotalId();
WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId); WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId);
BigDecimal totalAmount = wmsStockTotal.getTotalAmount(); BigDecimal totalAmount = wmsStockTotal.getTotalAmount();
BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount(); BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null || wmsStockTotal.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount();
BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount(); BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null || wmsStockTotal.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount);
BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ? BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ?
@ -692,8 +702,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String moveMaterialBarcode = ""; String moveMaterialBarcode = "";
Long moveMaterialId = null; Long moveMaterialId = null;
for (WmsRawStock wmsRawStock : rawStockList) { for (WmsRawStock wmsRawStock : rawStockList) {
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount(); BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount();
WmsBaseLocation wmsBaseLocation = baseLocationsMap.get(wmsRawStock.getLocationCode()); WmsBaseLocation wmsBaseLocation = baseLocationsMap.get(wmsRawStock.getLocationCode());
//先确认出库库位,可用数量>=1库位状态是正常的 //先确认出库库位,可用数量>=1库位状态是正常的
@ -1042,8 +1052,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
queryRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); queryRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId());
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(queryRawStock); List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(queryRawStock);
List<WmsRawStock> availableRawStocks = wmsRawStocks.stream().filter(wmsRawStock -> List<WmsRawStock> availableRawStocks = wmsRawStocks.stream().filter(wmsRawStock ->
(wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount())
.subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); .subtract(wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (availableRawStocks != null && !availableRawStocks.isEmpty()) { if (availableRawStocks != null && !availableRawStocks.isEmpty()) {
List<String> returnMsg = availableRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); List<String> returnMsg = availableRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList());
return returnMsg.toString(); return returnMsg.toString();
@ -1058,8 +1068,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
querySafeRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); querySafeRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId());
List<WmsRawStock> safeRawStocks = wmsRawStockMapper.selectWmsRawStockList(querySafeRawStock); List<WmsRawStock> safeRawStocks = wmsRawStockMapper.selectWmsRawStockList(querySafeRawStock);
List<WmsRawStock> availableSafeRawStocks = safeRawStocks.stream().filter(wmsRawStock -> List<WmsRawStock> availableSafeRawStocks = safeRawStocks.stream().filter(wmsRawStock ->
(wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount())
.subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); .subtract(wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (availableSafeRawStocks != null && !availableSafeRawStocks.isEmpty()) { if (availableSafeRawStocks != null && !availableSafeRawStocks.isEmpty()) {
List<String> returnMsg = availableSafeRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); List<String> returnMsg = availableSafeRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList());
return returnMsg.toString(); return returnMsg.toString();
@ -1108,7 +1118,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setApplyDate(currentDate); wmsRawOutstock.setApplyDate(currentDate);
wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock); wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
this.insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode, this.insertRawOutstockDetail(wmsRawOutstock, locationCode,materialBarcode, batchCode,
userName, currentDate); userName, currentDate);
directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate); directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate);

@ -281,13 +281,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select wro.raw_outstock_id as raw_outstock_detail_id, wro.task_code,wro.location_code,wro.material_batch as instock_batch,wro.outstock_amount as plan_amount,wro.real_outstock_amount as outstock_amount, select wro.raw_outstock_id as raw_outstock_detail_id, wro.task_code,wro.location_code,wro.material_batch as instock_batch,wro.outstock_amount as plan_amount,wro.real_outstock_amount as outstock_amount,
wro.apply_by,wro.apply_date,wro.apply_reason,wro.audit_by,wro.audit_date,wro.audit_reason,wro.plan_code,wro.plan_detail_code,wro.audit_status,wro.task_type, wro.apply_by,wro.apply_date,wro.apply_reason,wro.audit_by,wro.audit_date,wro.audit_reason,wro.plan_code,wro.plan_detail_code,wro.audit_status,wro.task_type,
wro.execute_status,wro.erp_status,wro.erp_amount, wro.execute_status,wro.erp_status,wro.erp_amount,
mbmi.material_code,mbmi.material_name mbmi.material_code,mbmi.material_name,
mbr.warehouse_name
from wms_raw_outstock wro left join mes_base_material_info mbmi on wro.material_id = mbmi.material_id from wms_raw_outstock wro left join mes_base_material_info mbmi on wro.material_id = mbmi.material_id
left join wms_base_warehouse mbr on wro.warehouse_id = mbr.warehouse_id
<where> <where>
<if test="taskCode != null and taskCode != ''"> and wro.task_code = #{taskCode}</if> <if test="taskCode != null and taskCode != ''"> and wro.task_code = #{taskCode}</if>
<if test="auditStatus != null and auditStatus != ''"> and wro.audit_status = #{auditStatus}</if> <if test="auditStatus != null and auditStatus != ''"> and wro.audit_status = #{auditStatus}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if> <if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if>
</where> </where>
order by wro.raw_outstock_id desc
</select> </select>
<insert id="batchWmsRawOutstock"> <insert id="batchWmsRawOutstock">

@ -142,6 +142,7 @@
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
<where> <where>
and wst.total_amount>0
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if> <if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<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>

Loading…
Cancel
Save