WMS:PDA接口原材料出库审核和原材料出库完善。
master
xins 8 months ago
parent 890f8d3ba3
commit 40718d7950

@ -197,4 +197,13 @@ public class WmsConstants {
public static final String QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MARTERIAL = "1";//物料
public static final String WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY = "0";//申请出库
public static final String WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT = "1";//申请审核出库
public static final String WMS_WAREHOUSE_OUT_REQUIREMENT_DIRECT = "2";//直接出库
public static final String WMS_RAW_STOCK_COMPLETE_FLAY_YES = "1";//完整
public static final String WMS_RAW_STOCK_COMPLETE_FLAY_NO = "0";//拆分后的
}

@ -35,6 +35,16 @@ public class Seq {
public static final String productOutstockCode = "PO";
// 原材料出库记录序列类型
public static final String rawOutstockSeqType = "RAWOUTSTOCK";
// 原材料出库记录接口序列数
private static AtomicInteger rawOutstockSeq = new AtomicInteger(1);
// 原材料出库记录标识
public static final String rawOutstockSeqCode = "RO";
// 原材料退库记录序列类型
public static final String rawReturnSeqType = "RAWRETURN";
@ -188,6 +198,8 @@ public class Seq {
atomicInt = mesBarcodeSeq;
}else if (dmsBillsFaultInstanceSeqType.equals(type)) {
atomicInt = dmsBillsFaultInstanceSeq;
}else if (rawOutstockSeqType.equals(type)) {
atomicInt = rawOutstockSeq;
}
return getId(atomicInt, 3, code);
}

@ -106,7 +106,7 @@ public class WmsMobileController extends BaseController {
startPage();
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT);
List<WmsRawOutstock> list = wmsRawOutstockService.selectWmsRawOutstockList(wmsRawOutstock);
List<WmsRawOutstock> list = wmsRawOutstockService.selectWmsRawOutstockJoinList(wmsRawOutstock);
return getDataTable(list);
}
@ -373,6 +373,26 @@ public class WmsMobileController extends BaseController {
}
/**
*
*/
@Log(title = "组装出库", businessType = BusinessType.INSERT)
@PostMapping(("/assembleOutstock"))
public AjaxResult assembleOutstock(@Validated @RequestBody WmsAssembleOutstockVo wmsAssembleOutstockVo) {
return toAjax(wmsRawOutstockService.assembleOutstock(wmsAssembleOutstockVo));
}
/**
*
*/
@Log(title = "生产入库", businessType = BusinessType.INSERT)
@PostMapping(("/produceInstock"))
public AjaxResult produceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) {
return toAjax(wmsProductInstockService.produceInstock(wmsProduceInstockVo));
}
/**
*
*/

