WMS:PDA接口申请移库、PDA接口获取移库任务列表、PDA获取移库任务明细、PDA接口移库出库
master
xins 8 months ago
parent c98db88e02
commit 04ca4eb29c

@ -55,6 +55,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "托盘RFID代码")
private String palletInfoCode;
/**绑定的物料条码(用来拆分绑定使用)*/
private String bindBarcode;
/** 物料ID关联mes_base_material_info的material_id */
@Excel(name = "物料ID")
private Long materialId;
@ -231,6 +234,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return palletInfoCode;
}
public String getBindBarcode() {
return bindBarcode;
}
public void setBindBarcode(String bindBarcode) {
this.bindBarcode = bindBarcode;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;

@ -76,6 +76,7 @@ public class WmsConstants {
public static final String WMS_EXECUTE_STATUS_EXECUTING = "1";//执行中
public static final String WMS_EXECUTE_STATUS_FINISH = "2";//完成执行
public static final String WMS_EXECUTE_STATUS_NOT_FINISH = "notFinish";//未完成执行
@ -111,10 +112,18 @@ public class WmsConstants {
public static final String WMS_WAREHOUSE_INSTOCK_TYPE_PRODUCT = "3";//成品
/**移库类型*/
public static final String WMS_MOVEMERGE_TYPE_MOVE = "1"; //移库
public static final String WMS_MOVEMERGE_TYPE_MERGE = "2";//合库
/**移库方式*/
public static final String WMS_MOVEMERGE_WAY_MANUAL = "1"; //人工移库
public static final String WMS_MOVEMERGE_WAY_AGV = "2";//agv移库
public static final String WMS_MOVE_DETAIL_TYPE_OUT = "1";//出库
public static final String WMS_MOVE_DETAIL_TYPE_IN = "2";//入库
public static final String WMS_WAREHOUSE_TYPE_NORMAL = "1";//普通仓库
public static final String WMS_WAREHOUSE_TYPE_AGV = "2";//AGV仓库
public static final String WMS_WAREHOUSE_TYPE_WORKBIN_AGV = "3";//料箱AGV仓库
@ -206,4 +215,15 @@ public class WmsConstants {
public static final String WMS_RAW_STOCK_COMPLETE_FLAY_YES = "1";//完整
public static final String WMS_RAW_STOCK_COMPLETE_FLAY_NO = "0";//拆分后的
/*移库记录(明细)执行状态*/
public static final String WMS_MOVE_EXECUTE_STATUS_TOEXECUTE = "0";//待执行
public static final String WMS_MOVE_EXECUTE_STATUS_EXECUTING = "1";//执行中
public static final String WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH = "2";//入库完成
public static final String WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH = "3";//出库完成
}

@ -0,0 +1,56 @@
package com.hw.common.core.utils;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.Locale;
/**
* @Description:Mac
* @ProjectName:HwMes
* @Author:xins
* @Date:2024-03-25 13:18
* @Version:1.0
*/
public class MacUtils {
/**
* MAC
* @return
*/
public static String getLocalMac(){
StringBuilder mac = new StringBuilder("");
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()){
NetworkInterface networkInterface = networkInterfaces.nextElement();
//过滤其他网卡
if (networkInterface.isVirtual()||networkInterface.isLoopback()||networkInterface.isPointToPoint() || !networkInterface.isUp()){
continue;
}
String displayName = networkInterface.getDisplayName();
if (displayName.contains("VMware Virtual")){
continue;
}
//获取解析网关
byte[] hardwareAddress = networkInterface.getHardwareAddress();
for(int i=0; i<hardwareAddress.length; i++) {
if(i!=0) {
mac.append("-");
}
//字节转换为整数
int temp = hardwareAddress[i]&0xff;
String str = Integer.toHexString(temp);
if(str.length()==1) {
mac.append("0").append(str);
}else {
mac.append(str);
}
}
break;
}
} catch (SocketException e) {
e.printStackTrace();
}
return String.valueOf(mac).toUpperCase(Locale.ROOT);
}
}

@ -32,6 +32,15 @@ public class Seq {
private static AtomicInteger productOutstockSeq = new AtomicInteger(1);
// 成品出库记录标识
public static final String productInstockCode = "PI";
// 成品入库记录序列类型
public static final String productInstockSeqType = "PRODUCTINSTOCK";
// 成品入库记录接口序列数
private static AtomicInteger productInstockSeq = new AtomicInteger(1);
// 成品入库记录标识
public static final String productOutstockCode = "PO";
@ -99,13 +108,13 @@ public class Seq {
// 生产批次代码标识
public static final String mesBatchCodeCode = "PC";
// 原材料条码内容记录标识
// 条码内容记录标识
public static final String mesBarcodeSeqType = "BAR_CODE";
// 原材料条码内容序列数
// 条码内容序列数
private static AtomicInteger mesBarcodeSeq = new AtomicInteger(1);
// 原材料条码内容标识
// 条码内容标识
public static final String mesBarcodeCode = "TM";
// 成品条码内容记录标识
@ -183,6 +192,26 @@ public class Seq {
public static final String lubeInstanceCode = "LI";
// 物料移库记录序列类型
public static final String wmsMoveSeqType = "WMSMOVE";
// 物料移库记录接口序列数
private static AtomicInteger wmsMoveSeq = new AtomicInteger(1);
// 物料移库记录标识
public static final String wmsMoveSeqCode = "MO";
// 物料合库记录序列类型
public static final String wmsMergeSeqType = "WMSMERGE";
// 物料合库记录接口序列数
private static AtomicInteger wmsMergeSeq = new AtomicInteger(1);
// 物料合库记录标识
public static final String wmsMergeSeqCode = "ME";
/**
*
*
@ -277,6 +306,12 @@ public class Seq {
atomicInt = lubeInstanceSeq;
}else if(mesCompBarcodeSeqType.equals(type)) {
atomicInt = mesCompBarcodeSeq;
}else if(productInstockSeqType.equals(type)) {
atomicInt = productInstockSeq;
}else if(wmsMoveSeqType.equals(type)) {
atomicInt = wmsMoveSeq;
}else if(wmsMergeSeqType.equals(type)) {
atomicInt = wmsMergeSeq;
}
return getId(atomicInt, 3, code);
}

@ -108,4 +108,15 @@ public enum BusinessType
*/
COMPLETE,
/**
*
*/
OUTSTOCK,
/**
*
*/
INSTOCK,
}

@ -0,0 +1,42 @@
package com.hw.wms.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @Description:
* @ClassName: StationConfig
* @Author : xins
* @Date :2024-03-25 8:53
* @Version :1.0
*/
@Configuration
@ConfigurationProperties(prefix = "wms")
public class WmsConfig
{
/**
*
*/
private String fifthAssembleStationCode;
/**
* ID
*/
private Long fifthSemiWarehouseId;
public String getFifthAssembleStationCode() {
return fifthAssembleStationCode;
}
public void setFifthAssembleStationCode(String fifthAssembleStationCode) {
this.fifthAssembleStationCode = fifthAssembleStationCode;
}
public Long getFifthSemiWarehouseId() {
return fifthSemiWarehouseId;
}
public void setFifthSemiWarehouseId(Long fifthSemiWarehouseId) {
this.fifthSemiWarehouseId = fifthSemiWarehouseId;
}
}

@ -49,7 +49,7 @@ public class WmsMobileController extends BaseController {
private IWmsProductOutstockDetailService wmsProductOutstockDetailService;
@Autowired
private IWmsMoveMergeService wmsMoveMergeService;
private IWmsMoveService wmsMoveService;
@Autowired
private IWmsTransferService wmsTransferService;
@ -378,7 +378,8 @@ public class WmsMobileController extends BaseController {
*/
@Log(title = "成品出库确认", businessType = BusinessType.UPDATE)
@PostMapping(("/finalConfirmProductOutstock"))
public AjaxResult finalConfirmProductOutstock(@RequestBody WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo) {
public AjaxResult finalConfirmProductOutstock(@RequestBody @Validated WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo) {
wmsProductOutstockService.finalConfirmProductOutstock(wmsProductOutstockConfirmVo);
return toAjax(1);
}
@ -403,13 +404,69 @@ public class WmsMobileController extends BaseController {
}
//todo入库时校验warehousematerial,入库出库需要校验库位状态,是否是移库合库锁定等
/**
*
*/
@Log(title = "人工移库", businessType = BusinessType.APPLY)
@PostMapping(("/applyMove"))
public AjaxResult applyMove(@Validated @RequestBody WmsMove wmsMove) {
return toAjax(wmsMoveService.applyMove(wmsMove));
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getMoveList")
public TableDataInfo getMoveList(WmsMove wmsMove) {
startPage();
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
List<WmsMove> wmsMoves = wmsMoveService.selectWmsMoveJoinList(wmsMove);
return getDataTable(wmsMoves);
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getMoveDetail/{moveId}")
public AjaxResult getMoveDetail(@PathVariable("moveId") Long moveId) {
WmsMoveDetail queryMoveDetail = new WmsMoveDetail();
queryMoveDetail.setMoveId(moveId);
List<WmsMoveDetail> wmsMoveDetailList = wmsMoveService.selectWmsMoveDetailJoinList(queryMoveDetail);
return success(wmsMoveDetailList);
}
/**
*
*/
@Log(title = "人工移库", businessType = BusinessType.OUTSTOCK)
@PostMapping(("/moveOutstock"))
public AjaxResult moveOutstock(@Validated @RequestBody WmsMoveVo wmsMoveVo) {
return toAjax(wmsMoveService.moveOutstock(wmsMoveVo));
}
/**
*
*
*/
@Log(title = "人工移库", businessType = BusinessType.INSERT)
@PostMapping(("/moveRaw"))
public AjaxResult moveRaw(@Validated @RequestBody WmsMoveMergeVo wmsMoveMergeVo) {
return toAjax(wmsMoveMergeService.manualMove(wmsMoveMergeVo, WmsConstants.WMS_MOVEMERGE_TYPE_MOVE));
@Log(title = "人工移库", businessType = BusinessType.INSTOCK)
@PostMapping(("/moveInstock"))
public AjaxResult moveInstock(@Validated @RequestBody WmsMoveVo wmsMoveVo) {
return toAjax(wmsMoveService.moveInstock(wmsMoveVo));
}
}

@ -10,7 +10,7 @@ import com.hw.common.core.web.domain.BaseEntity;
/**
* wms_move
*
*
* @author xins
* @date 2024-01-09
*/
@ -98,177 +98,180 @@ public class WmsMove extends BaseEntity
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
private String warehouseName;
/** 移库合库记录明细;原材料入库记录对应的明细信息信息 */
private List<WmsMoveDetail> wmsMoveDetailList;
public void setMoveId(Long moveId)
public void setMoveId(Long moveId)
{
this.moveId = moveId;
}
public Long getMoveId()
public Long getMoveId()
{
return moveId;
}
public void setTaskCode(String taskCode)
public void setTaskCode(String taskCode)
{
this.taskCode = taskCode;
}
public String getTaskCode()
public String getTaskCode()
{
return taskCode;
}
public void setWarehouseId(Long warehouseId)
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
public Long getWarehouseId()
{
return warehouseId;
}
public void setOriLocationCode(String oriLocationCode)
public void setOriLocationCode(String oriLocationCode)
{
this.oriLocationCode = oriLocationCode;
}
public String getOriLocationCode()
public String getOriLocationCode()
{
return oriLocationCode;
}
public void setTargetLocationCode(String targetLocationCode)
public void setTargetLocationCode(String targetLocationCode)
{
this.targetLocationCode = targetLocationCode;
}
public String getTargetLocationCode()
public String getTargetLocationCode()
{
return targetLocationCode;
}
public void setOperationType(String operationType)
public void setOperationType(String operationType)
{
this.operationType = operationType;
}
public String getOperationType()
public String getOperationType()
{
return operationType;
}
public void setMoveWay(String moveWay)
public void setMoveWay(String moveWay)
{
this.moveWay = moveWay;
}
public String getMoveWay()
public String getMoveWay()
{
return moveWay;
}
public void setMoveType(String moveType)
public void setMoveType(String moveType)
{
this.moveType = moveType;
}
public String getMoveType()
public String getMoveType()
{
return moveType;
}
public void setApplyReason(String applyReason)
public void setApplyReason(String applyReason)
{
this.applyReason = applyReason;
}
public String getApplyReason()
public String getApplyReason()
{
return applyReason;
}
public void setAuditReason(String auditReason)
public void setAuditReason(String auditReason)
{
this.auditReason = auditReason;
}
public String getAuditReason()
public String getAuditReason()
{
return auditReason;
}
public void setAuditStatus(String auditStatus)
public void setAuditStatus(String auditStatus)
{
this.auditStatus = auditStatus;
}
public String getAuditStatus()
public String getAuditStatus()
{
return auditStatus;
}
public void setExecuteStatus(String executeStatus)
public void setExecuteStatus(String executeStatus)
{
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
public String getExecuteStatus()
{
return executeStatus;
}
public void setApplyBy(String applyBy)
public void setApplyBy(String applyBy)
{
this.applyBy = applyBy;
}
public String getApplyBy()
public String getApplyBy()
{
return applyBy;
}
public void setApplyDate(Date applyDate)
public void setApplyDate(Date applyDate)
{
this.applyDate = applyDate;
}
public Date getApplyDate()
public Date getApplyDate()
{
return applyDate;
}
public void setAuditBy(String auditBy)
public void setAuditBy(String auditBy)
{
this.auditBy = auditBy;
}
public String getAuditBy()
public String getAuditBy()
{
return auditBy;
}
public void setAuditDate(Date auditDate)
public void setAuditDate(Date auditDate)
{
this.auditDate = auditDate;
}
public Date getAuditDate()
public Date getAuditDate()
{
return auditDate;
}
public void setUpdateDate(Date updateDate)
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
public Date getUpdateDate()
{
return updateDate;
}
public void setBeginTime(Date beginTime)
public void setBeginTime(Date beginTime)
{
this.beginTime = beginTime;
}
public Date getBeginTime()
public Date getBeginTime()
{
return beginTime;
}
public void setEndTime(Date endTime)
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
public Date getEndTime()
{
return endTime;
}
@ -283,6 +286,15 @@ public class WmsMove extends BaseEntity
this.wmsMoveDetailList = wmsMoveDetailList;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -10,7 +10,7 @@ import com.hw.common.core.web.domain.BaseEntity;
/**
* ; wms_move_detail
*
*
* @author xins
* @date 2024-01-09
*/
@ -25,10 +25,6 @@ public class WmsMoveDetail extends BaseEntity
@Excel(name = "移库ID关联移库合库记录主键")
private Long moveId;
/** 库位编码 */
@Excel(name = "库位编码")
private String locationCode;
/** 存放物料条码,入库扫描条码时从打印条码记录表中获取关联条码信息的barcode_info */
@Excel(name = "存放物料条码,入库扫描条码时从打印条码记录表中获取关联条码信息的barcode_info")
private String materialBarcode;
@ -41,14 +37,21 @@ public class WmsMoveDetail extends BaseEntity
@Excel(name = "物料ID")
private Long materialId;
private String locationCode;
/** 计划数量 */
@Excel(name = "计划数量")
private BigDecimal planAmount;
/** 实际数量 */
@Excel(name = "实际数量")
/** 实际出库数量 */
@Excel(name = "实际出库数量")
private BigDecimal realAmount;
/** 实际入库数量 */
@Excel(name = "实际入库数量")
private BigDecimal realInstockAmount;
/** 执行状态(0待执行,1执行中,2执行完成) */
@Excel(name = "执行状态(0待执行,1执行中,2执行完成)")
private String executeStatus;
@ -62,9 +65,11 @@ public class WmsMoveDetail extends BaseEntity
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date executeTime;
/** 移库明细类型(1出库2入库) */
@Excel(name = "移库明细类型(1出库2入库)")
private String moveDetailType;
/** 执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date executeEndTime;
/** 使用机台名称;入库扫描条码时,从打印条码记录表中获取 */
@Excel(name = "使用机台名称;入库扫描条码时,从打印条码记录表中获取")
@ -84,157 +89,199 @@ public class WmsMoveDetail extends BaseEntity
@Excel(name = "有效标记")
private String activeFlag;
public void setMoveDetailId(Long moveDetailId)
private String materialName;
/**移库合库记录执行状态*/
private String moveExecuteStatus;
/**移库合库记录执行状态,多个值使用*/
private String moveExecuteStatusStr;
public void setMoveDetailId(Long moveDetailId)
{
this.moveDetailId = moveDetailId;
}
public Long getMoveDetailId()
public Long getMoveDetailId()
{
return moveDetailId;
}
public void setMoveId(Long moveId)
public void setMoveId(Long moveId)
{
this.moveId = moveId;
}
public Long getMoveId()
public Long getMoveId()
{
return moveId;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
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 setInstockBatch(String instockBatch)
public void setInstockBatch(String instockBatch)
{
this.instockBatch = instockBatch;
}
public String getInstockBatch()
public String getInstockBatch()
{
return instockBatch;
}
public void setMaterialId(Long materialId)
public String getLocationCode() {
return locationCode;
}
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
public Long getMaterialId()
{
return materialId;
}
public void setPlanAmount(BigDecimal planAmount)
public void setPlanAmount(BigDecimal planAmount)
{
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount()
public BigDecimal getPlanAmount()
{
return planAmount;
}
public void setRealAmount(BigDecimal realAmount)
public void setRealAmount(BigDecimal realAmount)
{
this.realAmount = realAmount;
}
public BigDecimal getRealAmount()
public BigDecimal getRealAmount()
{
return realAmount;
}
public void setExecuteStatus(String executeStatus)
public BigDecimal getRealInstockAmount() {
return realInstockAmount;
}
public void setRealInstockAmount(BigDecimal realInstockAmount) {
this.realInstockAmount = realInstockAmount;
}
public void setExecuteStatus(String executeStatus)
{
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
public String getExecuteStatus()
{
return executeStatus;
}
public void setExecutePerson(String executePerson)
public void setExecutePerson(String executePerson)
{
this.executePerson = executePerson;
}
public String getExecutePerson()
public String getExecutePerson()
{
return executePerson;
}
public void setExecuteTime(Date executeTime)
public void setExecuteTime(Date executeTime)
{
this.executeTime = executeTime;
}
public Date getExecuteTime()
public Date getExecuteTime()
{
return executeTime;
}
public void setMoveDetailType(String moveDetailType)
{
this.moveDetailType = moveDetailType;
public Date getExecuteEndTime() {
return executeEndTime;
}
public String getMoveDetailType()
{
return moveDetailType;
public void setExecuteEndTime(Date executeEndTime) {
this.executeEndTime = executeEndTime;
}
public void setMachineName(String machineName)
public void setMachineName(String machineName)
{
this.machineName = machineName;
}
public String getMachineName()
public String getMachineName()
{
return machineName;
}
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 getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMoveExecuteStatus() {
return moveExecuteStatus;
}
public void setMoveExecuteStatus(String moveExecuteStatus) {
this.moveExecuteStatus = moveExecuteStatus;
}
public String getMoveExecuteStatusStr() {
return moveExecuteStatusStr;
}
public void setMoveExecuteStatusStr(String moveExecuteStatusStr) {
this.moveExecuteStatusStr = moveExecuteStatusStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("moveDetailId", getMoveDetailId())
.append("moveId", getMoveId())
.append("locationCode", getLocationCode())
.append("materialBarcode", getMaterialBarcode())
.append("instockBatch", getInstockBatch())
.append("materialId", getMaterialId())
@ -243,7 +290,6 @@ public class WmsMoveDetail extends BaseEntity
.append("executeStatus", getExecuteStatus())
.append("executePerson", getExecutePerson())
.append("executeTime", getExecuteTime())
.append("moveDetailType", getMoveDetailType())
.append("machineName", getMachineName())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())

@ -1,5 +1,6 @@
package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
@ -71,6 +72,22 @@ public class WmsProductInstock extends BaseEntity {
@Excel(name = "入库类型(1生产入库,2移库入库,3合库入库,4出半成品库,9其他入库)")
private String instockType;
/** 成品ID */
@Excel(name = "成品ID")
private Long productId;
/** 成品批次,等于成品条码 */
@Excel(name = "成品批次,等于成品条码")
private String productBatch;
/** 入库数量 */
@Excel(name = "入库数量")
private BigDecimal instockAmount;
/** 托盘RFID代码 */
@Excel(name = "托盘RFID代码")
private String palletInfoCode;
/**
*
*/
@ -219,6 +236,38 @@ public class WmsProductInstock extends BaseEntity {
return instockType;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductBatch() {
return productBatch;
}
public void setProductBatch(String productBatch) {
this.productBatch = productBatch;
}
public BigDecimal getInstockAmount() {
return instockAmount;
}
public void setInstockAmount(BigDecimal instockAmount) {
this.instockAmount = instockAmount;
}
public String getPalletInfoCode() {
return palletInfoCode;
}
public void setPalletInfoCode(String palletInfoCode) {
this.palletInfoCode = palletInfoCode;
}
public void setApplyReason(String applyReason) {
this.applyReason = applyReason;
}

@ -1,5 +1,6 @@
package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
@ -44,7 +45,7 @@ public class WmsRawOutstock extends BaseEntity {
/**
* ID,pd_base_order_infoorder_id
*/
@Excel(name = "工单ID,关联pd_base_order_info的order_id")
@Excel(name = "销售订单ID")
private Long orderId;
/**
@ -71,6 +72,22 @@ public class WmsRawOutstock extends BaseEntity {
@Excel(name = "成品ID,关联物料表物料id")
private Long productId;
/** 物料批次 */
@Excel(name = "物料条码")
private String materialBatch;
/** 托盘RFID代码 */
@Excel(name = "托盘RFID代码")
private String palletInfoCode;
/** 出库数量 */
@Excel(name = "出库数量")
private BigDecimal outstockAmount;
/** 出库目的地 */
@Excel(name = "出库目的地")
private String endStationCode;
/**
* (0,1,2,3)
*/
@ -233,6 +250,38 @@ public class WmsRawOutstock extends BaseEntity {
return productId;
}
public String getMaterialBatch() {
return materialBatch;
}
public void setMaterialBatch(String materialBatch) {
this.materialBatch = materialBatch;
}
public String getPalletInfoCode() {
return palletInfoCode;
}
public void setPalletInfoCode(String palletInfoCode) {
this.palletInfoCode = palletInfoCode;
}
public BigDecimal getOutstockAmount() {
return outstockAmount;
}
public void setOutstockAmount(BigDecimal outstockAmount) {
this.outstockAmount = outstockAmount;
}
public String getEndStationCode() {
return endStationCode;
}
public void setEndStationCode(String endStationCode) {
this.endStationCode = endStationCode;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}

@ -1,21 +0,0 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class WmsMoveMergeVo {
//仓库ID
@NotNull(message="仓库ID必须输入")
private Long warehouseId;
@NotBlank(message="原库位必须输入")
private String oriLocationCode;
@NotBlank(message="目标库位必须输入")
private String targetLocationCode;
}

@ -0,0 +1,36 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Description: VO
* @ClassName: WmsMoveMergeVo
* @Author : xins
* @Date :2024-03-25 9:58
* @Version :1.0
*/
@Data
public class WmsMoveVo {
@NotBlank(message="库位编码必须输入")
private String locationCode;
@NotBlank(message="物料条码必须输入")
private String materialBarcode;
//数量
@NotNull(message="数量必须输入")
private BigDecimal applyQty;
//数量
@NotNull(message="moveId必须输入")
private Long moveId;
@NotBlank(message="类型必须输入")
private String moveType;
}

@ -0,0 +1,85 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsMoveDetail;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author xins
* @date 2024-03-25
*/
public interface WmsMoveDetailMapper
{
/**
*
*
* @param moveDetailId
* @return
*/
public WmsMoveDetail selectWmsMoveDetailByMoveDetailId(Long moveDetailId);
/**
*
*
* @param wmsMoveDetail
* @return
*/
public List<WmsMoveDetail> selectWmsMoveDetailList(WmsMoveDetail wmsMoveDetail);
/**
*
*
* @param wmsMoveDetail
* @return
*/
public int insertWmsMoveDetail(WmsMoveDetail wmsMoveDetail);
/**
*
*
* @param wmsMoveDetail
* @return
*/
public int updateWmsMoveDetail(WmsMoveDetail wmsMoveDetail);
/**
*
*
* @param moveDetailId
* @return
*/
public int deleteWmsMoveDetailByMoveDetailId(Long moveDetailId);
/**
*
*
* @param moveDetailIds
* @return
*/
public int deleteWmsMoveDetailByMoveDetailIds(Long[] moveDetailIds);
/**
*
*
* @param moveId
* @param batchCode
* @return
*/
public WmsMoveDetail selectWmsMoveDetailByMoveIdAndBatchCode(@Param("moveId") Long moveId,
@Param("batchCode") String batchCode);
/**
* ,join material
*
* @param wmsMoveDetail
* @return
*/
public List<WmsMoveDetail> selectWmsMoveDetailJoinList(WmsMoveDetail wmsMoveDetail);
}

@ -6,15 +6,15 @@ import com.hw.wms.domain.WmsMoveDetail;
/**
* Mapper
*
*
* @author xins
* @date 2024-01-09
*/
public interface WmsMoveMapper
public interface WmsMoveMapper
{
/**
*
*
*
* @param moveId
* @return
*/
@ -22,7 +22,7 @@ public interface WmsMoveMapper
/**
*
*
*
* @param wmsMove
* @return
*/
@ -30,7 +30,7 @@ public interface WmsMoveMapper
/**
*
*
*
* @param wmsMove
* @return
*/
@ -38,7 +38,7 @@ public interface WmsMoveMapper
/**
*
*
*
* @param wmsMove
* @return
*/
@ -46,7 +46,7 @@ public interface WmsMoveMapper
/**
*
*
*
* @param moveId
* @return
*/
@ -54,7 +54,7 @@ public interface WmsMoveMapper
/**
*
*
*
* @param moveIds
* @return
*/
@ -62,26 +62,39 @@ public interface WmsMoveMapper
/**
* ;
*
*
* @param moveIds
* @return
*/
public int deleteWmsMoveDetailByMoveIds(Long[] moveIds);
/**
* ;
*
*
* @param wmsMoveDetailList ;
* @return
*/
public int batchWmsMoveDetail(List<WmsMoveDetail> wmsMoveDetailList);
/**
* ;
*
*
* @param moveId ID
* @return
*/
public int deleteWmsMoveDetailByMoveId(Long moveId);
/**
* Join warehouse
*
* @param wmsMove
* @return
*/
public List<WmsMove> selectWmsMoveJoinList(WmsMove wmsMove);
}

@ -1,6 +1,6 @@
package com.hw.wms.service;
import com.hw.wms.domain.vo.WmsMoveMergeVo;
import com.hw.wms.domain.vo.WmsMoveVo;
/**
* @Description: Service
@ -16,5 +16,5 @@ public interface IWmsMoveMergeService {
* @param wmsMoveMergeVo
* @return
*/
public int manualMove(WmsMoveMergeVo wmsMoveMergeVo, String manualMergeType);
public int manualMove(WmsMoveVo wmsMoveMergeVo, String manualMergeType);
}

@ -2,18 +2,20 @@ package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsMove;
import com.hw.wms.domain.WmsMoveDetail;
import com.hw.wms.domain.vo.WmsMoveVo;
/**
* Service
*
*
* @author xins
* @date 2024-01-09
*/
public interface IWmsMoveService
public interface IWmsMoveService
{
/**
*
*
*
* @param moveId
* @return
*/
@ -21,7 +23,7 @@ public interface IWmsMoveService
/**
*
*
*
* @param wmsMove
* @return
*/
@ -29,7 +31,7 @@ public interface IWmsMoveService
/**
*
*
*
* @param wmsMove
* @return
*/
@ -37,7 +39,7 @@ public interface IWmsMoveService
/**
*
*
*
* @param wmsMove
* @return
*/
@ -45,7 +47,7 @@ public interface IWmsMoveService
/**
*
*
*
* @param moveIds
* @return
*/
@ -53,9 +55,51 @@ public interface IWmsMoveService
/**
*
*
*
* @param moveId
* @return
*/
public int deleteWmsMoveByMoveId(Long moveId);
/**
* Join warehouse
*
* @param wmsMove
* @return
*/
public List<WmsMove> selectWmsMoveJoinList(WmsMove wmsMove);
/**
*
* @param wmsMove
* @return
*/
public int applyMove(WmsMove wmsMove);
/**
* join material
* @param wmsMoveDetail
* @return
*/
public List<WmsMoveDetail> selectWmsMoveDetailJoinList(WmsMoveDetail wmsMoveDetail);
/**
*
* @param wmsMoveVo
* @return
*/
public int moveOutstock(WmsMoveVo wmsMoveVo);
/**
*
* @param wmsMoveVo
* @return
*/
public int moveInstock(WmsMoveVo wmsMoveVo);
}

@ -2,6 +2,7 @@ package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsProductOutstock;
import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo;
/**
* Service
@ -74,4 +75,12 @@ public interface IWmsProductOutstockService
* @return
*/
public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId);
/**
*
* @param wmsProductOutstockConfirmVo
* @return
*/
public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo);
}

@ -1,10 +1,8 @@
package com.hw.wms.service.impl;
import com.hw.common.core.constant.WmsConstants;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.domain.WmsRawStock;
import com.hw.wms.domain.vo.WmsMoveMergeVo;
import com.hw.wms.domain.vo.WmsMoveVo;
import com.hw.wms.mapper.*;
import com.hw.wms.service.IWmsMoveMergeService;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,12 +45,12 @@ public class WmsMoveMergeServiceImpl implements IWmsMoveMergeService {
* @return
*/
@Override
public int manualMove(WmsMoveMergeVo wmsMoveMergeVo,String manualMergeType){
Long warehouseId = wmsMoveMergeVo.getWarehouseId();
String oriLocationCode = wmsMoveMergeVo.getOriLocationCode();
String targetLocationCode = wmsMoveMergeVo.getTargetLocationCode();
WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseWithLocationByWarehouseId(warehouseId);
String warehouseInstockType = warehouse.getWarehouseInstockType();
public int manualMove(WmsMoveVo wmsMoveMergeVo, String manualMergeType){
// Long warehouseId = wmsMoveMergeVo.getWarehouseId();
// String oriLocationCode = wmsMoveMergeVo.getOriLocationCode();
// String targetLocationCode = wmsMoveMergeVo.getTargetLocationCode();
// WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseWithLocationByWarehouseId(warehouseId);
// String warehouseInstockType = warehouse.getWarehouseInstockType();
//仓库类型为人工仓库
@ -77,12 +75,12 @@ public class WmsMoveMergeServiceImpl implements IWmsMoveMergeService {
* @param wmsMoveMergeVo
* @return
*/
public int manualMerge(WmsMoveMergeVo wmsMoveMergeVo){
Long warehouseId = wmsMoveMergeVo.getWarehouseId();
String oriLocationCode = wmsMoveMergeVo.getOriLocationCode();
String targetLocationCode = wmsMoveMergeVo.getTargetLocationCode();
WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseWithLocationByWarehouseId(warehouseId);
String warehouseInstockType = warehouse.getWarehouseInstockType();
public int manualMerge(WmsMoveVo wmsMoveMergeVo){
// Long warehouseId = wmsMoveMergeVo.getWarehouseId();
// String oriLocationCode = wmsMoveMergeVo.getOriLocationCode();
// String targetLocationCode = wmsMoveMergeVo.getTargetLocationCode();
// WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseWithLocationByWarehouseId(warehouseId);
// String warehouseInstockType = warehouse.getWarehouseInstockType();
return 1;

@ -1,62 +1,95 @@
package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
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;
import com.hw.common.core.exception.ServiceException;
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.wms.domain.*;
import com.hw.wms.domain.vo.WmsMoveVo;
import com.hw.wms.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.wms.domain.WmsMoveDetail;
import com.hw.wms.mapper.WmsMoveMapper;
import com.hw.wms.domain.WmsMove;
import com.hw.wms.service.IWmsMoveService;
import javax.annotation.Resource;
/**
* Service
*
*
* @author xins
* @date 2024-01-09
*/
@Service
public class WmsMoveServiceImpl implements IWmsMoveService
{
public class WmsMoveServiceImpl implements IWmsMoveService {
@Autowired
private WmsMoveMapper wmsMoveMapper;
@Autowired
private WmsMoveDetailMapper wmsMoveDetailMapper;
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsBaseWarehouseMapper wmsBaseWarehouseMapper;
@Autowired
private WmsRawStockMapper wmsRawStockMapper;
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Resource
private RemoteMesService remoteMesService;
/**
*
*
*
* @param moveId
* @return
*/
@Override
public WmsMove selectWmsMoveByMoveId(Long moveId)
{
public WmsMove selectWmsMoveByMoveId(Long moveId) {
return wmsMoveMapper.selectWmsMoveByMoveId(moveId);
}
/**
*
*
*
* @param wmsMove
* @return
*/
@Override
public List<WmsMove> selectWmsMoveList(WmsMove wmsMove)
{
public List<WmsMove> selectWmsMoveList(WmsMove wmsMove) {
return wmsMoveMapper.selectWmsMoveList(wmsMove);
}
/**
*
*
*
* @param wmsMove
* @return
*/
@Transactional
@Override
public int insertWmsMove(WmsMove wmsMove)
{
public int insertWmsMove(WmsMove wmsMove) {
int rows = wmsMoveMapper.insertWmsMove(wmsMove);
insertWmsMoveDetail(wmsMove);
return rows;
@ -64,14 +97,13 @@ public class WmsMoveServiceImpl implements IWmsMoveService
/**
*
*
*
* @param wmsMove
* @return
*/
@Transactional
@Override
public int updateWmsMove(WmsMove wmsMove)
{
public int updateWmsMove(WmsMove wmsMove) {
wmsMoveMapper.deleteWmsMoveDetailByMoveId(wmsMove.getMoveId());
insertWmsMoveDetail(wmsMove);
return wmsMoveMapper.updateWmsMove(wmsMove);
@ -79,53 +111,647 @@ public class WmsMoveServiceImpl implements IWmsMoveService
/**
*
*
*
* @param moveIds
* @return
*/
@Transactional
@Override
public int deleteWmsMoveByMoveIds(Long[] moveIds)
{
public int deleteWmsMoveByMoveIds(Long[] moveIds) {
wmsMoveMapper.deleteWmsMoveDetailByMoveIds(moveIds);
return wmsMoveMapper.deleteWmsMoveByMoveIds(moveIds);
}
/**
*
*
*
* @param moveId
* @return
*/
@Transactional
@Override
public int deleteWmsMoveByMoveId(Long moveId)
{
public int deleteWmsMoveByMoveId(Long moveId) {
wmsMoveMapper.deleteWmsMoveDetailByMoveId(moveId);
return wmsMoveMapper.deleteWmsMoveByMoveId(moveId);
}
/**
* ;
*
*
* @param wmsMove
*/
public void insertWmsMoveDetail(WmsMove wmsMove)
{
public void insertWmsMoveDetail(WmsMove wmsMove) {
List<WmsMoveDetail> wmsMoveDetailList = wmsMove.getWmsMoveDetailList();
Long moveId = wmsMove.getMoveId();
if (StringUtils.isNotNull(wmsMoveDetailList))
{
if (StringUtils.isNotNull(wmsMoveDetailList)) {
List<WmsMoveDetail> list = new ArrayList<WmsMoveDetail>();
for (WmsMoveDetail wmsMoveDetail : wmsMoveDetailList)
{
for (WmsMoveDetail wmsMoveDetail : wmsMoveDetailList) {
wmsMoveDetail.setMoveId(moveId);
list.add(wmsMoveDetail);
}
if (list.size() > 0)
{
if (list.size() > 0) {
wmsMoveMapper.batchWmsMoveDetail(list);
}
}
}
/**
* Join warehouse
*
* @param wmsMove
* @return
*/
@Override
public List<WmsMove> selectWmsMoveJoinList(WmsMove wmsMove) {
return wmsMoveMapper.selectWmsMoveJoinList(wmsMove);
}
/**
*
*
* @param wmsMove
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int applyMove(WmsMove wmsMove) {
String oriLocationCode = wmsMove.getOriLocationCode();
String targetLocationCode = wmsMove.getTargetLocationCode();
if (oriLocationCode.equals(targetLocationCode)) {
throw new ServiceException("原库位与目标库位不能相同");
}
WmsBaseLocation oriLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(oriLocationCode);
if (oriLocation == null) {
throw new ServiceException("原库位不存在");
}
String oriLocationStatus = oriLocation.getLocationStatus();
if (!oriLocationStatus.equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException("原库位已经锁定,不能进行移库");
}
WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode);
if (targetLocation == null) {
throw new ServiceException("目标库位不存在");
}
String targetLocationStatus = targetLocation.getLocationStatus();
if (!targetLocationStatus.equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException("目标库位已经锁定,不能进行移库");
}
if (!oriLocation.getWarehouseId().equals(targetLocation.getWarehouseId())) {
throw new ServiceException("原库位和目标库位需为一个仓库");
}
WmsBaseWarehouse baseWareHouse = wmsBaseWarehouseMapper.
selectWmsBaseWarehouseByWarehouseId(wmsMove.getWarehouseId());
String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
List<WmsMoveDetail> toInsertedMoveDetails = new ArrayList<>();
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {//如果是原材料
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(oriLocationCode);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks == null || wmsRawStocks.isEmpty()) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
List<WmsRawStock> occupyRawStocks = wmsRawStocks.stream().filter
(e -> (e.getOccupyAmount().compareTo(BigDecimal.ZERO) > 0 || e.getFrozenAmount().compareTo(BigDecimal.ZERO) > 0))
.collect(Collectors.toList());
if (occupyRawStocks != null && !occupyRawStocks.isEmpty()) {
throw new ServiceException("原库位有占用库存信息,不能进行移库");
}
//目标库位需要是空库位
WmsRawStock queryTargetRawStock = new WmsRawStock();
queryTargetRawStock.setLocationCode(targetLocationCode);
List<WmsRawStock> targetRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryTargetRawStock);
if (targetRawStocks != null && !targetRawStocks.isEmpty()) {
throw new ServiceException("目标库位有库存,不能进行移库");
}
toInsertedMoveDetails = getMoveDetailsByRawStocks(wmsRawStocks);
} else {//如果是成品
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setLocationCode(oriLocationCode);
List<WmsProductStock> productStocks = wmsProductStockMapper.selectWmsProductStockInList(queryProductStock);
if (productStocks == null || productStocks.isEmpty()) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
List<WmsProductStock> occupyProductStocks = productStocks.stream().filter
(e -> (e.getOccupyAmount().compareTo(BigDecimal.ZERO) > 0 || e.getFrozenAmount().compareTo(BigDecimal.ZERO) > 0))
.collect(Collectors.toList());
if (occupyProductStocks != null && !occupyProductStocks.isEmpty()) {
throw new ServiceException("原库位有占用库存信息,不能进行移库");
}
//目标库位需要是空库位
WmsProductStock queryTargetProductStock = new WmsProductStock();
queryTargetProductStock.setLocationCode(targetLocationCode);
List<WmsProductStock> targetProductStocks = wmsProductStockMapper.selectWmsProductStockInList(queryTargetProductStock);
if (targetProductStocks != null && !targetProductStocks.isEmpty()) {
throw new ServiceException("目标库位有库存,不能进行移库");
}
toInsertedMoveDetails = getMoveDetailsByProductStocks(productStocks);
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
oriLocation.setUpdateTime(currentDate);
oriLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
targetLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
targetLocation.setUpdateTime(currentDate);
targetLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
wmsMove.setTaskCode(Seq.getId(Seq.wmsMoveSeqType, Seq.wmsMoveSeqCode));
wmsMove.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
wmsMove.setMoveType(WmsConstants.WMS_MOVEMERGE_TYPE_MOVE);
wmsMove.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsMove.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
wmsMove.setApplyBy(userName);
wmsMove.setApplyDate(currentDate);
int rows = wmsMoveMapper.insertWmsMove(wmsMove);
batchInsertMoveDetails(toInsertedMoveDetails, wmsMove.getMoveId(), userName, currentDate);
return rows;
}
public List<WmsMoveDetail> getMoveDetailsByRawStocks(List<WmsRawStock> wmsRawStocks) {
List<WmsMoveDetail> wmsMoveDetailList = new ArrayList<>();
wmsRawStocks.forEach(wmsRawStock -> {
WmsMoveDetail wmsMoveDetail = new WmsMoveDetail();
wmsMoveDetail.setInstockBatch(wmsRawStock.getInstockBatch());
wmsMoveDetail.setMaterialId(wmsRawStock.getMaterialId());
wmsMoveDetail.setPlanAmount(wmsRawStock.getTotalAmount());
wmsMoveDetail.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE);
wmsMoveDetailList.add(wmsMoveDetail);
});
return wmsMoveDetailList;
}
public List<WmsMoveDetail> getMoveDetailsByProductStocks(List<WmsProductStock> wmsProductStocks) {
List<WmsMoveDetail> wmsMoveDetailList = new ArrayList<>();
wmsProductStocks.forEach(wmsProductStock -> {
WmsMoveDetail wmsMoveDetail = new WmsMoveDetail();
wmsMoveDetail.setInstockBatch(wmsProductStock.getProductBatch());
wmsMoveDetail.setMaterialId(wmsProductStock.getProductId());
wmsMoveDetail.setPlanAmount(wmsProductStock.getTotalAmount());
wmsMoveDetail.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE);
wmsMoveDetailList.add(wmsMoveDetail);
});
return wmsMoveDetailList;
}
public void batchInsertMoveDetails(List<WmsMoveDetail> wmsMoveDetailList, Long moveId, String userName, Date currentDate) {
wmsMoveDetailList.forEach(moveDetail -> {
moveDetail.setMoveId(moveId);
moveDetail.setCreateBy(userName);
moveDetail.setCreateDate(currentDate);
});
wmsMoveMapper.batchWmsMoveDetail(wmsMoveDetailList);
}
/**
* join material
*
* @param wmsMoveDetail
* @return
*/
@Override
public List<WmsMoveDetail> selectWmsMoveDetailJoinList(WmsMoveDetail wmsMoveDetail) {
return wmsMoveDetailMapper.selectWmsMoveDetailJoinList(wmsMoveDetail);
}
/**
*
*
* @param wmsMoveVo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int moveOutstock(WmsMoveVo wmsMoveVo) {
Long moveId = wmsMoveVo.getMoveId();
String materialBarcode = wmsMoveVo.getMaterialBarcode();
String locationCode = wmsMoveVo.getLocationCode();
BigDecimal applyQty = wmsMoveVo.getApplyQty();
if (applyQty.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("出库数量需大于0");
}
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
WmsBaseLocation oriLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (oriLocation == null) {
throw new ServiceException("库位编码有误");
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String barcodeType = baseBarcodeInfo.getBarcodeType();
if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {//如果是原材料
moveOutUpdateRawStock(locationCode, baseBarcodeInfo.getBatchCode(), applyQty, userName, currentDate);
} else {//如果是成品
moveOutUpdateProductStock(locationCode, baseBarcodeInfo.getBatchCode(), applyQty, userName, currentDate);
}
WmsMoveDetail queryMoveDetail = new WmsMoveDetail();
queryMoveDetail.setMoveId(moveId);
List<WmsMoveDetail> wmsMoveDetailList = wmsMoveDetailMapper.selectWmsMoveDetailList(queryMoveDetail);
if (wmsMoveDetailList == null || wmsMoveDetailList.isEmpty()) {
throw new ServiceException("没有此移库信息");
}
Map<String, WmsMoveDetail> moveDetailMap = wmsMoveDetailList.stream().
collect(Collectors.toMap(WmsMoveDetail::getInstockBatch, wmsMoveDetail -> wmsMoveDetail));
WmsMoveDetail moveDetail = moveDetailMap.get(baseBarcodeInfo.getBatchCode());
if (moveDetail == null) {
throw new ServiceException("没有此移库信息");
}
String executeStatus = moveDetail.getExecuteStatus();
BigDecimal planAmount = moveDetail.getPlanAmount();
BigDecimal realAmount = moveDetail.getRealAmount() == null ? BigDecimal.ZERO : moveDetail.getRealAmount();
BigDecimal remainingAmount = planAmount.subtract(realAmount);
if (executeStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH)) {
throw new ServiceException("已经移库出库完成,无需再出库");
}
if (executeStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH)) {
throw new ServiceException("已经移库入库完成,无需再出库");
}
if (applyQty.compareTo(remainingAmount) > 0) {
throw new ServiceException("数量不能大于" + remainingAmount);
}
WmsMove wmsMove = wmsMoveMapper.selectWmsMoveByMoveId(moveId);
if(!locationCode.equals(wmsMove.getOriLocationCode())){
throw new ServiceException("库位错误");
}
String moveExecuteStatus = WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH;
if(moveDetail.getExecuteStatus().equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE)){
moveDetail.setExecuteTime(currentDate);
moveDetail.setExecutePerson(userName);
}
if (applyQty.compareTo(remainingAmount) < 0) {
moveDetail.setRealAmount(applyQty.subtract(realAmount));
moveDetail.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING);
} else {
moveDetail.setRealAmount(applyQty.subtract(realAmount));
moveDetail.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH);
for (WmsMoveDetail wmsMoveDetail : wmsMoveDetailList) {
if (!wmsMoveDetail.getMoveDetailId().equals(moveDetail.getMoveDetailId())) {
if (wmsMoveDetail.getExecuteStatus().equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE)
|| wmsMoveDetail.getExecuteStatus().equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING)) {
moveExecuteStatus = WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING;
}
}
}
//解锁库位
if (moveExecuteStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH)){
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL);
oriLocation.setUpdateBy(userName);
oriLocation.setUpdateTime(currentDate);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
}
}
wmsMoveDetailMapper.updateWmsMoveDetail(moveDetail);
if (!wmsMove.getExecuteStatus().equals(moveExecuteStatus)) {
if (wmsMove.getExecuteStatus().equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE)) {
wmsMove.setBeginTime(currentDate);
}
wmsMove.setExecuteStatus(moveExecuteStatus);
wmsMoveMapper.updateWmsMove(wmsMove);
}
return 1;
}
public void moveOutUpdateRawStock(String locationCode, String batchCode, BigDecimal applyQty,
String userName, Date currentDate) {
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByLocationAndBatch(locationCode, batchCode);
if (wmsRawStock == null) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount();
// BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();//占用的不能移库
// BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount();//冻结的不能移库
// BigDecimal availableAmount = totalAmount.subtract(occupyAmount).subtract(frozenAmount);
if (applyQty.compareTo(totalAmount) > 0) {
throw new ServiceException("移库出库数量不能大于" + totalAmount);
}
totalAmount = totalAmount.subtract(applyQty);
if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
wmsRawStockMapper.deleteWmsRawStockByRawStockId(wmsRawStock.getRawStockId());
} else {
wmsRawStock.setTotalAmount(totalAmount);
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
}
}
public void moveOutUpdateProductStock(String locationCode, String batchCode, BigDecimal applyQty,
String userName, Date currentDate) {
WmsProductStock wmsProductStock = wmsProductStockMapper.selectProductStockByBatch(batchCode);
if (wmsProductStock == null) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
BigDecimal totalAmount = wmsProductStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsProductStock.getTotalAmount();
// BigDecimal occupyAmount = wmsProductStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsProductStock.getOccupyAmount();//占用的不能移库
// BigDecimal frozenAmount = wmsProductStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsProductStock.getFrozenAmount();//冻结的不能移库
// BigDecimal availableAmount = totalAmount.subtract(occupyAmount).subtract(frozenAmount);
if (applyQty.compareTo(totalAmount) > 0) {
throw new ServiceException("移库出库数量不能大于" + totalAmount);
}
totalAmount = totalAmount.subtract(applyQty);
if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
wmsProductStockMapper.deleteWmsProductStockByProductStockId(wmsProductStock.getProductStockId());
} else {
wmsProductStock.setTotalAmount(totalAmount);
wmsProductStock.setUpdateBy(userName);
wmsProductStock.setUpdateDate(currentDate);
wmsProductStockMapper.updateWmsProductStock(wmsProductStock);
}
}
/**
*
*
* @param wmsMoveVo
* @return
*/
public int moveInstock(WmsMoveVo wmsMoveVo) {
Long moveId = wmsMoveVo.getMoveId();
String materialBarcode = wmsMoveVo.getMaterialBarcode();
String locationCode = wmsMoveVo.getLocationCode();
BigDecimal applyQty = wmsMoveVo.getApplyQty();
if (applyQty.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("入库数量需大于0");
}
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (location == null) {
throw new ServiceException("库位编码有误");
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String barcodeType = baseBarcodeInfo.getBarcodeType();
String moveExecuteStatus = "";
WmsMoveDetail queryMoveDetail = new WmsMoveDetail();
queryMoveDetail.setMoveId(moveId);
List<WmsMoveDetail> moveDetails = wmsMoveDetailMapper.selectWmsMoveDetailList(queryMoveDetail);
if (moveDetails == null || moveDetails.isEmpty()) {
throw new ServiceException("没有移库出库记录");
}
Map<String, WmsMoveDetail> moveDetailMap = moveDetails.stream().
collect(Collectors.toMap(WmsMoveDetail::getMaterialBarcode, wmsMoveDetail -> wmsMoveDetail));
WmsMoveDetail wmsMoveDetail = moveDetailMap.get(materialBarcode);
if (wmsMoveDetail == null) {
throw new ServiceException("没有移库出库记录");
}
moveDetailMap.remove(wmsMoveDetail);
if (wmsMoveDetail.getPlanAmount().compareTo(applyQty) != 0) {
throw new ServiceException("入库数量需等于" + wmsMoveDetail.getPlanAmount());
}
if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {//如果是原材料
// moveExecuteStatus = moveInUpdateRawStock(Map < String, WmsMoveDetail > moveDetailMap);
} else {//如果是成品
// moveExecuteStatus = updateProductStock(locationCode, baseBarcodeInfo.getBatchCode(), applyQty, userName, currentDate, location);
}
if (moveExecuteStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH)) {
WmsMove wmsMove = wmsMoveMapper.selectWmsMoveByMoveId(moveId);
wmsMove.setEndTime(currentDate);
wmsMove.setExecuteStatus(moveExecuteStatus);
wmsMoveMapper.updateWmsMove(wmsMove);
}
wmsMoveDetail.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH);
wmsMoveDetail.setExecuteEndTime(currentDate);
wmsMoveDetail.setUpdateBy(userName);
wmsMoveDetail.setUpdateDate(currentDate);
return wmsMoveDetailMapper.updateWmsMoveDetail(wmsMoveDetail);
}
public String moveInUpdateRawStock(Map<String, WmsMoveDetail> moveDetailMap, String locationCode,
MesBaseBarcodeInfo mesBaseBarcodeInfo) {
String moveExecuteStatus = WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH;
//先判断是否已全部出库完成
if (moveDetailMap != null || !moveDetailMap.isEmpty()) {
for (Map.Entry<String, WmsMoveDetail> wmsMoveDetailEntry : moveDetailMap.entrySet()) {
WmsMoveDetail wmsMoveDetail = wmsMoveDetailEntry.getValue();
if (!wmsMoveDetail.getExecuteStatus().equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH)) {
// moveExecuteStatus = WmsConstants.
}
}
}
String batchCode = mesBaseBarcodeInfo.getBatchCode();
WmsRawStock rawStock = wmsRawStockMapper.selectRawStockByLocationAndBatch(locationCode, batchCode);
if (rawStock != null) {
// rawStock.setTotalAmount();
// rawStock.setUpdateDate();
// rawStock.setUpdateBy();
wmsRawStockMapper.updateWmsRawStock(rawStock);
} else {
rawStock = new WmsRawStock();
// rawStock.setTotalAmount();
// rawStock.setLocationCode();
// rawStock.setInstockBatch();
// rawStock.setWarehouseId();
// rawStock.setWarehouseFloor();
// rawStock.setStockType();
// rawStock.setMaterialId();
// rawStock.setInstockDate();//条码中的入库时间
// rawStock.setLastOutstockTime();
// rawStock.setQualityStatus();
// rawStock.setCompleteFlag();
// rawStock.setCreateDate();
// rawStock.setCreateBy();
wmsRawStockMapper.insertWmsRawStock(rawStock);
}
return moveExecuteStatus;
}
/**
*
*
* @param wmsMoveVo
* @return
*/
/* @Override
@Transactional(rollbackFor = Exception.class)
public int moveOutstock(WmsMoveVo wmsMoveVo) {
String materialBarcode = wmsMoveVo.getMaterialBarcode();
String locationCode = wmsMoveVo.getLocationCode();
BigDecimal applyQty = wmsMoveVo.getApplyQty();
if (applyQty.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("出库数量需大于0");
}
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
String batchFlag = baseBarcodeInfo.getBatchFlag();
if (!batchFlag.equals(MesConstants.IS_BATCH)) {
if (applyQty.compareTo(BigDecimal.ONE) > 0) {
throw new ServiceException("出库数量需等于1");
}
}
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (location == null) {
throw new ServiceException("库位编码有误");
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String barcodeType = baseBarcodeInfo.getBarcodeType();
if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {//如果是原材料
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByLocationAndBatch(locationCode, baseBarcodeInfo.getBatchCode());
if (wmsRawStock == null) {
throw new ServiceException("无库存信息");
}
BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount();
BigDecimal availableAmount = totalAmount.subtract(occupyAmount).subtract(frozenAmount);
if (applyQty.compareTo(availableAmount) > 0) {
throw new ServiceException("移库出库数量不能大于" + availableAmount);
}
totalAmount = totalAmount.subtract(applyQty);
if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
wmsRawStockMapper.deleteWmsRawStockByRawStockId(wmsRawStock.getRawStockId());
} else {
wmsRawStock.setTotalAmount(totalAmount);
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
}
} else {//如果是成品
WmsProductStock wmsProductStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode);
if (wmsProductStock == null || !wmsProductStock.getLocationCode().equals(locationCode)) {
throw new ServiceException("无此库存信息");
}
BigDecimal totalAmount = wmsProductStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsProductStock.getTotalAmount();
BigDecimal occupyAmount = wmsProductStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsProductStock.getOccupyAmount();
BigDecimal frozenAmount = wmsProductStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsProductStock.getFrozenAmount();
BigDecimal availableAmount = totalAmount.subtract(occupyAmount).subtract(frozenAmount);
if (applyQty.compareTo(availableAmount) > 0) {
throw new ServiceException("移库出库数量不能大于" + availableAmount);
}
totalAmount = totalAmount.subtract(applyQty);
if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
wmsProductStockMapper.deleteWmsProductStockByProductStockId(wmsProductStock.getProductStockId());
} else {
wmsProductStock.setTotalAmount(totalAmount);
wmsProductStock.setUpdateBy(userName);
wmsProductStock.setUpdateDate(currentDate);
wmsProductStockMapper.updateWmsProductStock(wmsProductStock);
}
}
WmsMoveDetail queryMoveDetail = new WmsMoveDetail();
queryMoveDetail.setMaterialBarcode(materialBarcode);
queryMoveDetail.setMoveExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);//移库合库记录执行状态正在执行中的,对于已完成的可以重复移库合库
List<WmsMoveDetail> wmsMoveDetails = wmsMoveDetailMapper.selectWmsMoveDetailList(queryMoveDetail);
if (wmsMoveDetails != null && !wmsMoveDetails.isEmpty()) {
throw new ServiceException("已经有此物料信息的移库记录");
}
WmsMove wmsMove = new WmsMove();
wmsMove.setTaskCode(Seq.getId(Seq.wmsMoveSeqType, Seq.wmsMoveSeqCode));
wmsMove.setWarehouseId(location.getWarehouseId());
wmsMove.setOriLocationCode(locationCode);
wmsMove.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
wmsMove.setMoveType(WmsConstants.WMS_MOVEMERGE_TYPE_MOVE);
wmsMove.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsMove.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
wmsMove.setApplyBy(userName);
wmsMove.setApplyDate(currentDate);
wmsMove.setBeginTime(currentDate);
wmsMoveMapper.insertWmsMove(wmsMove);
WmsMoveDetail wmsMoveDetail = new WmsMoveDetail();
wmsMoveDetail.setMoveId(wmsMove.getMoveId());
wmsMoveDetail.setLocationCode(locationCode);
wmsMoveDetail.setMaterialBarcode(materialBarcode);
wmsMoveDetail.setInstockBatch(baseBarcodeInfo.getBatchCode());
wmsMoveDetail.setMaterialId(baseBarcodeInfo.getMaterialId());
wmsMoveDetail.setPlanAmount(applyQty);
wmsMoveDetail.setRealAmount(applyQty);
wmsMoveDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsMoveDetail.setExecutePerson(userName);
wmsMoveDetail.setExecuteTime(currentDate);
wmsMoveDetail.setMoveDetailType(WmsConstants.WMS_MOVE_DETAIL_TYPE_OUT);
wmsMoveDetail.setCreateBy(userName);
wmsMoveDetail.setCreateDate(currentDate);
wmsMoveDetailMapper.insertWmsMoveDetail(wmsMoveDetail);
return 1;
}*/
}

@ -8,9 +8,11 @@ import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
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.wms.config.WmsConfig;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.WmsProduceInstockVo;
import com.hw.wms.domain.vo.WmsProductInstockVo;
@ -47,10 +49,12 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsConfig wmsConfig;
@Resource
private RemoteMesService remoteMesService;
@ -279,8 +283,39 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
*/
@Override
public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo) {
String materialBarcode = wmsProduceInstockVo.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
WmsProductInstock queryProductInstock = new WmsProductInstock();
queryProductInstock.setProductBatch(materialBarcode);
List<WmsProductInstock> wmsProductInstocks = wmsProductInstockMapper.selectWmsProductInstockList(queryProductInstock);
if (wmsProductInstocks != null && !wmsProductInstocks.isEmpty()) {
throw new ServiceException("已经有此物料入库记录");
}
Long warehouseId = wmsConfig.getFifthSemiWarehouseId();//五楼半成品库
WmsProductInstock wmsProductInstock = new WmsProductInstock();
wmsProductInstock.setTaskCode(Seq.getId(Seq.productInstockSeqType, Seq.productInstockCode));
wmsProductInstock.setWarehouseId(warehouseId);
wmsProductInstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());
wmsProductInstock.setProductType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_SEMI);
wmsProductInstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO);
wmsProductInstock.setPlanCode(baseBarcodeInfo.getPlanCode());
wmsProductInstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode());
wmsProductInstock.setInstockType(WmsConstants.PRODUCT_INSTOCK_INSTOCK_TYPE_PRODUCT);
wmsProductInstock.setProductId(baseBarcodeInfo.getMaterialId());
wmsProductInstock.setProductBatch(materialBarcode);
wmsProductInstock.setInstockAmount(BigDecimal.ONE);
wmsProductInstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsProductInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
wmsProductInstock.setApplyBy(SecurityUtils.getUsername());
wmsProductInstock.setApplyDate(new Date());
return 1;
return wmsProductInstockMapper.insertWmsProductInstock(wmsProductInstock);
}

@ -10,6 +10,7 @@ import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo;
import com.hw.wms.mapper.WmsBaseWarehouseMapper;
import com.hw.wms.mapper.WmsProductStockMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -217,4 +218,17 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
}
/**
*
* @param wmsProductOutstockConfirmVo
* @return
*/
@Override
public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo){
System.out.println("111"+wmsProductOutstockConfirmVo.getSaleorderCode());
System.out.println("3333"+wmsProductOutstockConfirmVo.getMaterialBarcode());
return 1;
}
}

@ -1,6 +1,5 @@
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;
@ -14,6 +13,7 @@ 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.config.WmsConfig;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.*;
import com.hw.wms.mapper.*;
@ -55,9 +55,13 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsConfig wmsConfig;
@Autowired
private RemoteMesService remoteMesService;
/**
*
*
@ -281,7 +285,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail();
queryRawOutstockDetail.setLocationCode(locationCode);
queryRawOutstockDetail.setInstockBatch(baseBarcodeInfo.getBatchCode());
queryRawOutstockDetail.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE+","+WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
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;
@ -799,6 +803,53 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
*/
@Override
public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo) {
String materialBarcode = wmsAssembleOutstockVo.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料编码有误");
}
String bindBarcode = baseBarcodeInfo.getBindBarcode();
WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setMaterialBatch(bindBarcode);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock);
if (wmsRawOutstocks != null && !wmsRawOutstocks.isEmpty()) {
throw new ServiceException("已经有此物料出库记录");
}
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setInstockBatch(bindBarcode);
queryRawStock.setCompleteFlag(WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAG_NO);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks == null || wmsRawStocks.isEmpty()) {
throw new ServiceException("没找到库存信息");
}
WmsRawStock wmsRawStock = wmsRawStocks.get(0); //待agv出库后wcs更新库存信息需要删除库存由于是1个
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
wmsRawOutstock.setWarehouseId(wmsRawStock.getWarehouseId());
wmsRawOutstock.setLocationCode(wmsRawStock.getLocationCode());
wmsRawOutstock.setOrderId(baseBarcodeInfo.getSaleOrderId());
wmsRawOutstock.setPlanCode(baseBarcodeInfo.getPlanCode());
wmsRawOutstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode());
wmsRawOutstock.setProductId(baseBarcodeInfo.getMaterialId());
wmsRawOutstock.setMaterialBatch(bindBarcode);
wmsRawOutstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());//在绑定时需要在条码信息中记录托盘码
wmsRawOutstock.setOutstockAmount(BigDecimal.ONE);
wmsRawOutstock.setEndStationCode(wmsConfig.getFifthAssembleStationCode());//目标位置,五楼组装区域 todo 读配置文件获取
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT);
wmsRawOutstock.setApplyBy(SecurityUtils.getUsername());
wmsRawOutstock.setApplyDate(new Date());
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
return 1;
}

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.wms.mapper.WmsMoveDetailMapper">
<resultMap type="WmsMoveDetail" id="WmsMoveDetailResult">
<result property="moveDetailId" column="move_detail_id" />
<result property="moveId" column="move_id" />
<result property="materialBarcode" column="material_barcode" />
<result property="instockBatch" column="instock_batch" />
<result property="materialId" column="material_id" />
<result property="locationCode" column="location_code" />
<result property="planAmount" column="plan_amount" />
<result property="realAmount" column="real_amount" />
<result property="realInstockAmount" column="real_instock_amount" />
<result property="executeStatus" column="execute_status" />
<result property="executePerson" column="execute_person" />
<result property="executeTime" column="execute_time" />
<result property="executeEndTime" column="execute_end_time" />
<result property="machineName" column="machine_name" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="activeFlag" column="active_flag" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectWmsMoveDetailVo">
select move_detail_id, move_id, material_barcode, instock_batch, material_id, plan_amount, real_amount, execute_status, execute_person, execute_time, machine_name, create_by, create_date, update_by, update_date, active_flag from wms_move_detail wmd
</sql>
<select id="selectWmsMoveDetailList" parameterType="WmsMoveDetail" resultMap="WmsMoveDetailResult">
<include refid="selectWmsMoveDetailVo"/>
<where>
<if test="moveId != null "> and move_id = #{moveId}</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="instockBatch != null and instockBatch != ''"> and instock_batch = #{instockBatch}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="realAmount != null "> and real_amount = #{realAmount}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="executePerson != null and executePerson != ''"> and execute_person = #{executePerson}</if>
<if test="machineName != null and machineName != ''"> and machine_name like concat('%', #{machineName}, '%')</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="moveExecuteStatus != null and moveExecuteStatus != ''"> and exists (select 1 from wms_move wm where wm.move_id=wmd.move_id and wm.execute_status = #{moveExecuteStatusStr}</if>
<if test="moveExecuteStatusStr != null and moveExecuteStatusStr != ''"> and exists (select 1 from wms_move wm where wm.move_id=wmd.move_id and wm.execute_status in (${moveExecuteStatusStr}))</if>
</where>
</select>
<select id="selectWmsMoveDetailByMoveDetailId" parameterType="Long" resultMap="WmsMoveDetailResult">
<include refid="selectWmsMoveDetailVo"/>
where move_detail_id = #{moveDetailId}
</select>
<insert id="insertWmsMoveDetail" parameterType="WmsMoveDetail" useGeneratedKeys="true" keyProperty="moveDetailId">
insert into wms_move_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="moveId != null">move_id,</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode,</if>
<if test="instockBatch != null">instock_batch,</if>
<if test="materialId != null">material_id,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="realAmount != null">real_amount,</if>
<if test="executeStatus != null and executeStatus != ''">execute_status,</if>
<if test="executePerson != null">execute_person,</if>
<if test="executeTime != null">execute_time,</if>
<if test="executeEndTime != null">execute_end_time,</if>
<if test="machineName != null">machine_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="activeFlag != null">active_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="moveId != null">#{moveId},</if>
<if test="materialBarcode != null and materialBarcode != ''">#{materialBarcode},</if>
<if test="instockBatch != null">#{instockBatch},</if>
<if test="materialId != null">#{materialId},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="realAmount != null">#{realAmount},</if>
<if test="executeStatus != null and executeStatus != ''">#{executeStatus},</if>
<if test="executePerson != null">#{executePerson},</if>
<if test="executeTime != null">#{executeTime},</if>
<if test="executeEndTime != null">#{executeEndTime},</if>
<if test="machineName != null">#{machineName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="activeFlag != null">#{activeFlag},</if>
</trim>
</insert>
<update id="updateWmsMoveDetail" parameterType="WmsMoveDetail">
update wms_move_detail
<trim prefix="SET" suffixOverrides=",">
<if test="moveId != null">move_id = #{moveId},</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode = #{materialBarcode},</if>
<if test="instockBatch != null">instock_batch = #{instockBatch},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="realAmount != null">real_amount = #{realAmount},</if>
<if test="executeStatus != null and executeStatus != ''">execute_status = #{executeStatus},</if>
<if test="executePerson != null">execute_person = #{executePerson},</if>
<if test="executeTime != null">execute_time = #{executeTime},</if>
<if test="executeEndTime != null">execute_end_time = #{executeEndTime},</if>
<if test="machineName != null">machine_name = #{machineName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
</trim>
where move_detail_id = #{moveDetailId}
</update>
<delete id="deleteWmsMoveDetailByMoveDetailId" parameterType="Long">
delete from wms_move_detail where move_detail_id = #{moveDetailId}
</delete>
<delete id="deleteWmsMoveDetailByMoveDetailIds" parameterType="String">
delete from wms_move_detail where move_detail_id in
<foreach item="moveDetailId" collection="array" open="(" separator="," close=")">
#{moveDetailId}
</foreach>
</delete>
<select id="selectWmsMoveDetailByMoveIdAndBatchCode" resultMap="WmsMoveDetailResult">
<include refid="selectWmsMoveDetailVo"/>
where move_id = #{moveId} and instock_batch = #{instockBatch}
</select>
<sql id="selectWmsMoveDetailJoinVo">
select wmd.move_detail_id, wmd.move_id, wmd.material_barcode, wmd.instock_batch, wmd.material_id, wmd.plan_amount, wmd.real_amount,wmd.real_instock_amount,
wmd.execute_status, wmd.execute_person, wmd.execute_time, wmd.machine_name, wmd.create_by, wmd.create_date,
mbmi.material_name
from wms_move_detail wmd left join mes_base_material_info mbmi on wmd.material_id = mbmi.material_id
</sql>
<select id="selectWmsMoveDetailJoinList" parameterType="WmsMoveDetail" resultMap="WmsMoveDetailResult">
<include refid="selectWmsMoveDetailJoinVo"/>
<where>
<if test="moveId != null "> and move_id = #{moveId}</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="instockBatch != null and instockBatch != ''"> and instock_batch = #{instockBatch}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="realAmount != null "> and real_amount = #{realAmount}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="executePerson != null and executePerson != ''"> and execute_person = #{executePerson}</if>
<if test="machineName != null and machineName != ''"> and machine_name like concat('%', #{machineName}, '%')</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="moveExecuteStatus != null and moveExecuteStatus != ''"> and exists (select 1 from wms_move wm where wm.move_id=wmd.move_id and wm.execute_status = #{moveExecuteStatusStr}</if>
<if test="moveExecuteStatusStr != null and moveExecuteStatusStr != ''"> and exists (select 1 from wms_move wm where wm.move_id=wmd.move_id and wm.execute_status in (${moveExecuteStatusStr}))</if>
</where>
</select>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.wms.mapper.WmsMoveMapper">
<resultMap type="WmsMove" id="WmsMoveResult">
<result property="moveId" column="move_id" />
<result property="taskCode" column="task_code" />
@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateDate" column="update_date" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
<result property="warehouseName" column="warehouse_name" />
</resultMap>
<resultMap id="WmsMoveWmsMoveDetailResult" type="WmsMove" extends="WmsMoveResult">
@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="executeStatus" column="sub_execute_status" />
<result property="executePerson" column="sub_execute_person" />
<result property="executeTime" column="sub_execute_time" />
<result property="moveDetailType" column="sub_move_detail_type" />
<result property="executeEndTime" column="sub_execute_end_time" />
<result property="machineName" column="sub_machine_name" />
<result property="createBy" column="sub_create_by" />
<result property="createDate" column="sub_create_date" />
@ -58,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmsMoveList" parameterType="WmsMove" resultMap="WmsMoveResult">
<include refid="selectWmsMoveVo"/>
<where>
<where>
<if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="oriLocationCode != null and oriLocationCode != ''"> and ori_location_code = #{oriLocationCode}</if>
@ -79,15 +80,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null "> and end_time = #{endTime}</if>
</where>
</select>
<select id="selectWmsMoveByMoveId" parameterType="Long" resultMap="WmsMoveWmsMoveDetailResult">
select a.move_id, a.task_code, a.warehouse_id, a.ori_location_code, a.target_location_code, a.operation_type, a.move_way, a.move_type, a.apply_reason, a.audit_reason, a.audit_status, a.execute_status, a.apply_by, a.apply_date, a.audit_by, a.audit_date, a.update_by, a.update_date, a.begin_time, a.end_time,
b.move_detail_id as sub_move_detail_id, b.move_id as sub_move_id, b.location_code as sub_location_code, b.material_barcode as sub_material_barcode, b.instock_batch as sub_instock_batch, b.material_id as sub_material_id, b.plan_amount as sub_plan_amount, b.real_amount as sub_real_amount, b.execute_status as sub_execute_status, b.execute_person as sub_execute_person, b.execute_time as sub_execute_time, b.move_detail_type as sub_move_detail_type, b.machine_name as sub_machine_name, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date, b.active_flag as sub_active_flag
b.move_detail_id as sub_move_detail_id, b.move_id as sub_move_id, b.location_code as sub_location_code, b.material_barcode as sub_material_barcode, b.instock_batch as sub_instock_batch, b.material_id as sub_material_id, b.plan_amount as sub_plan_amount, b.real_amount as sub_real_amount, b.execute_status as sub_execute_status, b.execute_person as sub_execute_person, b.execute_time as sub_execute_time, b.execute_end_time as sub_execute_end_time, b.machine_name as sub_machine_name, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date, b.active_flag as sub_active_flag
from wms_move a
left join wms_move_detail b on b.move_id = a.move_id
where a.move_id = #{moveId}
</select>
<insert id="insertWmsMove" parameterType="WmsMove" useGeneratedKeys="true" keyProperty="moveId">
insert into wms_move
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -165,14 +166,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteWmsMoveByMoveIds" parameterType="String">
delete from wms_move where move_id in
delete from wms_move where move_id in
<foreach item="moveId" collection="array" open="(" separator="," close=")">
#{moveId}
</foreach>
</delete>
<delete id="deleteWmsMoveDetailByMoveIds" parameterType="String">
delete from wms_move_detail where move_id in
delete from wms_move_detail where move_id in
<foreach item="moveId" collection="array" open="(" separator="," close=")">
#{moveId}
</foreach>
@ -183,9 +184,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id="batchWmsMoveDetail">
insert into wms_move_detail( move_detail_id, move_id, location_code, material_barcode, instock_batch, material_id, plan_amount, real_amount, execute_status, execute_person, execute_time, move_detail_type, machine_name, create_by, create_date, update_by, update_date, active_flag) values
insert into wms_move_detail( move_detail_id, move_id, location_code, material_barcode, instock_batch, material_id, plan_amount, real_amount, execute_status, execute_person, execute_time, execute_end_time, machine_name, create_by, create_date, update_by, update_date, active_flag) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.moveDetailId}, #{item.moveId}, #{item.locationCode}, #{item.materialBarcode}, #{item.instockBatch}, #{item.materialId}, #{item.planAmount}, #{item.realAmount}, #{item.executeStatus}, #{item.executePerson}, #{item.executeTime}, #{item.moveDetailType}, #{item.machineName}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}, #{item.activeFlag})
( #{item.moveDetailId}, #{item.moveId}, #{item.locationCode}, #{item.materialBarcode}, #{item.instockBatch}, #{item.materialId}, #{item.planAmount}, #{item.realAmount}, #{item.executeStatus}, #{item.executePerson}, #{item.executeTime}, #{item.executeEndTime}, #{item.machineName}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}, #{item.activeFlag})
</foreach>
</insert>
</mapper>
<sql id="selectWmsMoveJoinVo">
select wm.move_id, wm.task_code, wm.warehouse_id, wm.ori_location_code, wm.target_location_code, wm.operation_type, wm.move_way, wm.move_type,
wm.execute_status, wm.apply_by, wm.apply_date, wm.begin_time, wm.end_time,
wbw.warehouse_name
from wms_move wm left join wms_base_warehouse wbw on wm.warehouse_id = wbw.warehouse_id
</sql>
<select id="selectWmsMoveJoinList" parameterType="WmsMove" resultMap="WmsMoveResult">
<include refid="selectWmsMoveJoinVo"/>
<where>
</where>
order by wm.move_id desc
</select>
</mapper>

@ -14,6 +14,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="instockType" column="instock_type" />
<result property="productId" column="product_id" />
<result property="productBatch" column="product_batch" />
<result property="instockAmount" column="instock_amount" />
<result property="palletInfoCode" column="pallet_info_code" />
<result property="applyReason" column="apply_reason" />
<result property="auditReason" column="audit_reason" />
<result property="auditStatus" column="audit_status" />
@ -51,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsProductInstockVo">
select product_instock_id, task_code, warehouse_id, location_code, product_type, operation_type, plan_code, plan_detail_code, instock_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_product_instock
select product_instock_id, task_code, warehouse_id, location_code, product_type, operation_type, plan_code, plan_detail_code, instock_type, product_id, product_batch, instock_amount, pallet_info_code, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_product_instock
</sql>
<select id="selectWmsProductInstockList" parameterType="WmsProductInstock" resultMap="WmsProductInstockResult">
@ -95,9 +99,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="locationCode != null">location_code,</if>
<if test="productType != null and productType != ''">product_type,</if>
<if test="operationType != null and operationType != ''">operation_type,</if>
<if test="planCode != null">plan_code,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="instockType != null and instockType != ''">instock_type,</if>
<if test="productId != null">product_id,</if>
<if test="productBatch != null">product_batch,</if>
<if test="instockAmount != null">instock_amount,</if>
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="applyReason != null">apply_reason,</if>
<if test="auditReason != null">audit_reason,</if>
<if test="auditStatus != null and auditStatus != ''">audit_status,</if>
@ -110,16 +118,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null">update_date,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null">#{taskCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="productType != null and productType != ''">#{productType},</if>
<if test="operationType != null and operationType != ''">#{operationType},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="instockType != null and instockType != ''">#{instockType},</if>
<if test="productId != null">#{productId},</if>
<if test="productBatch != null">#{productBatch},</if>
<if test="instockAmount != null">#{instockAmount},</if>
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="applyReason != null">#{applyReason},</if>
<if test="auditReason != null">#{auditReason},</if>
<if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
@ -132,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null">#{updateDate},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</trim>
</insert>
<update id="updateWmsProductInstock" parameterType="WmsProductInstock">
@ -143,9 +155,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="productType != null and productType != ''">product_type = #{productType},</if>
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="instockType != null and instockType != ''">instock_type = #{instockType},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productBatch != null">product_batch = #{productBatch},</if>
<if test="instockAmount != null">instock_amount = #{instockAmount},</if>
<if test="palletInfoCode != null">pallet_info_code = #{palletInfoCode},</if>
<if test="applyReason != null">apply_reason = #{applyReason},</if>
<if test="auditReason != null">audit_reason = #{auditReason},</if>
<if test="auditStatus != null and auditStatus != ''">audit_status = #{auditStatus},</if>

@ -14,6 +14,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planDetailCode" column="plan_detail_code" />
<result property="stationId" column="station_id" />
<result property="productId" column="product_id" />
<result property="materialBatch" column="material_batch" />
<result property="palletInfoCode" column="pallet_info_code" />
<result property="outstockAmount" column="outstock_amount" />
<result property="endStationCode" column="end_station_code" />
<result property="operationType" column="operation_type" />
<result property="taskType" column="task_type" />
<result property="applyReason" column="apply_reason" />
@ -60,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsRawOutstockVo">
select raw_outstock_id, task_code, warehouse_id, location_code, order_id, plan_code, plan_detail_code, station_id, product_id, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_raw_outstock
select raw_outstock_id, task_code, warehouse_id, location_code, order_id, plan_code, plan_detail_code, station_id, product_id, material_batch, pallet_info_code, outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_raw_outstock
</sql>
<select id="selectWmsRawOutstockList" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">
@ -91,10 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectWmsRawOutstockByRawOutstockId" parameterType="Long" resultMap="WmsRawOutstockWmsRawOutstockDetailResult">
select a.raw_outstock_id, a.task_code, a.warehouse_id, a.location_code, a.order_id, a.plan_code, a.plan_detail_code, a.station_id, a.product_id, a.operation_type, a.task_type, a.apply_reason, a.audit_reason, a.audit_status, a.execute_status, a.apply_by, a.apply_date, a.audit_by, a.audit_date, a.update_by, a.update_date, a.begin_time, a.end_time,
b.raw_outstock_detail_id as sub_raw_outstock_detail_id, b.raw_outstock_id as sub_raw_outstock_id, b.location_code as sub_location_code, b.material_barcode as sub_material_barcode, b.material_id as sub_material_id, b.instock_batch as sub_instock_batch, b.material_production_Date as sub_material_production_Date, b.plan_amount as sub_plan_amount, b.outstock_amount as sub_outstock_amount, b.execute_status as sub_execute_status, b.erp_status as sub_erp_status, b.outstock_person as sub_outstock_person, b.outstock_time as sub_outstock_time, b.outstock_way as sub_outstock_way, b.machine_name as sub_machine_name, b.quality_status as sub_quality_status, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date, b.stack_amount as sub_stack_amount
select a.raw_outstock_id, a.task_code, a.warehouse_id, a.location_code, a.order_id, a.plan_code, a.plan_detail_code, a.station_id, a.product_id, a.material_batch, a.pallet_info_code, a.outstock_amount, a.end_station_code, a.operation_type, a.task_type, a.apply_reason, a.audit_reason, a.audit_status, a.execute_status, a.apply_by, a.apply_date, a.audit_by, a.audit_date, a.update_by, a.update_date, a.begin_time, a.end_time,
b.raw_outstock_detail_id as sub_raw_outstock_detail_id, b.raw_outstock_id as sub_raw_outstock_id, b.task_code as sub_task_code, b.location_code as sub_location_code, b.material_barcode as sub_material_barcode, b.material_id as sub_material_id, b.instock_batch as sub_instock_batch, b.material_production_date as sub_material_production_date, b.plan_amount as sub_plan_amount, b.outstock_amount as sub_outstock_amount, b.execute_status as sub_execute_status, b.erp_status as sub_erp_status, b.erp_amount as sub_erp_amount, b.outstock_person as sub_outstock_person, b.outstock_time as sub_outstock_time, b.outstock_way as sub_outstock_way, b.machine_name as sub_machine_name, b.quality_status as sub_quality_status, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date, b.stack_amount as sub_stack_amount
from wms_raw_outstock a
left join wms_raw_outstock_detail b on b.raw_outstock_id = a.raw_outstock_id
left join wms_raw_outstock_detail b on b.raw_outstock_id = a.raw_outstock_id
where a.raw_outstock_id = #{rawOutstockId}
</select>
@ -109,12 +113,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="stationId != null">station_id,</if>
<if test="productId != null">product_id,</if>
<if test="operationType != null">operation_type,</if>
<if test="taskType != null">task_type,</if>
<if test="materialBatch != null">material_batch,</if>
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="outstockAmount != null">outstock_amount,</if>
<if test="endStationCode != null">end_station_code,</if>
<if test="operationType != null and operationType != ''">operation_type,</if>
<if test="taskType != null and taskType != ''">task_type,</if>
<if test="applyReason != null">apply_reason,</if>
<if test="auditReason != null">audit_reason,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="executeStatus != null">execute_status,</if>
<if test="auditStatus != null and auditStatus != ''">audit_status,</if>
<if test="executeStatus != null and executeStatus != ''">execute_status,</if>
<if test="applyBy != null">apply_by,</if>
<if test="applyDate != null">apply_date,</if>
<if test="auditBy != null">audit_by,</if>
@ -123,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null">update_date,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
@ -133,12 +141,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="stationId != null">#{stationId},</if>
<if test="productId != null">#{productId},</if>
<if test="operationType != null">#{operationType},</if>
<if test="taskType != null">#{taskType},</if>
<if test="materialBatch != null">#{materialBatch},</if>
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="outstockAmount != null">#{outstockAmount},</if>
<if test="endStationCode != null">#{endStationCode},</if>
<if test="operationType != null and operationType != ''">#{operationType},</if>
<if test="taskType != null and taskType != ''">#{taskType},</if>
<if test="applyReason != null">#{applyReason},</if>
<if test="auditReason != null">#{auditReason},</if>
<if test="auditStatus != null">#{auditStatus},</if>
<if test="executeStatus != null">#{executeStatus},</if>
<if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
<if test="executeStatus != null and executeStatus != ''">#{executeStatus},</if>
<if test="applyBy != null">#{applyBy},</if>
<if test="applyDate != null">#{applyDate},</if>
<if test="auditBy != null">#{auditBy},</if>
@ -147,7 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null">#{updateDate},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</trim>
</insert>
<update id="updateWmsRawOutstock" parameterType="WmsRawOutstock">
@ -161,12 +173,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="stationId != null">station_id = #{stationId},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="taskType != null">task_type = #{taskType},</if>
<if test="materialBatch != null">material_batch = #{materialBatch},</if>
<if test="palletInfoCode != null">pallet_info_code = #{palletInfoCode},</if>
<if test="outstockAmount != null">outstock_amount = #{outstockAmount},</if>
<if test="endStationCode != null">end_station_code = #{endStationCode},</if>
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
<if test="applyReason != null">apply_reason = #{applyReason},</if>
<if test="auditReason != null">audit_reason = #{auditReason},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="executeStatus != null">execute_status = #{executeStatus},</if>
<if test="auditStatus != null and auditStatus != ''">audit_status = #{auditStatus},</if>
<if test="executeStatus != null and executeStatus != ''">execute_status = #{executeStatus},</if>
<if test="applyBy != null">apply_by = #{applyBy},</if>
<if test="applyDate != null">apply_date = #{applyDate},</if>
<if test="auditBy != null">audit_by = #{auditBy},</if>

@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
and totalAmount > 0
and total_amount > 0
</where>
</select>

Loading…
Cancel
Save