@ -2,6 +2,7 @@ package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -14,90 +15,129 @@ import com.hw.common.core.web.domain.BaseEntity;
* @author xs
* @date 2023-12-20
*/
public class WmsRawOutstockDetail extends BaseEntity
{
public class WmsRawOutstockDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 原材料出库记录明细ID */
/**
* ID
*/
private Long rawOutstockDetailId;
/** 原材料出库ID */
/**
* ID
*/
@Excel(name = "原材料出库ID")
private Long rawOutstockId;
/** 仓库ID */
/**
* ID
*/
@Excel(name = "仓库ID")
private Long warehouseId;
/** 库位编码 */
/**
*
*/
@Excel(name = "库位编码")
private String locationCode;
/** 物料条码 */
/**
*
*/
@Excel(name = "物料条码")
private String materialBarcode;
/** 物料ID */
/**
* ID
*/
@Excel(name = "物料ID")
private Long materialId;
/** 批次;扫描条码时,从打印条码记录表中获取 */
/**
* ;
*/
@Excel(name = "批次;扫描条码时,从打印条码记录表中获取")
private String instockBatch;
/** 生产日期;扫描条码时,从打印条码记录表中获取 */
/**
* ;
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期;扫描条码时,从打印条码记录表中获取", width = 30, dateFormat = "yyyy-MM-dd")
private Date materialProductionDate;
/** 计划数量 */
/**
*
*/
@Excel(name = "计划数量")
private BigDecimal planAmount;
/** 出库数量 */
/**
*
*/
@Excel(name = "出库数量")
private BigDecimal outstockAmount;
/** 执行状态(0待执行,1执行中,2执行完成) */
/**
* (0,1,2)
*/
@Excel(name = "执行状态(0待执行,1执行中,2执行完成)")
private String executeStatus;
/** 同步ERP状态(0:失败,1成功) */
/**
* ERP(0:,1)
*/
@Excel(name = "同步ERP状态(0:失败,1成功)")
private String erpStatus;
/** 出库人 */
/**
*
*/
@Excel(name = "出库人")
private String outstockPerson;
/** 出库时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date outstockTime;
/** 出库方式( 0:PC出库 1:手持出库 2:AGV出库 */
/**
* 0:PC 1: 2:AGV
*/
@Excel(name = "出库方式", readConverterExp = "0=:PC出库,1=:手持出库,2=:AGV出库")
private String outstockWay;
/** 使用机台名称;出库扫描条码时,从打印条码记录表中获取 */
/**
* 使;
*/
@Excel(name = "使用机台名称;出库扫描条码时,从打印条码记录表中获取")
private String machineName;
/** 质检状态(0:待质检,1:合格,2:NG) */
/**
* (0:,1:,2:NG)
*/
@Excel(name = "质检状态(0:待质检,1:合格,2:NG)")
private String qualityStatus;
/** 创建时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后更新时间 */
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 每托数量 */
/**
*
*/
@Excel(name = "每托数量")
private BigDecimal stackAmount;
@ -108,26 +148,28 @@ public class WmsRawOutstockDetail extends BaseEntity
private String applyBy;
private Date applyDate;
private String taskType;
private String taskCode;
public void setRawOutstockDetailId(Long rawOutstockDetailId)
{
private String executeStatusStr;
private String auditStatus;
public void setRawOutstockDetailId(Long rawOutstockDetailId) {
this.rawOutstockDetailId = rawOutstockDetailId;
}
public Long getRawOutstockDetailId()
{
public Long getRawOutstockDetailId() {
return rawOutstockDetailId;
}
public void setRawOutstockId(Long rawOutstockId)
{
public void setRawOutstockId(Long rawOutstockId) {
this.rawOutstockId = rawOutstockId;
}
public Long getRawOutstockId()
{
public Long getRawOutstockId() {
return rawOutstockId;
}
@ -139,157 +181,139 @@ public class WmsRawOutstockDetail extends BaseEntity
this.warehouseId = warehouseId;
}
public void setLocationCode(String locationCode)
{
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public String getLocationCode()
{
public String getLocationCode() {
return locationCode;
}
public void setMaterialBarcode(String materialBarcode)
{
public void setMaterialBarcode(String materialBarcode) {
this.materialBarcode = materialBarcode;
}
public String getMaterialBarcode()
{
public String getMaterialBarcode() {
return materialBarcode;
}
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;
}
public void setMaterialProductionDate(Date materialProductionDate)
{
public void setMaterialProductionDate(Date materialProductionDate) {
this.materialProductionDate = materialProductionDate;
}
public Date getMaterialProductionDate()
{
public Date getMaterialProductionDate() {
return materialProductionDate;
}
public void setPlanAmount(BigDecimal planAmount)
{
public void setPlanAmount(BigDecimal planAmount) {
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount()
{
public BigDecimal getPlanAmount() {
return planAmount;
}
public void setOutstockAmount(BigDecimal outstockAmount)
{
public void setOutstockAmount(BigDecimal outstockAmount) {
this.outstockAmount = outstockAmount;
}
public BigDecimal getOutstockAmount()
{
return outstockAmount;
public BigDecimal getOutstockAmount() {
return outstockAmount == null ? BigDecimal.ZERO : outstockAmount;
}
public void setExecuteStatus(String executeStatus)
{
public void setExecuteStatus(String executeStatus) {
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
{
public String getExecuteStatus() {
return executeStatus;
}
public void setErpStatus(String erpStatus)
{
public void setErpStatus(String erpStatus) {
this.erpStatus = erpStatus;
}
public String getErpStatus()
{
public String getErpStatus() {
return erpStatus;
}
public void setOutstockPerson(String outstockPerson)
{
public void setOutstockPerson(String outstockPerson) {
this.outstockPerson = outstockPerson;
}
public String getOutstockPerson()
{
public String getOutstockPerson() {
return outstockPerson;
}
public void setOutstockTime(Date outstockTime)
{
public void setOutstockTime(Date outstockTime) {
this.outstockTime = outstockTime;
}
public Date getOutstockTime()
{
public Date getOutstockTime() {
return outstockTime;
}
public void setOutstockWay(String outstockWay)
{
public void setOutstockWay(String outstockWay) {
this.outstockWay = outstockWay;
}
public String getOutstockWay()
{
public String getOutstockWay() {
return outstockWay;
}
public void setMachineName(String machineName)
{
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public String getMachineName()
{
public String getMachineName() {
return machineName;
}
public void setQualityStatus(String qualityStatus)
{
public void setQualityStatus(String qualityStatus) {
this.qualityStatus = qualityStatus;
}
public String getQualityStatus()
{
public String getQualityStatus() {
return qualityStatus;
}
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 setStackAmount(BigDecimal stackAmount)
{
public void setStackAmount(BigDecimal stackAmount) {
this.stackAmount = stackAmount;
}
public BigDecimal getStackAmount()
{
public BigDecimal getStackAmount() {
return stackAmount;
}
@ -317,6 +341,14 @@ public class WmsRawOutstockDetail extends BaseEntity
this.applyBy = applyBy;
}
public Date getApplyDate() {
return applyDate;
}
public void setApplyDate(Date applyDate) {
this.applyDate = applyDate;
}
public String getTaskType() {
return taskType;
}
@ -333,30 +365,46 @@ public class WmsRawOutstockDetail extends BaseEntity
this.taskCode = taskCode;
}
public String getExecuteStatusStr() {
return executeStatusStr;
}
public void setExecuteStatusStr(String executeStatusStr) {
this.executeStatusStr = executeStatusStr;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("rawOutstockDetailId", getRawOutstockDetailId())
.append("rawOutstockId", getRawOutstockId())
.append("locationCode", getLocationCode())
.append("materialBarcode", getMaterialBarcode())
.append("materialId", getMaterialId())
.append("instockBatch", getInstockBatch())
.append("materialProductionDate", getMaterialProductionDate())
.append("planAmount", getPlanAmount())
.append("outstockAmount", getOutstockAmount())
.append("executeStatus", getExecuteStatus())
.append("erpStatus", getErpStatus())
.append("outstockPerson", getOutstockPerson())
.append("outstockTime", getOutstockTime())
.append("outstockWay", getOutstockWay())
.append("machineName", getMachineName())
.append("qualityStatus", getQualityStatus())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("stackAmount", getStackAmount())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("rawOutstockDetailId", getRawOutstockDetailId())
.append("rawOutstockId", getRawOutstockId())
.append("locationCode", getLocationCode())
.append("materialBarcode", getMaterialBarcode())
.append("materialId", getMaterialId())
.append("instockBatch", getInstockBatch())
.append("materialProductionDate", getMaterialProductionDate())
.append("planAmount", getPlanAmount())
.append("outstockAmount", getOutstockAmount())
.append("executeStatus", getExecuteStatus())
.append("erpStatus", getErpStatus())
.append("outstockPerson", getOutstockPerson())
.append("outstockTime", getOutstockTime())
.append("outstockWay", getOutstockWay())
.append("machineName", getMachineName())
.append("qualityStatus", getQualityStatus())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("stackAmount", getStackAmount())
.toString();
}
}

@ -0,0 +1,21 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description: VO
* @ClassName: WmsProduceInstockVo
* @Author : xins
* @Date :2024-03-15 13:51
* @Version :1.0
*/
@Data
public class WmsAssembleOutstockVo {
//物料条码
@NotBlank(message="物料条码必须输入")
private String materialBarcode;
}

@ -0,0 +1,21 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description: VO
* @ClassName: WmsProduceInstockVo
* @Author : xins
* @Date :2024-03-15 13:51
* @Version :1.0
*/
@Data
public class WmsProduceInstockVo {
//物料条码
@NotBlank(message="物料条码必须输入")
private String materialBarcode;
}

@ -22,8 +22,8 @@ public class WmsRawOutstockConfirmVo {
@NotBlank(message = "库位编码必须输入")
private String locationCode;
//物料批次
@NotBlank(message = "批次必须输入")
//物料条码(非批次码)
@NotBlank(message = "物料条码必须输入")
private String instockBatch;
//原材料出库数量

@ -2,6 +2,7 @@ package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsProductInstock;
import com.hw.wms.domain.vo.WmsProduceInstockVo;
import com.hw.wms.domain.vo.WmsProductInstockVo;
import org.springframework.transaction.annotation.Transactional;
@ -69,4 +70,11 @@ public interface IWmsProductInstockService
* @return
*/
public int insertWmsProductInstock(WmsProductInstockVo wmsProductInstockVo);
/**
*
* @param wmsProduceInstockVo
* @return
*/
public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo);
}

@ -5,10 +5,7 @@ import java.util.List;
import com.alibaba.fastjson2.JSONObject;
import com.hw.wms.domain.WmsRawOutstock;
import com.hw.wms.domain.WmsRawOutstockDetail;
import com.hw.wms.domain.vo.WmsAgvRawOutstockVo;
import com.hw.wms.domain.vo.WmsRawOutstockAuditVo;
import com.hw.wms.domain.vo.WmsRawOutstockConfirmVo;
import com.hw.wms.domain.vo.WmsWcsVo;
import com.hw.wms.domain.vo.*;
import org.springframework.transaction.annotation.Transactional;
/**
@ -97,4 +94,19 @@ public interface IWmsRawOutstockService
public int applyRawOutstock(WmsRawOutstock wmsRawOutstock);
public List<WmsWcsVo> applyAgvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo);
/**
* ,join warehouse
*
* @param wmsRawOutstock
* @return
*/
public List<WmsRawOutstock> selectWmsRawOutstockJoinList(WmsRawOutstock wmsRawOutstock);
/**
*
* @param wmsAssembleOutstockVo
* @return
*/
public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo);
}

@ -12,6 +12,7 @@ import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.WmsProduceInstockVo;
import com.hw.wms.domain.vo.WmsProductInstockVo;
import com.hw.wms.domain.vo.WmsRawInstockVo;
import com.hw.wms.mapper.WmsBaseLocationMapper;
@ -166,7 +167,6 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
String productBatch = baseBarcodeInfo.getBatchCode();
Long productId =baseBarcodeInfo.getMaterialId();
String locationCode = wmsProductInstockVo.getLocationCode();
@ -195,11 +195,11 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
int rows = wmsProductInstockMapper.insertWmsProductInstock(wmsProductInstock);
//插入明细
insertWmsProductInstockDetail(wmsProductInstock, materialBarcode, productBatch, productId, wmsProductInstockVo);
insertWmsProductInstockDetail(wmsProductInstock, materialBarcode, productId, wmsProductInstockVo);
//更新库存
updateProductStock(wmsProductInstock, baseBarcodeInfo, baseLocation,
productBatch, productId, userName, currentDate);
materialBarcode, productId, userName, currentDate);
return rows;
}
@ -209,16 +209,14 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
*
* @param wmsProductInstock
* @param materialBarcode
* @param productBatch
* @param productId
* @param wmsProductInstockVo
*/
public void insertWmsProductInstockDetail(WmsProductInstock wmsProductInstock, String materialBarcode, String productBatch, Long productId, WmsProductInstockVo wmsProductInstockVo) {
public void insertWmsProductInstockDetail(WmsProductInstock wmsProductInstock, String materialBarcode, Long productId, WmsProductInstockVo wmsProductInstockVo) {
WmsProductInstockDetail wmsProductInstockDetail = new WmsProductInstockDetail();
wmsProductInstockDetail.setProductInstockId(wmsProductInstock.getProductInstockId());
wmsProductInstockDetail.setLocationCode(wmsProductInstock.getLocationCode());
wmsProductInstockDetail.setProductBarcode(materialBarcode);
wmsProductInstockDetail.setProductBatch(productBatch);
wmsProductInstockDetail.setProductId(productId);
wmsProductInstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsProductInstockDetail.setInstockBy(wmsProductInstock.getApplyBy());
@ -234,7 +232,6 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
*
*
* @param wmsProductInstock
* @param wmsProductInstockVo
* @param baseLocation
* @param productBatch
* @param productId
@ -272,6 +269,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
wmsProductStock.setPlanCode(baseBarcodeInfo.getPlanCode());
wmsProductStock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode());
wmsProductStock.setWarehouseFloor(baseLocation.getWarehouseFloor());
wmsProductStock.setSaleorderCode(baseBarcodeInfo.getSaleorderCode());
// wmsProductStock.setQualityStatus(wmsRawInstockVo.getQualityStatus());
wmsProductStock.setTotalAmount(instockAmount);
wmsProductStock.setCreateBy(userName);
@ -281,6 +279,19 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
}
}
/**
*
* @param wmsProduceInstockVo
* @return
*/
@Override
public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo){
return 1;
}
public void syncToErp() {
//todo 根据质检状态是通过的同步给ERP
}

@ -2,6 +2,7 @@ package com.hw.wms.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.domain.R;
@ -10,6 +11,7 @@ import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo;
import com.hw.wms.domain.*;
@ -196,7 +198,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
JSONObject returnJson = new JSONObject();
returnJson.put("auditStatus", auditStatus);
//审核不通过,需要有审核意见,并且需要更新库位占用数量
//审核不通过,需要有审核意见,并且需要更新库位占用数量(解除之前占用的数量)
if (auditStatus.equalsIgnoreCase(WmsConstants.RAW_OUTSTOCK_AUDIT_STATUS_FAIL)) {
if (StringUtils.isEmpty(auditReason)) {
throw new ServiceException("请输入审核意见");
@ -224,20 +226,20 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
});
} else {
//如果操作类型是agv需要返回具体任务信息给上位机,由上位机通知WCS调度agv
if (wmsRawOutstock.getOperationType().equals(WmsConstants.WMS_OPERATION_TYPE_AUTO)) {
JSONArray agvTasks = new JSONArray();
List<WmsRawOutstockDetail> wmsRawOutstockDetails = wmsRawOutstock.getWmsRawOutstockDetailList();
wmsRawOutstockDetails.forEach(wmsRawOutstockDetail -> {
//todo:双排库,先出前排,再出后排,如果前排有挡住的需要移库锁库等,按顺序下发任务
JSONObject agvTask = new JSONObject();
agvTask.put("stationId", wmsRawOutstock.getStationId());
agvTask.put("locationCode", wmsRawOutstockDetail.getLocationCode());
agvTask.put("planAmount", wmsRawOutstockDetail.getPlanAmount());
agvTasks.add(agvTask);
});
returnJson.put("agvTasks", agvTasks.toString());
}
//如果操作类型是agv需要WCS轮询获取任务去调度agv
// if (wmsRawOutstock.getOperationType().equals(WmsConstants.WMS_OPERATION_TYPE_AUTO)) {
// JSONArray agvTasks = new JSONArray();
// List<WmsRawOutstockDetail> wmsRawOutstockDetails = wmsRawOutstock.getWmsRawOutstockDetailList();
// wmsRawOutstockDetails.forEach(wmsRawOutstockDetail -> {
// //todo:双排库,先出前排,再出后排,如果前排有挡住的需要移库锁库等,按顺序下发任务
// JSONObject agvTask = new JSONObject();
// agvTask.put("stationId", wmsRawOutstock.getStationId());
// agvTask.put("locationCode", wmsRawOutstockDetail.getLocationCode());
// agvTask.put("planAmount", wmsRawOutstockDetail.getPlanAmount());
// agvTasks.add(agvTask);
// });
// returnJson.put("agvTasks", agvTasks.toString());
// }
}
wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
@ -257,17 +259,35 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
public int confirmWmsRawOutstock(WmsRawOutstockConfirmVo wmsRawOutstockConfirmVo) {
Long rawOutstockDetailId = wmsRawOutstockConfirmVo.getRawOutstockDetailId();
String locationCode = wmsRawOutstockConfirmVo.getLocationCode();
String instockBatch = wmsRawOutstockConfirmVo.getInstockBatch();
String materialBarcode = wmsRawOutstockConfirmVo.getInstockBatch();//在此是物料条码,不是批次码
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
BigDecimal outstockAmount = wmsRawOutstockConfirmVo.getOutstockAmount();
if (outstockAmount.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("数量需大于0");
}
String batchFlag = baseBarcodeInfo.getBatchFlag();
if (!batchFlag.equals(MesConstants.IS_BATCH)) {//如果不是批次
if (outstockAmount.compareTo(BigDecimal.ONE) != 0) {
throw new ServiceException("非批次物料数量需等于1");
}
}
//判断是否有此出库任务,人工出库的同一个出库记录同一个库位、同一个物料对应一个明细agv的有可能是多个
WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail();
queryRawOutstockDetail.setLocationCode(locationCode);
queryRawOutstockDetail.setInstockBatch(instockBatch);
queryRawOutstockDetail.setInstockBatch(baseBarcodeInfo.getBatchCode());
queryRawOutstockDetail.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE+","+WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
queryRawOutstockDetail.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
List<WmsRawOutstockDetail> wmsRawOutstockDetails = wmsRawOutstockDetailMapper.selectWmsRawOutstockDetailList(queryRawOutstockDetail);
WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail();
WmsRawOutstockDetail wmsRawOutstockDetail;
if (wmsRawOutstockDetails == null || wmsRawOutstockDetails.isEmpty()) {
throw new ServiceException("没有此出库任务");
} else if (wmsRawOutstockDetails.size() > 1) {
} else if (wmsRawOutstockDetails.size() > 1) {//如果有同一库位同一批次多次领料申请比方说张三领料批次A库位A3个李四领取批次A库位A4个此时就需要选择
if (rawOutstockDetailId == null) {
throw new ServiceException("请选择具体出库任务后点击确认");
} else {
@ -277,11 +297,11 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstockDetail = wmsRawOutstockDetails.get(0);
}
//判断质检状态
if (wmsRawOutstockDetail.getQualityStatus() != null
&& !wmsRawOutstockDetail.getQualityStatus().equals(WmsConstants.WMS_QUALITY_STATUS_PASS)) {
throw new ServiceException("质检通过才能出库");
}
//todo 判断质检状态
// if (wmsRawOutstockDetail.getQualityStatus() != null
// && !wmsRawOutstockDetail.getQualityStatus().equals(WmsConstants.WMS_QUALITY_STATUS_PASS)) {
// throw new ServiceException("质检通过才能出库");
// }
// 判断本次出库数量+已出库数量是否大于计划出库数量
BigDecimal hadOutstockAmount = wmsRawOutstockDetail.getOutstockAmount() == null ? BigDecimal.ZERO : wmsRawOutstockDetail.getOutstockAmount();
@ -289,12 +309,12 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
BigDecimal updatedOutstockAmount = hadOutstockAmount.add(outstockAmount);
if (updatedOutstockAmount.compareTo(planOutstockAmount) > 0) {
throw new ServiceException("出库数量不能大于" + planOutstockAmount);
throw new ServiceException("出库数量不能大于" + planOutstockAmount.subtract(hadOutstockAmount));
}
wmsRawOutstockDetail.setOutstockAmount(updatedOutstockAmount);
String executeStatus = "";
if (updatedOutstockAmount.compareTo(planOutstockAmount) == 0) {
if (updatedOutstockAmount.compareTo(planOutstockAmount) == 0) {//如果已出完
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH;
//更新出库记录执行状态
this.updateRawOutstockDetailExecuteStatus(wmsRawOutstockDetail.getRawOutstockId(),
@ -318,9 +338,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
}
//更新原材料库存占用数量和总数量
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByLocationAndBatch(locationCode, instockBatch);
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByLocationAndBatch(locationCode, baseBarcodeInfo.getBatchCode());
if (wmsRawStock == null) {
throw new ServiceException("数据异常");
throw new ServiceException("没找到库存信息");
} else {
BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
@ -337,7 +357,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstockDetailMapper.updateWmsRawOutstockDetail(wmsRawOutstockDetail);
//todo 同步erp
return 1;
}
@ -407,10 +426,10 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
List<WmsRawOutstockDetail> toUpdatedRawOutstockDetails = new ArrayList<>();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
rawOutstockDetails.forEach(rawOutstockDetail->{
BigDecimal planAmount = rawOutstockDetail.getPlanAmount()==null?BigDecimal.ZERO:rawOutstockDetail.getPlanAmount();
rawOutstockDetails.forEach(rawOutstockDetail -> {
BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ? BigDecimal.ZERO : rawOutstockDetail.getPlanAmount();
Long materialId = rawOutstockDetail.getMaterialId();
if(planAmount.compareTo(BigDecimal.ZERO)>0){
if (planAmount.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal realRawStock = BigDecimal.ZERO;//实际库存总量
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setWarehouseId(warehouseId);
@ -488,15 +507,15 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
//出库要求 0申请出库1申请审核出库2直接出库
String outRequirement = warehouse.getOutRequirement();
String auditStatus = WmsConstants.WMS_AUDIT_STATUS_PASS;
if(outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT)){
if (outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT)) {
wmsRawOutstock.setAuditStatus(WmsConstants.RAW_OUTSTOCK_AUDIT_STATUS_TOAUDIT);
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
}else{
} else {
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
}
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType,Seq.rawOutstockSeqCode));
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
wmsRawOutstock.setStationId(SecurityUtils.getStationId());
wmsRawOutstock.setOperationType(operationType);
@ -525,6 +544,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
private WmsRawOutstockDetail getWmsRawOutstockDetail(WmsRawStock wmsRawStock, Long materialId,
BigDecimal availableAmount, Date currentDate, String userName, String outstockWay) {
WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail();
wmsRawOutstockDetail.setWarehouseId(wmsRawStock.getWarehouseId());
wmsRawOutstockDetail.setLocationCode(wmsRawStock.getLocationCode());
wmsRawOutstockDetail.setMaterialId(materialId);
wmsRawOutstockDetail.setInstockBatch(wmsRawStock.getInstockBatch());
@ -734,6 +754,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/**
*
*
* @param warehouseId
* @return
*/
@ -747,6 +768,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/**
* agv
*
* @param wmsAgvRawReturnVo
*/
public void agvReturn(WmsAgvRawReturnVo wmsAgvRawReturnVo) {
@ -756,4 +778,28 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
// WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAG_NO;
}
/**
* ,join warehouse
*
* @param wmsRawOutstock
* @return
*/
@Override
public List<WmsRawOutstock> selectWmsRawOutstockJoinList(WmsRawOutstock wmsRawOutstock) {
return wmsRawOutstockMapper.selectWmsRawOutstockJoinList(wmsRawOutstock);
}
/**
*
*
* @param wmsAssembleOutstockVo
* @return
*/
@Override
public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo) {
return 1;
}
}

@ -28,12 +28,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateDate" column="update_date" />
<result property="stackAmount" column="stack_amount" />
<result property="applyBy" column="apply_by" />
<result property="applyDate" column="apply_date" />
<result property="taskCode" column="task_code" />
<result property="taskType" column="task_type" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectWmsRawOutstockDetailVo">
select raw_outstock_detail_id, raw_outstock_id, location_code, material_barcode, material_id, instock_batch, material_production_Date, plan_amount, outstock_amount, execute_status, erp_status, outstock_person, outstock_time, outstock_way, machine_name, quality_status, create_by, create_date, update_by, update_date, stack_amount from wms_raw_outstock_detail
select raw_outstock_detail_id, raw_outstock_id, location_code, material_barcode, material_id, instock_batch, material_production_Date, plan_amount, outstock_amount, execute_status, erp_status, outstock_person, outstock_time, outstock_way, machine_name, quality_status, create_by, create_date, update_by, update_date, stack_amount from wms_raw_outstock_detail wrod
</sql>
<select id="selectWmsRawOutstockDetailList" parameterType="WmsRawOutstockDetail" resultMap="WmsRawOutstockDetailResult">
@ -41,13 +44,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="rawOutstockId != null "> and raw_outstock_id = #{rawOutstockId}</if>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="auditStatus != null and auditStatus != ''"> and exists (select 1 from wms_raw_outstock wro where wro.raw_outstock_id=wrod.raw_outstock_id and wro.audit_status=#{auditStatus})</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="instockBatch != null and instockBatch != ''"> and instock_batch = #{instockBatch}</if>
<if test="materialProductionDate != null "> and material_production_Date = #{materialProductionDate}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="outstockAmount != null "> and outstock_amount = #{outstockAmount}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="executeStatusStr != null and executeStatusStr != ''"> and execute_status in (${executeStatusStr})</if>
<if test="erpStatus != null and erpStatus != ''"> and erp_status = #{erpStatus}</if>
<if test="outstockPerson != null and outstockPerson != ''"> and outstock_person = #{outstockPerson}</if>
<if test="outstockTime != null "> and outstock_time = #{outstockTime}</if>
@ -56,7 +61,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityStatus != null and qualityStatus != ''"> and quality_status = #{qualityStatus}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="stackAmount != null "> and stack_amount = #{stackAmount}</if>
</where>
</select>
@ -164,11 +168,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAuditPassRawOutstockDetails" parameterType="WmsRawOutstockDetail" resultMap="WmsRawOutstockDetailResult">
select wrod.raw_outstock_detail_id, wrod.raw_outstock_id, wrod.location_code, wrod.material_barcode, wrod.material_id,
select wrod.raw_outstock_detail_id, wrod.raw_outstock_id, wrod.location_code, wrod.material_id,
wrod.instock_batch, wrod.material_production_date, wrod.plan_amount, wrod.outstock_amount,
wrod.execute_status, wrod.erp_status, wrod.outstock_person, wrod.outstock_time, wrod.outstock_way,
wrod.machine_name, wrod.quality_status,wro.task_code,wro.task_type,wro.apply_by from wms_raw_outstock_detail wrod
wrod.machine_name, wrod.quality_status,wro.task_code,wro.task_type,wro.apply_by,wro.apply_date,
mbmi.material_code,mbmi.material_name
from wms_raw_outstock_detail wrod
left join wms_raw_outstock wro on wrod.raw_outstock_id=wro.raw_outstock_id
left join mes_base_material_info mbmi on wrod.material_id=mbmi.material_id
<where>
wro.audit_status = '1' and wrod.execute_status!='2'

Loading…
Cancel
Save