WMS:
完成成品出库申请和成品出库确认接口。
修改PDA接口:转库任务(半成品出半成品库入成品库)。
1.3.5
xins 10 months ago
parent 49843665fc
commit 42fe60d0d4

@ -124,10 +124,9 @@ public class WmsConstants {
public static final String WMS_MOVEMERGE_TYPE_MERGE = "2";//合库
public static final String WMS_WAREHOUSE_TYPE_NORMAL = "0";//普通仓库
public static final String WMS_WAREHOUSE_TYPE_AGV = "1";//AGV仓库
public static final String WMS_WAREHOUSE_TYPE_WORKBIN_AGV = "2";//料箱AGV仓库
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仓库
public static final Map<String, String> OPERATION_TYPE_MAP = new HashMap<String, String>();
static {
@ -190,4 +189,11 @@ public class WmsConstants {
public static final String WMS_TRANSFER_DETAIL_TYPE_INSTOCK = "2";//入库
/*成品出库记录成品类型*/
public static final String WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_SEMI = "2";//半成品
public static final String WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT = "3";//成品
/*成品出库记录出库类型*/
public static final String WMS_PRODUCT_OUTSTOCK_TYPE_SALE = "1";//销售出库
}

@ -1,14 +1,14 @@
package com.hw.common.core.utils.uuid;
import java.util.concurrent.atomic.AtomicInteger;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
/**
* @author ruoyi
*/
public class Seq
{
public class Seq {
// 通用序列类型
public static final String commSeqType = "COMMON";
@ -24,26 +24,44 @@ public class Seq
// 机器标识
private static final String machineCode = "A";
// 成品出库记录序列类型
public static final String productOutstockSeqType = "PRODUCTOUTSTOCK";
// 成品出库记录接口序列数
private static AtomicInteger productOutstockSeq = new AtomicInteger(1);
// 成品出库记录标识
public static final String productOutstockCode = "PO";
// 原材料退库记录序列类型
public static final String rawReturnSeqType = "RAWRETURN";
// 原材料退库记录接口序列数
private static AtomicInteger rawReturnSeq = new AtomicInteger(1);
// 原材料退库记录标识
public static final String rawReturnCode = "RR";
/**
*
*
*
* @return
*/
public static String getId()
{
public static String getId() {
return getId(commSeqType);
}
/**
* 16 yyMMddHHmmss + + 3
*
*
* @return
*/
public static String getId(String type)
{
public static String getId(String type) {
AtomicInteger atomicInt = commSeq;
if (uploadSeqType.equals(type))
{
if (uploadSeqType.equals(type)) {
atomicInt = uploadSeq;
}
return getId(atomicInt, 3);
@ -51,13 +69,12 @@ public class Seq
/**
* yyMMddHHmmss + + length
*
*
* @param atomicInt
* @param length
* @param length
* @return
*/
public static String getId(AtomicInteger atomicInt, int length)
{
public static String getId(AtomicInteger atomicInt, int length) {
String result = DateUtils.dateTimeNow();
result += machineCode;
result += getSeq(atomicInt, length);
@ -66,21 +83,51 @@ public class Seq
/**
* [1, 10 (length)), 0length
*
*
* @return
*/
private synchronized static String getSeq(AtomicInteger atomicInt, int length)
{
private synchronized static String getSeq(AtomicInteger atomicInt, int length) {
// 先取值再+1
int value = atomicInt.getAndIncrement();
// 如果更新后值>=10 的 (length)幂次方则重置为1
int maxSeq = (int) Math.pow(10, length);
if (atomicInt.get() >= maxSeq)
{
if (atomicInt.get() >= maxSeq) {
atomicInt.set(1);
}
// 转字符串用0左补齐
return StringUtils.padl(value, length);
}
/**
* 16 yyMMddHHmmss + + 3
*
* @return
*/
public static String getId(String type,String code) {
AtomicInteger atomicInt = commSeq;
if (productOutstockSeqType.equals(type)) {
atomicInt = productOutstockSeq;
}else if (rawReturnSeqType.equals(type)) {
atomicInt = rawReturnSeq;
}
return getId(atomicInt, 3,code);
}
/**
* yyMMddHHmmss + + length
*
* @param atomicInt
* @param length
* @return
*/
public static String getId(AtomicInteger atomicInt, int length, String code) {
String result = DateUtils.dateTimeNow();
result += code;
result += getSeq(atomicInt, length);
return result;
}
}

@ -12,10 +12,12 @@ import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.*;
import com.hw.wms.service.*;
import javafx.scene.control.Tab;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -40,6 +42,12 @@ public class WmsMobileController extends BaseController {
@Autowired
private IWmsProductInstockService wmsProductInstockService;
@Autowired
private IWmsProductOutstockService wmsProductOutstockService;
@Autowired
private IWmsProductOutstockDetailService wmsProductOutstockDetailService;
@Autowired
private IWmsMoveMergeService wmsMoveMergeService;
@ -68,12 +76,12 @@ public class WmsMobileController extends BaseController {
*/
// @RequiresPermissions("wms:rawoutstock:list")
@GetMapping("/getToAuditedRawOutstocks")
public AjaxResult getToAuditedRawOutstocks() {
public TableDataInfo getToAuditedRawOutstocks() {
startPage();
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT);
List<WmsRawOutstock> list = wmsRawOutstockService.selectWmsRawOutstockList(wmsRawOutstock);
return success(list);
return getDataTable(list);
}
/**
@ -98,13 +106,13 @@ public class WmsMobileController extends BaseController {
*
*/
// @RequiresPermissions("wms:rawoutstock:list")
@PostMapping("/getAuditPassRawOutstockDetails")
public AjaxResult getAuditPassRawOutstockDetails(@Validated @RequestBody WmsRawOutstockDetailVo wmsRawOutstockDetailVo) {
@GetMapping("/getAuditPassRawOutstockDetails")
public TableDataInfo getAuditPassRawOutstockDetails(WmsRawOutstockDetail wmsRawOutstockDetail) {
startPage();
WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail();
wmsRawOutstockDetail.setApplyBy(wmsRawOutstockDetailVo.getApplyBy());
// WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail();
// wmsRawOutstockDetail.setApplyBy(request.getParameter("applyBy"));
List<WmsRawOutstockDetail> list = wmsRawOutstockService.selectAuditPassRawOutstockDetails(wmsRawOutstockDetail);
return success(list);
return getDataTable(list);
}
/**
@ -122,12 +130,12 @@ public class WmsMobileController extends BaseController {
*/
// @RequiresPermissions("wms:rawoutstock:list")
@GetMapping("/getToAuditedRawReturns")
public AjaxResult getToAuditedRawReturns() {
public TableDataInfo getToAuditedRawReturns() {
startPage();
WmsRawReturn wmsRawReturn = new WmsRawReturn();
wmsRawReturn.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT);
List<WmsRawReturn> list = wmsRawReturnService.selectWmsRawReturnJoinList(wmsRawReturn);
return success(list);
return getDataTable(list);
}
/**
@ -153,12 +161,12 @@ public class WmsMobileController extends BaseController {
*/
// @RequiresPermissions("wms:rawoutstock:list")
@PostMapping("/getAuditPassRawReturnDetails")
public AjaxResult getAuditPassRawReturnDetails(@Validated @RequestBody WmsRawOutstockDetailVo wmsRawOutstockDetailVo) {
public TableDataInfo getAuditPassRawReturnDetails(WmsRawReturnDetail wmsRawReturnDetail) {
startPage();
WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail();
wmsRawReturnDetail.setApplyBy(wmsRawOutstockDetailVo.getApplyBy());
// WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail();
// wmsRawReturnDetail.setApplyBy(request.getParameter("applyBy"));
List<WmsRawReturnDetail> list = wmsRawReturnService.selectAuditPassRawReturnDetails(wmsRawReturnDetail);
return success(list);
return getDataTable(list);
}
/**
@ -217,11 +225,13 @@ public class WmsMobileController extends BaseController {
* ID
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getProductStock")
public AjaxResult getProductStock(Long warehouseId) {
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setWarehouseId(warehouseId);
return success(wmsProductStockService.selectWmsProductStockJoinList(queryProductStock));
@GetMapping(value = "/getProductStocksByWarehouseId")
public TableDataInfo getProductStocksByWarehouseId( WmsProductStock queryProductStock) {
startPage();
// WmsProductStock queryProductStock = new WmsProductStock();
// queryProductStock.setWarehouseId(Long.valueOf(request.getParameter("warehouseId")));
List list = wmsProductStockService.selectWmsProductStockJoinList(queryProductStock);
return getDataTable(list);
}
@ -240,10 +250,12 @@ public class WmsMobileController extends BaseController {
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getTransfers")
public AjaxResult getTransfers() {
public TableDataInfo getTransfers() {
startPage();
WmsTransfer queryTransfer = new WmsTransfer();
queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
return success(wmsTransferService.selectWmsTransferJoinList(queryTransfer));
List list = wmsTransferService.selectWmsTransferJoinList(queryTransfer);
return getDataTable(list);
}
@ -267,6 +279,84 @@ public class WmsMobileController extends BaseController {
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getProductStocksBySalesorderCode")
public TableDataInfo getProductStocksBySalesorderCode(WmsProductStock queryProductStock) {
startPage();
// WmsProductStock queryProductStock = new WmsProductStock();
// queryProductStock.setSaleorderCode(request.getParameter("salesorderCode"));
// queryProductStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
List list = wmsProductStockService.selectWmsProductStocksBySaleorder(queryProductStock);
return getDataTable(list);
}
/**
* agv
*/
@Log(title = "成品出库记录", businessType = BusinessType.INSERT)
@PostMapping(("/applyProductOutstock"))
public AjaxResult applyProductOutstock(@RequestBody WmsProductOutstock wmsProductOutstock) {
return toAjax(wmsProductOutstockService.insertWmsProductOutstock(wmsProductOutstock));
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getProductOutStocks")
public TableDataInfo getProductOutStocks(WmsProductOutstock queryProductOutstock) {
startPage();
queryProductOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
queryProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
queryProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT);
List list = wmsProductOutstockService.selectWmsProductOutstockJoinList(queryProductOutstock);
return getDataTable(list);
}
/**
* ,productOutstockId
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getProductOutStockWithDetails")
public AjaxResult getProductOutStockWithDetails(WmsProductOutstock queryProductOutstock) {
AjaxResult ajax = AjaxResult.success();
WmsProductOutstock productOutstock = wmsProductOutstockService.
selectWmsProductOutstockJoinByOutstockId(queryProductOutstock.getProductOutstockId());
startPage();
WmsProductOutstockDetail queryProductOutstockDetail = new WmsProductOutstockDetail();
List productOutstockDetails = wmsProductOutstockDetailService.selectWmsProductOutstockDetailList(queryProductOutstockDetail);
ajax.put("productOutstock",productOutstock);
ajax.put("productOutstockDetails",productOutstockDetails);
return ajax;
}
/**
*
*/
@Log(title = "成品出库明细", businessType = BusinessType.INSERT)
@PostMapping(("/confirmProductOutstockDetail"))
public AjaxResult confirmProductOutstockDetail(@RequestBody WmsProductOutstockDetail wmsProductOutstockDetail) {
return toAjax(wmsProductOutstockDetailService.insertWmsProductOutstockDetail(wmsProductOutstockDetail));
}
/**
*
*/

@ -0,0 +1,105 @@
package com.hw.wms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.wms.domain.WmsTransfer;
import com.hw.wms.service.IWmsTransferService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xins
* @date 2024-01-12
*/
@RestController
@RequestMapping("/transfer")
public class WmsTransferController extends BaseController
{
@Autowired
private IWmsTransferService wmsTransferService;
/**
*
*/
@RequiresPermissions("wms:transfer:list")
@GetMapping("/list")
public TableDataInfo list(WmsTransfer wmsTransfer)
{
startPage();
List<WmsTransfer> list = wmsTransferService.selectWmsTransferList(wmsTransfer);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("wms:transfer:export")
@Log(title = "转库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmsTransfer wmsTransfer)
{
List<WmsTransfer> list = wmsTransferService.selectWmsTransferList(wmsTransfer);
ExcelUtil<WmsTransfer> util = new ExcelUtil<WmsTransfer>(WmsTransfer.class);
util.exportExcel(response, list, "转库记录数据");
}
/**
*
*/
@RequiresPermissions("wms:transfer:query")
@GetMapping(value = "/{transferId}")
public AjaxResult getInfo(@PathVariable("transferId") Long transferId)
{
return success(wmsTransferService.selectWmsTransferByTransferId(transferId));
}
/**
*
*/
@RequiresPermissions("wms:transfer:add")
@Log(title = "转库记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsTransfer wmsTransfer)
{
return toAjax(wmsTransferService.insertWmsTransfer(wmsTransfer));
}
/**
*
*/
@RequiresPermissions("wms:transfer:edit")
@Log(title = "转库记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsTransfer wmsTransfer)
{
return toAjax(wmsTransferService.updateWmsTransfer(wmsTransfer));
}
/**
*
*/
@RequiresPermissions("wms:transfer:remove")
@Log(title = "转库记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{transferIds}")
public AjaxResult remove(@PathVariable Long[] transferIds)
{
return toAjax(wmsTransferService.deleteWmsTransferByTransferIds(transferIds));
}
}

@ -1,5 +1,6 @@
package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
@ -70,6 +71,22 @@ public class WmsProductOutstock extends BaseEntity {
@Excel(name = "计划明细编号,关联pd_base_plan_detail的plan_detail_code")
private String planDetailCode;
private String saleorderCode;
private String projectNo;
private Long productId;
/**
*
* */
private BigDecimal applyQty;
/**
*
* */
private BigDecimal outstockQty;
/**
*
*/
@ -141,6 +158,14 @@ public class WmsProductOutstock extends BaseEntity {
@Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
private String warehouseName;
private String materialCode;
private String materialName;
/**
*
*/
@ -218,6 +243,46 @@ public class WmsProductOutstock extends BaseEntity {
this.planDetailCode = planDetailCode;
}
public String getSaleorderCode() {
return saleorderCode;
}
public void setSaleorderCode(String saleorderCode) {
this.saleorderCode = saleorderCode;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public BigDecimal getApplyQty() {
return applyQty;
}
public void setApplyQty(BigDecimal applyQty) {
this.applyQty = applyQty;
}
public BigDecimal getOutstockQty() {
return outstockQty;
}
public void setOutstockQty(BigDecimal outstockQty) {
this.outstockQty = outstockQty;
}
public void setApplyReason(String applyReason) {
this.applyReason = applyReason;
}
@ -314,6 +379,32 @@ public class WmsProductOutstock extends BaseEntity {
this.wmsProductOutstockDetailList = wmsProductOutstockDetailList;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -10,9 +10,9 @@ import com.hw.common.core.web.domain.BaseEntity;
/**
* wms_product_outstock_detail
*
* @author xs
* @date 2023-12-20
*
* @author xins
* @date 2024-01-16
*/
public class WmsProductOutstockDetail extends BaseEntity
{
@ -33,18 +33,22 @@ public class WmsProductOutstockDetail extends BaseEntity
@Excel(name = "库位编码")
private String locationCode;
/** 销售订单 */
@Excel(name = "销售订单")
private String salesOrder;
/** 成品条码 */
@Excel(name = "成品条码")
private String productBarcode;
/** 项目号 */
@Excel(name = "项目号")
private String projectNo;
/** 成品批次 */
@Excel(name = "成品批次")
private String productBatch;
/** 成品ID */
@Excel(name = "成品ID")
private Long productId;
/** 计划数量 */
@Excel(name = "计划数量")
private BigDecimal planAmount;
/** 出库数量 */
@Excel(name = "出库数量")
private BigDecimal outstockAmount;
@ -72,120 +76,129 @@ public class WmsProductOutstockDetail extends BaseEntity
@Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
public void setProductOutstockDetailId(Long productOutstockDetailId)
public void setProductOutstockDetailId(Long productOutstockDetailId)
{
this.productOutstockDetailId = productOutstockDetailId;
}
public Long getProductOutstockDetailId()
public Long getProductOutstockDetailId()
{
return productOutstockDetailId;
}
public void setProductOutstockId(Long productOutstockId)
public void setProductOutstockId(Long productOutstockId)
{
this.productOutstockId = productOutstockId;
}
public Long getProductOutstockId()
public Long getProductOutstockId()
{
return productOutstockId;
}
public void setWarehouseId(Long warehouseId)
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
public Long getWarehouseId()
{
return warehouseId;
}
public void setLocationCode(String locationCode)
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
public String getLocationCode()
{
return locationCode;
}
public void setSalesOrder(String salesOrder)
public void setProductBarcode(String productBarcode)
{
this.salesOrder = salesOrder;
this.productBarcode = productBarcode;
}
public String getSalesOrder()
public String getProductBarcode()
{
return salesOrder;
return productBarcode;
}
public void setProjectNo(String projectNo)
public void setProductBatch(String productBatch)
{
this.projectNo = projectNo;
this.productBatch = productBatch;
}
public String getProjectNo()
public String getProductBatch()
{
return projectNo;
return productBatch;
}
public void setProductId(Long productId)
public void setProductId(Long productId)
{
this.productId = productId;
}
public Long getProductId()
public Long getProductId()
{
return productId;
}
public void setOutstockAmount(BigDecimal outstockAmount)
public void setPlanAmount(BigDecimal planAmount)
{
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount()
{
return planAmount;
}
public void setOutstockAmount(BigDecimal outstockAmount)
{
this.outstockAmount = outstockAmount;
}
public BigDecimal getOutstockAmount()
public BigDecimal getOutstockAmount()
{
return outstockAmount;
}
public void setExecuteStatus(String executeStatus)
public void setExecuteStatus(String executeStatus)
{
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
public String getExecuteStatus()
{
return executeStatus;
}
public void setErpStatus(String erpStatus)
public void setErpStatus(String erpStatus)
{
this.erpStatus = erpStatus;
}
public String getErpStatus()
public String getErpStatus()
{
return erpStatus;
}
public void 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;
}
@ -197,9 +210,10 @@ public class WmsProductOutstockDetail extends BaseEntity
.append("productOutstockId", getProductOutstockId())
.append("warehouseId", getWarehouseId())
.append("locationCode", getLocationCode())
.append("salesOrder", getSalesOrder())
.append("projectNo", getProjectNo())
.append("productBarcode", getProductBarcode())
.append("productBatch", getProductBatch())
.append("productId", getProductId())
.append("planAmount", getPlanAmount())
.append("outstockAmount", getOutstockAmount())
.append("executeStatus", getExecuteStatus())
.append("erpStatus", getErpStatus())

@ -95,6 +95,11 @@ public class WmsProductStock extends BaseEntity
private String materialName;
private BigDecimal orderAmount;
private String warehouseName;
public void setProductStockId(Long productStockId)
{
this.productStockId = productStockId;
@ -263,6 +268,22 @@ public class WmsProductStock extends BaseEntity
this.materialName = materialName;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
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)

@ -0,0 +1,436 @@
package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* wms_transfer
*
* @author xins
* @date 2024-01-12
*/
public class WmsTransfer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 转库记录ID */
private Long transferId;
/** 任务编号 */
@Excel(name = "任务编号")
private String taskCode;
/** 原仓库ID */
@Excel(name = "原仓库ID")
private Long oriWarehouseId;
/** 原库位编码 */
@Excel(name = "原库位编码")
private String oriLocationCode;
/** 目标仓库ID */
@Excel(name = "目标仓库ID")
private Long targetWarehouseId;
/** 目标库位编码 */
@Excel(name = "目标库位编码")
private String targetLocationCode;
/** 物料ID */
@Excel(name = "物料ID")
private Long materialId;
/** 产品批次号 */
@Excel(name = "产品批次号")
private String productBatch;
/** 计划编号,关联pd_base_plan_info的plan_code */
@Excel(name = "计划编号,关联pd_base_plan_info的plan_code")
private String planCode;
/** 申请数量 */
@Excel(name = "申请数量")
private BigDecimal applyQty;
/** 已出数量 */
@Excel(name = "已出数量")
private BigDecimal outstockQty;
/** 已入数量 */
@Excel(name = "已入数量")
private BigDecimal instockQty;
/** 操作类型(0自动,1人工,2强制,3调度) */
@Excel(name = "操作类型(0自动,1人工,2强制,3调度)")
private String operationType;
/** 转库类型(1、出半成品库入成品库) */
@Excel(name = "转库类型(1、出半成品库入成品库)")
private String transferType;
/** 申请原因 */
@Excel(name = "申请原因")
private String applyReason;
/** 审核原因 */
@Excel(name = "审核原因")
private String auditReason;
/** 审核状态(0待审核,1审核通过,2审核未通过) */
@Excel(name = "审核状态(0待审核,1审核通过,2审核未通过)")
private String auditStatus;
/** 执行状态(0待执行,1待执行,2已完成) */
@Excel(name = "执行状态(0待执行,1待执行,2已完成)")
private String executeStatus;
/** 申请人 */
@Excel(name = "申请人")
private String applyBy;
/** 申请时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date applyDate;
/** 审核人 */
@Excel(name = "审核人")
private String auditBy;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date auditDate;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date beginTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
private String oriWarehouseName;
private String targetWarehouseName;
private String materialCode;
private String materialName;
/** 转库记录明细;移库合库记录对应的明细信息信息 */
private List<WmsTransferDetail> wmsTransferDetailList;
public void setTransferId(Long transferId)
{
this.transferId = transferId;
}
public Long getTransferId()
{
return transferId;
}
public void setTaskCode(String taskCode)
{
this.taskCode = taskCode;
}
public String getTaskCode()
{
return taskCode;
}
public void setOriWarehouseId(Long oriWarehouseId)
{
this.oriWarehouseId = oriWarehouseId;
}
public Long getOriWarehouseId()
{
return oriWarehouseId;
}
public void setOriLocationCode(String oriLocationCode)
{
this.oriLocationCode = oriLocationCode;
}
public String getOriLocationCode()
{
return oriLocationCode;
}
public void setTargetWarehouseId(Long targetWarehouseId)
{
this.targetWarehouseId = targetWarehouseId;
}
public Long getTargetWarehouseId()
{
return targetWarehouseId;
}
public void setTargetLocationCode(String targetLocationCode)
{
this.targetLocationCode = targetLocationCode;
}
public String getTargetLocationCode()
{
return targetLocationCode;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setProductBatch(String productBatch)
{
this.productBatch = productBatch;
}
public String getProductBatch()
{
return productBatch;
}
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
{
return planCode;
}
public void setApplyQty(BigDecimal applyQty)
{
this.applyQty = applyQty;
}
public BigDecimal getApplyQty()
{
return applyQty;
}
public void setOutstockQty(BigDecimal outstockQty)
{
this.outstockQty = outstockQty;
}
public BigDecimal getOutstockQty()
{
return outstockQty;
}
public void setInstockQty(BigDecimal instockQty)
{
this.instockQty = instockQty;
}
public BigDecimal getInstockQty()
{
return instockQty;
}
public void setOperationType(String operationType)
{
this.operationType = operationType;
}
public String getOperationType()
{
return operationType;
}
public void setTransferType(String transferType)
{
this.transferType = transferType;
}
public String getTransferType()
{
return transferType;
}
public void setApplyReason(String applyReason)
{
this.applyReason = applyReason;
}
public String getApplyReason()
{
return applyReason;
}
public void setAuditReason(String auditReason)
{
this.auditReason = auditReason;
}
public String getAuditReason()
{
return auditReason;
}
public void setAuditStatus(String auditStatus)
{
this.auditStatus = auditStatus;
}
public String getAuditStatus()
{
return auditStatus;
}
public void setExecuteStatus(String executeStatus)
{
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
{
return executeStatus;
}
public void setApplyBy(String applyBy)
{
this.applyBy = applyBy;
}
public String getApplyBy()
{
return applyBy;
}
public void setApplyDate(Date applyDate)
{
this.applyDate = applyDate;
}
public Date getApplyDate()
{
return applyDate;
}
public void setAuditBy(String auditBy)
{
this.auditBy = auditBy;
}
public String getAuditBy()
{
return auditBy;
}
public void setAuditDate(Date auditDate)
{
this.auditDate = auditDate;
}
public Date getAuditDate()
{
return auditDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
public void setBeginTime(Date beginTime)
{
this.beginTime = beginTime;
}
public Date getBeginTime()
{
return beginTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public List<WmsTransferDetail> getWmsTransferDetailList()
{
return wmsTransferDetailList;
}
public void setWmsTransferDetailList(List<WmsTransferDetail> wmsTransferDetailList)
{
this.wmsTransferDetailList = wmsTransferDetailList;
}
public String getOriWarehouseName() {
return oriWarehouseName;
}
public void setOriWarehouseName(String oriWarehouseName) {
this.oriWarehouseName = oriWarehouseName;
}
public String getTargetWarehouseName() {
return targetWarehouseName;
}
public void setTargetWarehouseName(String targetWarehouseName) {
this.targetWarehouseName = targetWarehouseName;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("transferId", getTransferId())
.append("taskCode", getTaskCode())
.append("oriWarehouseId", getOriWarehouseId())
.append("oriLocationCode", getOriLocationCode())
.append("targetWarehouseId", getTargetWarehouseId())
.append("targetLocationCode", getTargetLocationCode())
.append("materialId", getMaterialId())
.append("productBatch", getProductBatch())
.append("planCode", getPlanCode())
.append("applyQty", getApplyQty())
.append("outstockQty", getOutstockQty())
.append("instockQty", getInstockQty())
.append("operationType", getOperationType())
.append("transferType", getTransferType())
.append("applyReason", getApplyReason())
.append("auditReason", getAuditReason())
.append("auditStatus", getAuditStatus())
.append("executeStatus", getExecuteStatus())
.append("applyBy", getApplyBy())
.append("applyDate", getApplyDate())
.append("auditBy", getAuditBy())
.append("auditDate", getAuditDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("beginTime", getBeginTime())
.append("endTime", getEndTime())
.append("wmsTransferDetailList", getWmsTransferDetailList())
.toString();
}
}

@ -0,0 +1,255 @@
package com.hw.wms.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* ; wms_transfer_detail
*
* @author xins
* @date 2024-01-12
*/
public class WmsTransferDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 转库记录明细ID */
private Long transferDetailId;
/** 转库ID关联wms_transfer的transfer_id */
@Excel(name = "转库ID关联wms_transfer的transfer_id")
private Long transferId;
/** 库位编码 */
@Excel(name = "库位编码")
private String locationCode;
/** 存放物料条码,入库扫描条码时从打印条码记录表中获取关联条码信息的barcode_info */
@Excel(name = "存放物料条码,入库扫描条码时从打印条码记录表中获取关联条码信息的barcode_info")
private String materialBarcode;
/** 批次;入库扫描条码时,从打印条码记录表中获取,关联条码信息的batch_code */
@Excel(name = "批次;入库扫描条码时,从打印条码记录表中获取,关联条码信息的batch_code")
private String instockBatch;
/** 物料ID */
@Excel(name = "物料ID")
private Long materialId;
/** 计划数量 */
@Excel(name = "计划数量")
private BigDecimal planAmount;
/** 实际数量 */
@Excel(name = "实际数量")
private BigDecimal realAmount;
/** 执行状态(0待执行,1执行中,2执行完成) */
@Excel(name = "执行状态(0待执行,1执行中,2执行完成)")
private String executeStatus;
/** 执行人 */
@Excel(name = "执行人")
private String executePerson;
/** 执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date executeTime;
/** 转明细类型(1出库2入库) */
@Excel(name = "转明细类型(1出库2入库)")
private String transferDetailType;
/** 使用机台名称;入库扫描条码时,从打印条码记录表中获取 */
@Excel(name = "使用机台名称;入库扫描条码时,从打印条码记录表中获取")
private String machineName;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 有效标记 */
@Excel(name = "有效标记")
private String activeFlag;
public void setTransferDetailId(Long transferDetailId)
{
this.transferDetailId = transferDetailId;
}
public Long getTransferDetailId()
{
return transferDetailId;
}
public void setTransferId(Long transferId)
{
this.transferId = transferId;
}
public Long getTransferId()
{
return transferId;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setMaterialBarcode(String materialBarcode)
{
this.materialBarcode = materialBarcode;
}
public String getMaterialBarcode()
{
return materialBarcode;
}
public void setInstockBatch(String instockBatch)
{
this.instockBatch = instockBatch;
}
public String getInstockBatch()
{
return instockBatch;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setPlanAmount(BigDecimal planAmount)
{
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount()
{
return planAmount;
}
public void setRealAmount(BigDecimal realAmount)
{
this.realAmount = realAmount;
}
public BigDecimal getRealAmount()
{
return realAmount;
}
public void setExecuteStatus(String executeStatus)
{
this.executeStatus = executeStatus;
}
public String getExecuteStatus()
{
return executeStatus;
}
public void setExecutePerson(String executePerson)
{
this.executePerson = executePerson;
}
public String getExecutePerson()
{
return executePerson;
}
public void setExecuteTime(Date executeTime)
{
this.executeTime = executeTime;
}
public Date getExecuteTime()
{
return executeTime;
}
public void setTransferDetailType(String transferDetailType)
{
this.transferDetailType = transferDetailType;
}
public String getTransferDetailType()
{
return transferDetailType;
}
public void setMachineName(String machineName)
{
this.machineName = machineName;
}
public String getMachineName()
{
return machineName;
}
public void setCreateDate(Date createDate)
{
this.createDate = createDate;
}
public Date getCreateDate()
{
return createDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
public void setActiveFlag(String activeFlag)
{
this.activeFlag = activeFlag;
}
public String getActiveFlag()
{
return activeFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("transferDetailId", getTransferDetailId())
.append("transferId", getTransferId())
.append("locationCode", getLocationCode())
.append("materialBarcode", getMaterialBarcode())
.append("instockBatch", getInstockBatch())
.append("materialId", getMaterialId())
.append("planAmount", getPlanAmount())
.append("realAmount", getRealAmount())
.append("executeStatus", getExecuteStatus())
.append("executePerson", getExecutePerson())
.append("executeTime", getExecuteTime())
.append("transferDetailType", getTransferDetailType())
.append("machineName", getMachineName())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("activeFlag", getActiveFlag())
.toString();
}
}

@ -100,6 +100,6 @@ public interface WmsBaseWarehouseMapper
* @param warehouseId
* @return
*/
// public WmsBaseWarehouse selectWmsBaseWarehouseByWarehouseId(Long warehouseId);
public WmsBaseWarehouse selectWmsBaseWarehouseByWarehouseId(Long warehouseId);
}

@ -0,0 +1,61 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsProductOutstockDetail;
/**
* Mapper
*
* @author xins
* @date 2024-01-16
*/
public interface WmsProductOutstockDetailMapper
{
/**
*
*
* @param productOutstockDetailId
* @return
*/
public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public List<WmsProductOutstockDetail> selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param productOutstockDetailId
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId);
/**
*
*
* @param productOutstockDetailIds
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds);
}

@ -6,15 +6,15 @@ import com.hw.wms.domain.WmsProductOutstockDetail;
/**
* Mapper
*
*
* @author xs
* @date 2023-12-20
*/
public interface WmsProductOutstockMapper
public interface WmsProductOutstockMapper
{
/**
*
*
*
* @param productOutstockId
* @return
*/
@ -22,7 +22,7 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -30,7 +30,7 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -38,7 +38,7 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -46,7 +46,7 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param productOutstockId
* @return
*/
@ -54,7 +54,7 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param productOutstockIds
* @return
*/
@ -62,26 +62,55 @@ public interface WmsProductOutstockMapper
/**
*
*
*
* @param productOutstockIds
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockIds(Long[] productOutstockIds);
/**
*
*
*
* @param wmsProductOutstockDetailList
* @return
*/
public int batchWmsProductOutstockDetail(List<WmsProductOutstockDetail> wmsProductOutstockDetailList);
/**
*
*
*
* @param productOutstockId ID
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockId(Long productOutstockId);
/**
* ,Join materialwarehouse
*
* @param wmsProductOutstock
* @return
*/
public List<WmsProductOutstock> selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock);
/**
* ,join warehouse,material,
*
* @param productOutstockId
* @return
*/
public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId);
/**
*
*
* @param productOutstockId
* @return
*/
public WmsProductOutstock selectOnlyWmsProductOutstockByOutstockId(Long productOutstockId);
}

@ -97,4 +97,13 @@ public interface WmsProductStockMapper
*/
public List<WmsProductStock> selectWmsProductStockJoinList(WmsProductStock wmsProductStock);
/**
* Join material,warehouse,totalAmount>0
*
* @param wmsProductStock
* @return
*/
public List<WmsProductStock> selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock);
}

@ -0,0 +1,99 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsTransfer;
import com.hw.wms.domain.WmsTransferDetail;
/**
* Mapper
*
* @author xins
* @date 2024-01-12
*/
public interface WmsTransferMapper
{
/**
*
*
* @param transferId
* @return
*/
public WmsTransfer selectWmsTransferByTransferId(Long transferId);
/**
*
*
* @param wmsTransfer
* @return
*/
public List<WmsTransfer> selectWmsTransferList(WmsTransfer wmsTransfer);
/**
*
*
* @param wmsTransfer
* @return
*/
public int insertWmsTransfer(WmsTransfer wmsTransfer);
/**
*
*
* @param wmsTransfer
* @return
*/
public int updateWmsTransfer(WmsTransfer wmsTransfer);
/**
*
*
* @param transferId
* @return
*/
public int deleteWmsTransferByTransferId(Long transferId);
/**
*
*
* @param transferIds
* @return
*/
public int deleteWmsTransferByTransferIds(Long[] transferIds);
/**
* ;
*
* @param transferIds
* @return
*/
public int deleteWmsTransferDetailByTransferIds(Long[] transferIds);
/**
* ;
*
* @param wmsTransferDetailList ;
* @return
*/
public int batchWmsTransferDetail(List<WmsTransferDetail> wmsTransferDetailList);
/**
* ;
*
* @param transferId ID
* @return
*/
public int deleteWmsTransferDetailByTransferId(Long transferId);
/**
* ,Join
*
* @param wmsTransfer
* @return
*/
public List<WmsTransfer> selectWmsTransferJoinList(WmsTransfer wmsTransfer);
}

@ -0,0 +1,61 @@
package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsProductOutstockDetail;
/**
* Service
*
* @author xins
* @date 2024-01-16
*/
public interface IWmsProductOutstockDetailService
{
/**
*
*
* @param productOutstockDetailId
* @return
*/
public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public List<WmsProductOutstockDetail> selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail);
/**
*
*
* @param productOutstockDetailIds
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds);
/**
*
*
* @param productOutstockDetailId
* @return
*/
public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId);
}

@ -5,15 +5,15 @@ import com.hw.wms.domain.WmsProductOutstock;
/**
* Service
*
*
* @author xs
* @date 2023-12-20
*/
public interface IWmsProductOutstockService
public interface IWmsProductOutstockService
{
/**
*
*
*
* @param productOutstockId
* @return
*/
@ -21,7 +21,7 @@ public interface IWmsProductOutstockService
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -29,7 +29,7 @@ public interface IWmsProductOutstockService
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -37,7 +37,7 @@ public interface IWmsProductOutstockService
/**
*
*
*
* @param wmsProductOutstock
* @return
*/
@ -45,7 +45,7 @@ public interface IWmsProductOutstockService
/**
*
*
*
* @param productOutstockIds
* @return
*/
@ -53,9 +53,25 @@ public interface IWmsProductOutstockService
/**
*
*
*
* @param productOutstockId
* @return
*/
public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId);
/**
* Join materialwarehouse
*
* @param wmsProductOutstock
* @return
*/
public List<WmsProductOutstock> selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock);
/**
* ,join warehouse,material,
*
* @param productOutstockId
* @return
*/
public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId);
}

@ -66,4 +66,12 @@ public interface IWmsProductStockService
* @return
*/
public List<WmsProductStock> selectWmsProductStockJoinList(WmsProductStock wmsProductStock);
/**
* Join material,warehouse,totalAmount>0
*
* @param wmsProductStock
* @return
*/
public List<WmsProductStock> selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock);
}

@ -0,0 +1,97 @@
package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsTransfer;
import com.hw.wms.domain.WmsTransferDetail;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author xins
* @date 2024-01-12
*/
public interface IWmsTransferService
{
/**
*
*
* @param transferId
* @return
*/
public WmsTransfer selectWmsTransferByTransferId(Long transferId);
/**
*
*
* @param wmsTransfer
* @return
*/
public List<WmsTransfer> selectWmsTransferList(WmsTransfer wmsTransfer);
/**
*
*
* @param wmsTransfer
* @return
*/
public int insertWmsTransfer(WmsTransfer wmsTransfer);
/**
*
*
* @param wmsTransfer
* @return
*/
public int updateWmsTransfer(WmsTransfer wmsTransfer);
/**
*
*
* @param transferIds
* @return
*/
public int deleteWmsTransferByTransferIds(Long[] transferIds);
/**
*
*
* @param transferId
* @return
*/
public int deleteWmsTransferByTransferId(Long transferId);
/**
*
*
* @param wmsTransfers
* @return
*/
public int applyTransfers(List<WmsTransfer> wmsTransfers);
/**
* Join
*
* @param wmsTransfer
* @return
*/
public List<WmsTransfer> selectWmsTransferJoinList(WmsTransfer wmsTransfer);
/**
*
* @param wmsTransferDetail
* @return
*/
public int transferOutstock(WmsTransferDetail wmsTransferDetail);
/**
*
* @param wmsTransferDetail
* @return
*/
public int transferInstock(WmsTransferDetail wmsTransferDetail);
}

@ -0,0 +1,190 @@
package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.wms.domain.WmsBaseLocation;
import com.hw.wms.domain.WmsProductOutstock;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.mapper.WmsBaseLocationMapper;
import com.hw.wms.mapper.WmsProductOutstockMapper;
import com.hw.wms.mapper.WmsProductStockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsProductOutstockDetailMapper;
import com.hw.wms.domain.WmsProductOutstockDetail;
import com.hw.wms.service.IWmsProductOutstockDetailService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author xins
* @date 2024-01-16
*/
@Service
public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockDetailService {
@Autowired
private WmsProductOutstockDetailMapper wmsProductOutstockDetailMapper;
@Autowired
private WmsProductOutstockMapper wmsProductOutstockMapper;
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
/**
*
*
* @param productOutstockDetailId
* @return
*/
@Override
public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId) {
return wmsProductOutstockDetailMapper.selectWmsProductOutstockDetailByProductOutstockDetailId(productOutstockDetailId);
}
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
@Override
public List<WmsProductOutstockDetail> selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail) {
return wmsProductOutstockDetailMapper.selectWmsProductOutstockDetailList(wmsProductOutstockDetail);
}
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail) {
String locationCode = wmsProductOutstockDetail.getLocationCode();
String productBarcode = wmsProductOutstockDetail.getProductBarcode();
String productBatch = wmsProductOutstockDetail.getProductBatch();
Long productOutstockId = wmsProductOutstockDetail.getProductOutstockId();
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (location == null) {
throw new ServiceException(String.format("库位编码%1$s错误", locationCode));
}
WmsProductOutstock productOutstock = wmsProductOutstockMapper.selectOnlyWmsProductOutstockByOutstockId(productOutstockId);
if (productOutstock == null) {
throw new ServiceException("没有此成品出库任务信息");
}
if (!productOutstock.getWarehouseId().equals(location.getWarehouseId())) {
throw new ServiceException("没有此仓库出库任务");
}
if (productOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) {
throw new ServiceException("此出库申请已完成,不能再出库");
}
WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch, WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
if (productStock == null) {
throw new ServiceException("此库位没有库存");
}
BigDecimal totalAmount = productStock.getTotalAmount();
BigDecimal frozenAmount = productStock.getFrozenAmount() == null ? BigDecimal.ZERO : productStock.getFrozenAmount();
BigDecimal occupyAmount = productStock.getOccupyAmount() == null ? BigDecimal.ZERO : productStock.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount);
if (availableAmount.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("此库位没有可出库存");
}
BigDecimal applyQty = productOutstock.getApplyQty() == null ? BigDecimal.ZERO : productOutstock.getApplyQty();
BigDecimal outstockQty = productOutstock.getOutstockQty() == null ? BigDecimal.ZERO : productOutstock.getOutstockQty();
BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE);
if (applyQty.compareTo(currentOutstockQty) < 0) {
throw new ServiceException(String.format("出库申请数量为%1$s不能再出库", applyQty));
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
//更新出库记录
if (applyQty.compareTo(currentOutstockQty) == 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
productOutstock.setEndTime(currentDate);
} else if (applyQty.compareTo(currentOutstockQty) > 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
}
productOutstock.setOutstockQty(currentOutstockQty);
if(productOutstock.getBeginTime()==null) {
productOutstock.setBeginTime(currentDate);
}
productOutstock.setUpdateDate(currentDate);
productOutstock.setUpdateBy(userName);
wmsProductOutstockMapper.updateWmsProductOutstock(productOutstock);
//更新库存
productStock.setTotalAmount(totalAmount.subtract(BigDecimal.ONE));
productStock.setUpdateBy(userName);
productStock.setUpdateDate(currentDate);
wmsProductStockMapper.updateWmsProductStock(productStock);
//插入出库记录明细
wmsProductOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsProductOutstockDetail.setBeginTime(currentDate);
wmsProductOutstockDetail.setEndTime(currentDate);
wmsProductOutstockDetail.setWarehouseId(location.getWarehouseId());
wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE);
wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE);
wmsProductOutstockDetailMapper.insertWmsProductOutstockDetail(wmsProductOutstockDetail);
//todo:同步erp
return 1;
}
/**
*
*
* @param wmsProductOutstockDetail
* @return
*/
@Override
public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail) {
return wmsProductOutstockDetailMapper.updateWmsProductOutstockDetail(wmsProductOutstockDetail);
}
/**
*
*
* @param productOutstockDetailIds
* @return
*/
@Override
public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds) {
return wmsProductOutstockDetailMapper.deleteWmsProductOutstockDetailByProductOutstockDetailIds(productOutstockDetailIds);
}
/**
*
*
* @param productOutstockDetailId
* @return
*/
@Override
public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId) {
return wmsProductOutstockDetailMapper.deleteWmsProductOutstockDetailByProductOutstockDetailId(productOutstockDetailId);
}
}

@ -1,9 +1,22 @@
package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.WmsConstants;
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.wms.domain.WmsBaseWarehouse;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.mapper.WmsBaseWarehouseMapper;
import com.hw.wms.mapper.WmsProductStockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.wms.domain.WmsProductOutstockDetail;
@ -18,11 +31,16 @@ import com.hw.wms.service.IWmsProductOutstockService;
* @date 2023-12-20
*/
@Service
public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
{
public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService {
@Autowired
private WmsProductOutstockMapper wmsProductOutstockMapper;
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Autowired
private WmsBaseWarehouseMapper wmsBaseWarehouseMapper;
/**
*
*
@ -30,8 +48,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
* @return
*/
@Override
public WmsProductOutstock selectWmsProductOutstockByProductOutstockId(Long productOutstockId)
{
public WmsProductOutstock selectWmsProductOutstockByProductOutstockId(Long productOutstockId) {
return wmsProductOutstockMapper.selectWmsProductOutstockByProductOutstockId(productOutstockId);
}
@ -42,8 +59,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
* @return
*/
@Override
public List<WmsProductOutstock> selectWmsProductOutstockList(WmsProductOutstock wmsProductOutstock)
{
public List<WmsProductOutstock> selectWmsProductOutstockList(WmsProductOutstock wmsProductOutstock) {
return wmsProductOutstockMapper.selectWmsProductOutstockList(wmsProductOutstock);
}
@ -53,12 +69,62 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
* @param wmsProductOutstock
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertWmsProductOutstock(WmsProductOutstock wmsProductOutstock)
{
public int insertWmsProductOutstock(WmsProductOutstock wmsProductOutstock) {
Long warehouseId = wmsProductOutstock.getWarehouseId();
String saleorderCode = wmsProductOutstock.getSaleorderCode();
Long productId = wmsProductOutstock.getProductId();
BigDecimal applyQty = wmsProductOutstock.getApplyQty();
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setWarehouseId(warehouseId);
queryProductStock.setSaleorderCode(saleorderCode);
queryProductStock.setProductId(productId);
List<WmsProductStock> productStocks = wmsProductStockMapper.selectWmsProductStocksBySaleorder(queryProductStock);
if (productStocks == null || productStocks.isEmpty()) {
throw new ServiceException("没有库存");
}
WmsProductStock productStock = productStocks.get(0);
BigDecimal orderAmount = productStock.getOrderAmount();
/*获取仓库可用库存数量*/
BigDecimal totalAmount = productStock.getTotalAmount() == null ? BigDecimal.ZERO : productStock.getTotalAmount();
BigDecimal frozenAmount = productStock.getFrozenAmount() == null ? BigDecimal.ZERO : productStock.getFrozenAmount();
BigDecimal occupyAmount = productStock.getOccupyAmount() == null ? BigDecimal.ZERO : productStock.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount);
/*获取已申请出库数量*/
WmsProductOutstock queryProductOutStock = new WmsProductOutstock();
queryProductOutStock.setSaleorderCode(saleorderCode);
List<WmsProductOutstock> wmsProductOutstocks = wmsProductOutstockMapper.selectWmsProductOutstockList(queryProductOutStock);
BigDecimal sumApplyQty = wmsProductOutstocks.stream().map(WmsProductOutstock::getApplyQty).reduce(BigDecimal.ZERO, BigDecimal::add);
//可申请数量
BigDecimal availableApplyQty = availableAmount.subtract(sumApplyQty);
if (applyQty.compareTo(availableApplyQty) > 0) {
throw new ServiceException("可申请数量为" + availableApplyQty);
}
WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String operationType = warehouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)
? WmsConstants.WMS_OPERATION_TYPE_MANUAL : WmsConstants.WMS_OPERATION_TYPE_AUTO;
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
wmsProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT);
wmsProductOutstock.setOperationType(operationType);
wmsProductOutstock.setOutstockType(WmsConstants.WMS_PRODUCT_OUTSTOCK_TYPE_SALE);
wmsProductOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
wmsProductOutstock.setApplyBy(userName);
wmsProductOutstock.setApplyDate(currentDate);
wmsProductOutstock.setTaskCode(Seq.getId(Seq.productOutstockSeqType, Seq.productOutstockCode));
int rows = wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock);
insertWmsProductOutstockDetail(wmsProductOutstock);
//todo:如果是agv自动仓库需要调用WCS进行调度出库
return rows;
}
@ -70,8 +136,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateWmsProductOutstock(WmsProductOutstock wmsProductOutstock)
{
public int updateWmsProductOutstock(WmsProductOutstock wmsProductOutstock) {
wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockId(wmsProductOutstock.getProductOutstockId());
insertWmsProductOutstockDetail(wmsProductOutstock);
return wmsProductOutstockMapper.updateWmsProductOutstock(wmsProductOutstock);
@ -85,8 +150,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteWmsProductOutstockByProductOutstockIds(Long[] productOutstockIds)
{
public int deleteWmsProductOutstockByProductOutstockIds(Long[] productOutstockIds) {
wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockIds(productOutstockIds);
return wmsProductOutstockMapper.deleteWmsProductOutstockByProductOutstockIds(productOutstockIds);
}
@ -99,8 +163,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId)
{
public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId) {
wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockId(productOutstockId);
return wmsProductOutstockMapper.deleteWmsProductOutstockByProductOutstockId(productOutstockId);
}
@ -110,22 +173,44 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
*
* @param wmsProductOutstock
*/
public void insertWmsProductOutstockDetail(WmsProductOutstock wmsProductOutstock)
{
public void insertWmsProductOutstockDetail(WmsProductOutstock wmsProductOutstock) {
List<WmsProductOutstockDetail> wmsProductOutstockDetailList = wmsProductOutstock.getWmsProductOutstockDetailList();
Long productOutstockId = wmsProductOutstock.getProductOutstockId();
if (StringUtils.isNotNull(wmsProductOutstockDetailList))
{
if (StringUtils.isNotNull(wmsProductOutstockDetailList)) {
List<WmsProductOutstockDetail> list = new ArrayList<WmsProductOutstockDetail>();
for (WmsProductOutstockDetail wmsProductOutstockDetail : wmsProductOutstockDetailList)
{
for (WmsProductOutstockDetail wmsProductOutstockDetail : wmsProductOutstockDetailList) {
wmsProductOutstockDetail.setProductOutstockId(productOutstockId);
list.add(wmsProductOutstockDetail);
}
if (list.size() > 0)
{
if (list.size() > 0) {
wmsProductOutstockMapper.batchWmsProductOutstockDetail(list);
}
}
}
/**
* Join materialwarehouse
*
* @param wmsProductOutstock
* @return
*/
@Override
public List<WmsProductOutstock> selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock) {
return wmsProductOutstockMapper.selectWmsProductOutstockJoinList(wmsProductOutstock);
}
/**
* ,join warehouse,material,
*
* @param productOutstockId
* @return
*/
@Override
public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId) {
return wmsProductOutstockMapper.selectWmsProductOutstockJoinByOutstockId(productOutstockId);
}
}

@ -1,6 +1,12 @@
package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.hw.common.core.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsProductStockMapper;
@ -14,8 +20,7 @@ import com.hw.wms.service.IWmsProductStockService;
* @date 2023-12-20
*/
@Service
public class WmsProductStockServiceImpl implements IWmsProductStockService
{
public class WmsProductStockServiceImpl implements IWmsProductStockService {
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@ -26,8 +31,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public WmsProductStock selectWmsProductStockByProductStockId(Long productStockId)
{
public WmsProductStock selectWmsProductStockByProductStockId(Long productStockId) {
return wmsProductStockMapper.selectWmsProductStockByProductStockId(productStockId);
}
@ -38,8 +42,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public List<WmsProductStock> selectWmsProductStockList(WmsProductStock wmsProductStock)
{
public List<WmsProductStock> selectWmsProductStockList(WmsProductStock wmsProductStock) {
return wmsProductStockMapper.selectWmsProductStockList(wmsProductStock);
}
@ -50,8 +53,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public int insertWmsProductStock(WmsProductStock wmsProductStock)
{
public int insertWmsProductStock(WmsProductStock wmsProductStock) {
return wmsProductStockMapper.insertWmsProductStock(wmsProductStock);
}
@ -62,8 +64,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public int updateWmsProductStock(WmsProductStock wmsProductStock)
{
public int updateWmsProductStock(WmsProductStock wmsProductStock) {
return wmsProductStockMapper.updateWmsProductStock(wmsProductStock);
}
@ -74,8 +75,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public int deleteWmsProductStockByProductStockIds(Long[] productStockIds)
{
public int deleteWmsProductStockByProductStockIds(Long[] productStockIds) {
return wmsProductStockMapper.deleteWmsProductStockByProductStockIds(productStockIds);
}
@ -86,8 +86,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public int deleteWmsProductStockByProductStockId(Long productStockId)
{
public int deleteWmsProductStockByProductStockId(Long productStockId) {
return wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStockId);
}
@ -99,10 +98,23 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService
* @return
*/
@Override
public List<WmsProductStock> selectWmsProductStockJoinList(WmsProductStock wmsProductStock)
{
public List<WmsProductStock> selectWmsProductStockJoinList(WmsProductStock wmsProductStock) {
return wmsProductStockMapper.selectWmsProductStockJoinList(wmsProductStock);
}
/**
* Join material,warehouse,totalAmount>0
*
* @param wmsProductStock
* @return
*/
@Override
public List<WmsProductStock> selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock) {
List<WmsProductStock> list = wmsProductStockMapper.selectWmsProductStocksBySaleorder(wmsProductStock);
if (list == null || list.isEmpty()) {
throw new ServiceException("无此销售订单信息");
}
return list;
}
}

@ -428,7 +428,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
toUpdatedWmsRawReturn.setPlanCode(wmsRawReturn.getPlanCode());
toUpdatedWmsRawReturn.setPlanDetailCode(wmsRawReturn.getPlanDetailCode());
toUpdatedWmsRawReturn.setTaskType(wmsRawReturn.getTaskType());
toUpdatedWmsRawReturn.setTaskCode(Seq.getId());
toUpdatedWmsRawReturn.setTaskCode(Seq.getId(Seq.rawReturnSeqType,Seq.rawReturnCode));
// toUpdatedWmsRawReturn.setProductId();
toUpdatedWmsRawReturn.setApplyReason(wmsRawReturn.getApplyReason());

@ -0,0 +1,381 @@
package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
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.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.wms.domain.WmsBaseLocation;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.mapper.WmsBaseLocationMapper;
import com.hw.wms.mapper.WmsProductStockMapper;
import com.hw.wms.mapper.WmsTransferDetailMapper;
import com.hw.wms.service.IWmsTransactionalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.wms.domain.WmsTransferDetail;
import com.hw.wms.mapper.WmsTransferMapper;
import com.hw.wms.domain.WmsTransfer;
import com.hw.wms.service.IWmsTransferService;
import javax.annotation.Resource;
/**
* Service
*
* @author xins
* @date 2024-01-12
*/
@Service
public class WmsTransferServiceImpl implements IWmsTransferService {
@Autowired
private WmsTransferMapper wmsTransferMapper;
@Autowired
private WmsTransferDetailMapper wmsTransferDetailMapper;
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Autowired
private IWmsTransactionalService wmsTransactionalService;
@Resource
private RemoteMesService remoteMesService;
/**
*
*
* @param transferId
* @return
*/
@Override
public WmsTransfer selectWmsTransferByTransferId(Long transferId) {
return wmsTransferMapper.selectWmsTransferByTransferId(transferId);
}
/**
*
*
* @param wmsTransfer
* @return
*/
@Override
public List<WmsTransfer> selectWmsTransferList(WmsTransfer wmsTransfer) {
return wmsTransferMapper.selectWmsTransferList(wmsTransfer);
}
/**
*
*
* @param wmsTransfer
* @return
*/
@Transactional
@Override
public int insertWmsTransfer(WmsTransfer wmsTransfer) {
int rows = wmsTransferMapper.insertWmsTransfer(wmsTransfer);
insertWmsTransferDetail(wmsTransfer);
return rows;
}
/**
*
*
* @param wmsTransfer
* @return
*/
@Transactional
@Override
public int updateWmsTransfer(WmsTransfer wmsTransfer) {
wmsTransferMapper.deleteWmsTransferDetailByTransferId(wmsTransfer.getTransferId());
insertWmsTransferDetail(wmsTransfer);
return wmsTransferMapper.updateWmsTransfer(wmsTransfer);
}
/**
*
*
* @param transferIds
* @return
*/
@Transactional
@Override
public int deleteWmsTransferByTransferIds(Long[] transferIds) {
wmsTransferMapper.deleteWmsTransferDetailByTransferIds(transferIds);
return wmsTransferMapper.deleteWmsTransferByTransferIds(transferIds);
}
/**
*
*
* @param transferId
* @return
*/
@Transactional
@Override
public int deleteWmsTransferByTransferId(Long transferId) {
wmsTransferMapper.deleteWmsTransferDetailByTransferId(transferId);
return wmsTransferMapper.deleteWmsTransferByTransferId(transferId);
}
/**
* ;
*
* @param wmsTransfer
*/
public void insertWmsTransferDetail(WmsTransfer wmsTransfer) {
List<WmsTransferDetail> wmsTransferDetailList = wmsTransfer.getWmsTransferDetailList();
Long transferId = wmsTransfer.getTransferId();
if (StringUtils.isNotNull(wmsTransferDetailList)) {
List<WmsTransferDetail> list = new ArrayList<WmsTransferDetail>();
for (WmsTransferDetail wmsTransferDetail : wmsTransferDetailList) {
wmsTransferDetail.setTransferId(transferId);
list.add(wmsTransferDetail);
}
if (list.size() > 0) {
wmsTransferMapper.batchWmsTransferDetail(list);
}
}
}
/**
*
*
* @param wmsTransfers
* @return
*/
@Override
public int applyTransfers(List<WmsTransfer> wmsTransfers) {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
//todo:生成任务编号
//需要在循环内执行事务不能用this调用需要新建一个Service
wmsTransfers.forEach(wmsTransfer -> {
wmsTransactionalService.applyTransfer(wmsTransfer, userName, currentDate);
});
return 1;
}
/**
* Join
*
* @param wmsTransfer
* @return
*/
@Override
public List<WmsTransfer> selectWmsTransferJoinList(WmsTransfer wmsTransfer) {
return wmsTransferMapper.selectWmsTransferJoinList(wmsTransfer);
}
/**
*
*
* @param wmsTransferDetail
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int transferOutstock(WmsTransferDetail wmsTransferDetail) {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String locationCode = wmsTransferDetail.getLocationCode();
String materialBarcode = wmsTransferDetail.getMaterialBarcode();
R<MesBaseBarcodeInfo> mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (mesBaseBarcodeInfoR == null) {
throw new ServiceException("物料编码错误");
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData();
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料编码错误");
}
String productBatch = mesBaseBarcodeInfo.getBatchCode();
Long transferId = wmsTransferDetail.getTransferId();
WmsTransfer wmsTransfer;
if (transferId == null) {
WmsTransfer queryTransfer = new WmsTransfer();
queryTransfer.setOriLocationCode(locationCode);
queryTransfer.setProductBatch(productBatch);
queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
List<WmsTransfer> wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer);
if (wmsTransfers == null || wmsTransfers.isEmpty()) {
throw new ServiceException("没有此任务");
}
if (wmsTransfers.size() > 1) {
throw new ServiceException("有多条此库位任务,请选择具体任务后点击出库");
}
wmsTransfer = wmsTransfers.get(0);
} else {
wmsTransfer = wmsTransferMapper.selectWmsTransferByTransferId(transferId);
}
BigDecimal applyQty = wmsTransfer.getApplyQty();
BigDecimal outstockQty = wmsTransfer.getOutstockQty() == null ? BigDecimal.ZERO : wmsTransfer.getOutstockQty();
BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE);
if (applyQty.compareTo(currentOutstockQty) < 0) {
throw new ServiceException("已出库完成,不能多次出库");
}
//插入转库任务明细
wmsTransferDetail.setTransferId(wmsTransfer.getTransferId());
wmsTransferDetail.setInstockBatch(productBatch);
wmsTransferDetail.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
wmsTransferDetail.setRealAmount(BigDecimal.ONE);
wmsTransferDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsTransferDetail.setTransferDetailType(WmsConstants.WMS_TRANSFER_DETAIL_TYPE_OUTSTOCK);
wmsTransferDetail.setCreateBy(userName);
wmsTransferDetail.setCreateDate(currentDate);
wmsTransferDetail.setExecutePerson(userName);
wmsTransferDetail.setExecuteTime(currentDate);
wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail);
//更新转库任务
wmsTransfer.setOutstockQty(currentOutstockQty);
wmsTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
wmsTransfer.setUpdateDate(currentDate);
wmsTransfer.setUpdateBy(userName);
wmsTransferMapper.updateWmsTransfer(wmsTransfer);
//更新成品库存
WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch,WmsConstants.PRODUCT_STOCK_STOCK_TYPE_SEMI);
productStock.setTotalAmount(productStock.getTotalAmount().subtract(BigDecimal.ONE));
productStock.setOccupyAmount(productStock.getOccupyAmount().subtract(BigDecimal.ONE));
productStock.setUpdateDate(currentDate);
productStock.setUpdateBy(userName);
wmsProductStockMapper.updateWmsProductStock(productStock);
return 1;
}
/**
*
*
* @param wmsTransferDetail
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int transferInstock(WmsTransferDetail wmsTransferDetail) {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String locationCode = wmsTransferDetail.getLocationCode();
String materialBarcode = wmsTransferDetail.getMaterialBarcode();
R<MesBaseBarcodeInfo> mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (mesBaseBarcodeInfoR == null) {
throw new ServiceException("物料编码错误");
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData();
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料编码错误");
}
String productBatch = mesBaseBarcodeInfo.getBatchCode();
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
Long warehouseId = location.getWarehouseId();
Long transferId = wmsTransferDetail.getTransferId();
WmsTransfer wmsTransfer;
if (transferId == null) {
WmsTransfer queryTransfer = new WmsTransfer();
queryTransfer.setTargetWarehouseId(warehouseId);
queryTransfer.setProductBatch(productBatch);
queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
List<WmsTransfer> wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer);
if (wmsTransfers == null || wmsTransfers.isEmpty()) {
throw new ServiceException("没有此任务或者还未出库");
}
if (wmsTransfers.size() > 1) {
throw new ServiceException("有多条此库位任务,请选择具体任务后点击出库");
}
wmsTransfer = wmsTransfers.get(0);
} else {
wmsTransfer = wmsTransferMapper.selectWmsTransferByTransferId(transferId);
}
BigDecimal applyQty = wmsTransfer.getApplyQty();
BigDecimal outstockQty = wmsTransfer.getOutstockQty() == null ? BigDecimal.ZERO : wmsTransfer.getOutstockQty();
BigDecimal instockQty = wmsTransfer.getInstockQty();
BigDecimal currentInstockQty = instockQty.add(BigDecimal.ONE);
if (outstockQty.compareTo(currentInstockQty) < 0) {
throw new ServiceException("请先出库再入库");
}
//插入转库任务明细
wmsTransferDetail.setTransferId(wmsTransfer.getTransferId());
wmsTransferDetail.setInstockBatch(productBatch);
wmsTransferDetail.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
wmsTransferDetail.setRealAmount(BigDecimal.ONE);
wmsTransferDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsTransferDetail.setTransferDetailType(WmsConstants.WMS_TRANSFER_DETAIL_TYPE_INSTOCK);
wmsTransferDetail.setCreateBy(userName);
wmsTransferDetail.setCreateDate(currentDate);
wmsTransferDetail.setExecutePerson(userName);
wmsTransferDetail.setExecuteTime(currentDate);
wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail);
//更新转库任务
wmsTransfer.setInstockQty(currentInstockQty);
if (applyQty.compareTo(currentInstockQty) == 0) {//出库和入库都已完成
wmsTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
}
wmsTransfer.setUpdateDate(currentDate);
wmsTransfer.setUpdateBy(userName);
wmsTransferMapper.updateWmsTransfer(wmsTransfer);
//更新成品库存
WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch,WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
if (productStock == null) {
productStock = new WmsProductStock();
productStock.setTotalAmount(BigDecimal.ONE);
productStock.setWarehouseId(warehouseId);
productStock.setLocationCode(locationCode);
productStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
productStock.setProductBatch(productBatch);
// productStock.setQualityStatus();//todo: 获取质检状态
productStock.setProductId(mesBaseBarcodeInfo.getMaterialId());
productStock.setPlanCode(mesBaseBarcodeInfo.getPlanCode());
productStock.setPlanDetailCode(mesBaseBarcodeInfo.getPlanDetailCode());
productStock.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
productStock.setCreateDate(currentDate);
productStock.setCreateBy(userName);
wmsProductStockMapper.insertWmsProductStock(productStock);
} else {
productStock.setTotalAmount(productStock.getTotalAmount().add(BigDecimal.ONE));
productStock.setUpdateDate(currentDate);
productStock.setUpdateBy(userName);
wmsProductStockMapper.updateWmsProductStock(productStock);
}
//TODO:同步ERP库存
return 1;
}
}

@ -270,7 +270,7 @@
</select>
<select id="selectWmsBaseWarehouseByWarehouseId" parameterType="Long" resultMap="WmsBaseWarehouseWmsBaseLocationResult">
<select id="selectWmsBaseWarehouseByWarehouseId" parameterType="Long" resultMap="WmsBaseWarehouseResult">
select a.warehouse_id, a.warehouse_instock_type, a.warehouse_type, a.warehouse_code, a.warehouse_name, a.warehouse_category_id, a.warehouse_floor, a.dept_id, a.multi_row_type, a.multi_side_type, a.batch_mix, a.product_mix, a.workbin_flag, a.warehouse_location, a.active_flag, a.audit_flag, a.return_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.factory_id, a.data_source, a.schame, a.line_flag
from wms_base_warehouse a
where a.warehouse_id = #{warehouseId}

@ -0,0 +1,121 @@
<?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.WmsProductOutstockDetailMapper">
<resultMap type="WmsProductOutstockDetail" id="WmsProductOutstockDetailResult">
<result property="productOutstockDetailId" column="product_outstock_detail_id" />
<result property="productOutstockId" column="product_outstock_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationCode" column="location_code" />
<result property="productBarcode" column="product_barcode" />
<result property="productBatch" column="product_batch" />
<result property="productId" column="product_id" />
<result property="planAmount" column="plan_amount" />
<result property="outstockAmount" column="outstock_amount" />
<result property="executeStatus" column="execute_status" />
<result property="erpStatus" column="erp_status" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
</resultMap>
<sql id="selectWmsProductOutstockDetailVo">
select product_outstock_detail_id, product_outstock_id, warehouse_id, location_code, product_barcode, product_batch, product_id, plan_amount, outstock_amount, execute_status, erp_status, update_by, update_date, begin_time, end_time from wms_product_outstock_detail
</sql>
<select id="selectWmsProductOutstockDetailList" parameterType="WmsProductOutstockDetail" resultMap="WmsProductOutstockDetailResult">
<include refid="selectWmsProductOutstockDetailVo"/>
<where>
<if test="productOutstockId != null "> and product_outstock_id = #{productOutstockId}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="productBarcode != null and productBarcode != ''"> and product_barcode = #{productBarcode}</if>
<if test="productBatch != null and productBatch != ''"> and product_batch = #{productBatch}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="outstockAmount != null "> and outstock_amount = #{outstockAmount}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="erpStatus != null and erpStatus != ''"> and erp_status = #{erpStatus}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="beginTime != null "> and begin_time = #{beginTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
</where>
order by end_time desc
</select>
<select id="selectWmsProductOutstockDetailByProductOutstockDetailId" parameterType="Long" resultMap="WmsProductOutstockDetailResult">
<include refid="selectWmsProductOutstockDetailVo"/>
where product_outstock_detail_id = #{productOutstockDetailId}
</select>
<insert id="insertWmsProductOutstockDetail" parameterType="WmsProductOutstockDetail" useGeneratedKeys="true" keyProperty="productOutstockDetailId">
insert into wms_product_outstock_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productOutstockId != null">product_outstock_id,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="productBarcode != null and productBarcode != ''">product_barcode,</if>
<if test="productBatch != null">product_batch,</if>
<if test="productId != null">product_id,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="outstockAmount != null">outstock_amount,</if>
<if test="executeStatus != null and executeStatus != ''">execute_status,</if>
<if test="erpStatus != null">erp_status,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productOutstockId != null">#{productOutstockId},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="productBarcode != null and productBarcode != ''">#{productBarcode},</if>
<if test="productBatch != null">#{productBatch},</if>
<if test="productId != null">#{productId},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="outstockAmount != null">#{outstockAmount},</if>
<if test="executeStatus != null and executeStatus != ''">#{executeStatus},</if>
<if test="erpStatus != null">#{erpStatus},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</insert>
<update id="updateWmsProductOutstockDetail" parameterType="WmsProductOutstockDetail">
update wms_product_outstock_detail
<trim prefix="SET" suffixOverrides=",">
<if test="productOutstockId != null">product_outstock_id = #{productOutstockId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="productBarcode != null and productBarcode != ''">product_barcode = #{productBarcode},</if>
<if test="productBatch != null">product_batch = #{productBatch},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="outstockAmount != null">outstock_amount = #{outstockAmount},</if>
<if test="executeStatus != null and executeStatus != ''">execute_status = #{executeStatus},</if>
<if test="erpStatus != null">erp_status = #{erpStatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="beginTime != null">begin_time = #{beginTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
</trim>
where product_outstock_detail_id = #{productOutstockDetailId}
</update>
<delete id="deleteWmsProductOutstockDetailByProductOutstockDetailId" parameterType="Long">
delete from wms_product_outstock_detail where product_outstock_detail_id = #{productOutstockDetailId}
</delete>
<delete id="deleteWmsProductOutstockDetailByProductOutstockDetailIds" parameterType="String">
delete from wms_product_outstock_detail where product_outstock_detail_id in
<foreach item="productOutstockDetailId" collection="array" open="(" separator="," close=")">
#{productOutstockDetailId}
</foreach>
</delete>
</mapper>

@ -14,6 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="outstockType" column="outstock_type" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="saleorderCode" column="saleorder_code" />
<result property="projectNo" column="project_no" />
<result property="productId" column="product_id" />
<result property="applyQty" column="apply_qty" />
<result property="outstockQty" column="outstock_qty" />
<result property="applyReason" column="apply_reason" />
<result property="auditReason" column="audit_reason" />
<result property="auditStatus" column="audit_status" />
@ -26,6 +31,9 @@ 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" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<resultMap id="WmsProductOutstockWmsProductOutstockDetailResult" type="WmsProductOutstock" extends="WmsProductOutstockResult">
@ -37,8 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productOutstockId" column="sub_product_outstock_id" />
<result property="warehouseId" column="sub_warehouse_id" />
<result property="locationCode" column="sub_location_code" />
<result property="salesOrder" column="sub_sales_order" />
<result property="projectNo" column="sub_project_no" />
<result property="productId" column="sub_product_id" />
<result property="outstockAmount" column="sub_outstock_amount" />
<result property="executeStatus" column="sub_execute_status" />
@ -50,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsProductOutstockVo">
select product_outstock_id, task_code, warehouse_id, location_code, product_type,operation_type, outstock_type, plan_code, plan_detail_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_outstock
select product_outstock_id, task_code, warehouse_id, location_code, product_type,operation_type, outstock_type, plan_code, plan_detail_code,saleorder_code,project_no, product_id,apply_qty,outstock_qty,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_outstock
</sql>
<select id="selectWmsProductOutstockList" parameterType="WmsProductOutstock" resultMap="WmsProductOutstockResult">
@ -79,8 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectWmsProductOutstockByProductOutstockId" parameterType="Long" resultMap="WmsProductOutstockWmsProductOutstockDetailResult">
select a.product_outstock_id, a.task_code, a.warehouse_id, a.location_code, a.product_type, a.operation_type, a.outstock_type, a.plan_code, a.plan_detail_code, 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.product_outstock_detail_id as sub_product_outstock_detail_id, b.product_outstock_id as sub_product_outstock_id, b.warehouse_id as sub_warehouse_id, b.location_code as sub_location_code, b.sales_order as sub_sales_order, b.project_no as sub_project_no, b.product_id as sub_product_id, b.outstock_amount as sub_outstock_amount, b.execute_status as sub_execute_status, b.erp_status as sub_erp_status, b.update_by as sub_update_by, b.update_date as sub_update_date, b.begin_time as sub_begin_time, b.end_time as sub_end_time
select a.product_outstock_id, a.task_code, a.warehouse_id, a.location_code, a.product_type, a.operation_type, a.outstock_type, a.plan_code, a.plan_detail_code, a.product_id,a.apply_qty,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.product_outstock_detail_id as sub_product_outstock_detail_id, b.product_outstock_id as sub_product_outstock_id, b.warehouse_id as sub_warehouse_id, b.location_code as sub_location_code, b.product_id as sub_product_id, b.outstock_amount as sub_outstock_amount, b.execute_status as sub_execute_status, b.erp_status as sub_erp_status, b.update_by as sub_update_by, b.update_date as sub_update_date, b.begin_time as sub_begin_time, b.end_time as sub_end_time
from wms_product_outstock a
left join wms_product_outstock_detail b on b.product_outstock_id = a.product_outstock_id
where a.product_outstock_id = #{productOutstockId}
@ -97,6 +103,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outstockType != null and outstockType != ''">outstock_type,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="saleorderCode != null">saleorder_code,</if>
<if test="projectNo != null">project_no,</if>
<if test="productId != null">product_id,</if>
<if test="applyQty != null">apply_qty,</if>
<if test="outstockQty != null">outstock_qty,</if>
<if test="applyReason != null">apply_reason,</if>
<if test="auditReason != null">audit_reason,</if>
<if test="auditStatus != null">audit_status,</if>
@ -119,6 +130,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outstockType != null and outstockType != ''">#{outstockType},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="saleorderCode != null">#{saleorderCode},</if>
<if test="projectNo != null">#{projectNo},</if>
<if test="productId != null">#{productId},</if>
<if test="applyQty != null">#{applyQty},</if>
<if test="outstockQty != null">#{outstockQty},</if>
<if test="applyReason != null">#{applyReason},</if>
<if test="auditReason != null">#{auditReason},</if>
<if test="auditStatus != null">#{auditStatus},</if>
@ -145,6 +161,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outstockType != null and outstockType != ''">outstock_type = #{outstockType},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="applyQty != null">apply_qty = #{applyQty},</if>
<if test="outstockQty != null">outstock_qty = #{outstockQty},</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>
@ -189,4 +210,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.productOutstockDetailId}, #{item.productOutstockId}, #{item.warehouseId}, #{item.locationCode}, #{item.salesOrder}, #{item.projectNo}, #{item.productId}, #{item.outstockAmount}, #{item.executeStatus}, #{item.erpStatus}, #{item.updateBy}, #{item.updateDate}, #{item.beginTime}, #{item.endTime})
</foreach>
</insert>
<select id="selectWmsProductOutstockJoinList" parameterType="WmsProductOutstock" resultMap="WmsProductOutstockResult">
select wpo.product_outstock_id, wpo.task_code, wpo.warehouse_id, wpo.location_code, wpo.product_type,wpo.operation_type, wpo.outstock_type,
wpo.plan_code, wpo.plan_detail_code,wpo.saleorder_code, wpo.product_id,wpo.apply_qty,wpo.outstock_qty,wpo.apply_reason, wpo.execute_status,wpo.apply_by, wpo.apply_date,
wbw.warehouse_name,mbmi.material_code,mbmi.material_name
from wms_product_outstock wpo left join wms_base_warehouse wbw on wpo.warehouse_id =wbw.warehouse_id
left join mes_base_material_info mbmi on wpo.product_id = mbmi.material_id
<where>
<if test="taskCode != null and taskCode != ''"> and wpo.task_code = #{taskCode}</if>
<if test="warehouseId != null "> and wpo.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''"> and wpo.location_code = #{locationCode}</if>
<if test="productType != null and productType != ''"> and wpo.product_type = #{productType}</if>
<if test="operationType != null and operationType != ''"> and wpo.operation_type = #{operationType}</if>
<if test="outstockType != null and outstockType != ''"> and wpo.outstock_type = #{outstockType}</if>
<if test="planCode != null "> and wpo.plan_code = #{planCode}</if>
<if test="planDetailCode != null "> and wpo.plan_detail_code = #{planDetailCode}</if>
<if test="applyReason != null and applyReason != ''"> and wpo.apply_reason = #{applyReason}</if>
<if test="auditReason != null and auditReason != ''"> and wpo.audit_reason = #{auditReason}</if>
<if test="auditStatus != null and auditStatus != ''"> and wpo.audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and wpo.execute_status = #{executeStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus == 'notFinish'"> and (wpo.execute_status = '0' or wpo.execute_status = '1')</if>
<if test="applyBy != null and applyBy != ''"> and wpo.apply_by = #{applyBy}</if>
<if test="applyDate != null "> and wpo.apply_date = #{applyDate}</if>
<if test="auditBy != null and auditBy != ''"> and wpo.audit_by = #{auditBy}</if>
<if test="auditDate != null "> and wpo.audit_date = #{auditDate}</if>
<if test="updateDate != null "> and wpo.update_date = #{updateDate}</if>
<if test="beginTime != null "> and wpo.begin_time = #{beginTime}</if>
<if test="endTime != null "> and wpo.end_time = #{endTime}</if>
</where>
</select>
<select id="selectWmsProductOutstockJoinByOutstockId" parameterType="WmsProductOutstock" resultMap="WmsProductOutstockResult">
select wpo.product_outstock_id, wpo.task_code, wpo.warehouse_id, wpo.location_code, wpo.product_type,wpo.operation_type, wpo.outstock_type,
wpo.plan_code, wpo.plan_detail_code,wpo.saleorder_code, wpo.product_id,wpo.apply_qty,wpo.outstock_qty,wpo.apply_reason, wpo.execute_status,wpo.apply_by, wpo.apply_date,
wbw.warehouse_name,mbmi.material_code,mbmi.material_name
from wms_product_outstock wpo left join wms_base_warehouse wbw on wpo.warehouse_id =wbw.warehouse_id
left join mes_base_material_info mbmi on wpo.product_id = mbmi.material_id
where wpo.product_outstock_id = #{productOutstockId}
</select>
<select id="selectOnlyWmsProductOutstockByOutstockId" parameterType="Long" resultMap="WmsProductOutstockResult">
select a.product_outstock_id, a.task_code, a.warehouse_id, a.location_code, a.product_type, a.operation_type, a.outstock_type, a.plan_code, a.plan_detail_code, a.product_id,a.apply_qty,a.outstock_qty,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
from wms_product_outstock a
where a.product_outstock_id = #{productOutstockId}
</select>
</mapper>

@ -26,10 +26,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="instockDate" column="instock_date" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="orderAmount" column="order_amount" />
<result property="warehouseName" column="warehouse_name" />
</resultMap>
<sql id="selectWmsProductStockVo">
select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock
select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code,saleorder_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock
</sql>
<select id="selectWmsProductStockList" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
@ -43,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productId != null "> and product_id = #{productId}</if>
<if test="planCode != null "> and plan_code = #{planCode}</if>
<if test="planDetailCode != null "> and plan_detail_code = #{planDetailCode}</if>
<if test="saleorderCode != null "> and saleorder_code = #{saleorderCode}</if>
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
<if test="frozenAmount != null "> and frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null "> and occupy_amount = #{occupyAmount}</if>
@ -189,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select wps.product_stock_id, wps.warehouse_id, wps.location_code, wps.stock_type, wps.product_batch, wps.quality_status, wps.product_id,
wps.plan_code, wps.plan_detail_code, wps.total_amount, wps.frozen_amount, wps.occupy_amount, wps.active_flag, wps.instock_date,
mai.material_code,mai.material_name
from wms_product_stock wps left join mes_material_info mai on wps.product_id = mai.material_id
from wms_product_stock wps left join mes_base_material_info mai on wps.product_id = mai.material_id
<where>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
@ -211,7 +214,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectWmsProductStocksBySaleorder" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
select wgb.warehouse_id,wgb.saleorder_code,wgb.product_id,mso.order_amount,wgb.total_amount,wgb.frozen_amount,wgb.occupy_amount,wbw.warehouse_name,mbmi.material_code,mbmi.material_name from mes_sale_order mso left join
(select wps.warehouse_id,wps.saleorder_code,wps.product_id,sum(total_amount) total_amount,sum(frozen_amount) frozen_amount,sum(occupy_amount) occupy_amount from wms_product_stock wps where wps.total_amount>0 and wps.stock_type='3'
group by wps.warehouse_id,wps.saleorder_code,wps.product_id) wgb
on mso.saleorder_code=wgb.saleorder_code
left join wms_base_warehouse wbw on wgb.warehouse_id=wbw.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id=mso.material_id
<where>
<if test="saleorderCode != null and saleorderCode != ''"> and mso.saleorder_code = #{saleorderCode}</if>
<if test="warehouseId != null ">and wgb.warehouse_id = #{warehouseId}</if>
<if test="productId != null ">and wgb.product_id = #{productId}</if>
</where>
</select>
</mapper>

@ -0,0 +1,270 @@
<?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.WmsTransferMapper">
<resultMap type="WmsTransfer" id="WmsTransferResult">
<result property="transferId" column="transfer_id" />
<result property="taskCode" column="task_code" />
<result property="oriWarehouseId" column="ori_warehouse_id" />
<result property="oriLocationCode" column="ori_location_code" />
<result property="targetWarehouseId" column="target_warehouse_id" />
<result property="targetLocationCode" column="target_location_code" />
<result property="materialId" column="material_id" />
<result property="productBatch" column="product_batch" />
<result property="planCode" column="plan_code" />
<result property="applyQty" column="apply_qty" />
<result property="outstockQty" column="outstock_qty" />
<result property="instockQty" column="instock_qty" />
<result property="operationType" column="operation_type" />
<result property="transferType" column="transfer_type" />
<result property="applyReason" column="apply_reason" />
<result property="auditReason" column="audit_reason" />
<result property="auditStatus" column="audit_status" />
<result property="executeStatus" column="execute_status" />
<result property="applyBy" column="apply_by" />
<result property="applyDate" column="apply_date" />
<result property="auditBy" column="audit_by" />
<result property="auditDate" column="audit_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
<result property="oriWarehouseName" column="ori_warehouse_name" />
<result property="targetWarehouseName" column="target_warehouse_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<resultMap id="WmsTransferWmsTransferDetailResult" type="WmsTransfer" extends="WmsTransferResult">
<collection property="wmsTransferDetailList" notNullColumn="sub_transfer_detail_id" javaType="java.util.List" resultMap="WmsTransferDetailResult" />
</resultMap>
<resultMap type="WmsTransferDetail" id="WmsTransferDetailResult">
<result property="transferDetailId" column="sub_transfer_detail_id" />
<result property="transferId" column="sub_transfer_id" />
<result property="locationCode" column="sub_location_code" />
<result property="materialBarcode" column="sub_material_barcode" />
<result property="instockBatch" column="sub_instock_batch" />
<result property="materialId" column="sub_material_id" />
<result property="planAmount" column="sub_plan_amount" />
<result property="realAmount" column="sub_real_amount" />
<result property="executeStatus" column="sub_execute_status" />
<result property="executePerson" column="sub_execute_person" />
<result property="executeTime" column="sub_execute_time" />
<result property="transferDetailType" column="sub_transfer_detail_type" />
<result property="machineName" column="sub_machine_name" />
<result property="createBy" column="sub_create_by" />
<result property="createDate" column="sub_create_date" />
<result property="updateBy" column="sub_update_by" />
<result property="updateDate" column="sub_update_date" />
<result property="activeFlag" column="sub_active_flag" />
</resultMap>
<sql id="selectWmsTransferVo">
select transfer_id, task_code, ori_warehouse_id, ori_location_code, target_warehouse_id, target_location_code, material_id, product_batch, plan_code, apply_qty, outstock_qty, instock_qty, operation_type, transfer_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_transfer
</sql>
<select id="selectWmsTransferList" parameterType="WmsTransfer" resultMap="WmsTransferResult">
<include refid="selectWmsTransferVo"/>
<where>
<if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
<if test="oriWarehouseId != null "> and ori_warehouse_id = #{oriWarehouseId}</if>
<if test="oriLocationCode != null and oriLocationCode != ''"> and ori_location_code = #{oriLocationCode}</if>
<if test="targetWarehouseId != null "> and target_warehouse_id = #{targetWarehouseId}</if>
<if test="targetLocationCode != null and targetLocationCode != ''"> and target_location_code = #{targetLocationCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="productBatch != null and productBatch != ''"> and product_batch = #{productBatch}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="applyQty != null "> and apply_qty = #{applyQty}</if>
<if test="outstockQty != null "> and outstock_qty = #{outstockQty}</if>
<if test="instockQty != null "> and instock_qty = #{instockQty}</if>
<if test="operationType != null and operationType != ''"> and operation_type = #{operationType}</if>
<if test="transferType != null and transferType != ''"> and transfer_type = #{transferType}</if>
<if test="applyReason != null and applyReason != ''"> and apply_reason = #{applyReason}</if>
<if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and execute_status = #{executeStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus == 'notFinish'"> and (execute_status = '0' or execute_status = '1')</if>
<if test="applyBy != null and applyBy != ''"> and apply_by = #{applyBy}</if>
<if test="applyDate != null "> and apply_date = #{applyDate}</if>
<if test="auditBy != null and auditBy != ''"> and audit_by = #{auditBy}</if>
<if test="auditDate != null "> and audit_date = #{auditDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="beginTime != null "> and begin_time = #{beginTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
</where>
</select>
<select id="selectWmsTransferByTransferId" parameterType="Long" resultMap="WmsTransferWmsTransferDetailResult">
select a.transfer_id, a.task_code, a.ori_warehouse_id, a.ori_location_code, a.target_warehouse_id, a.target_location_code, a.material_id, a.product_batch, a.plan_code, a.apply_qty, a.outstock_qty, a.instock_qty, a.operation_type, a.transfer_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.transfer_detail_id as sub_transfer_detail_id, b.transfer_id as sub_transfer_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.transfer_detail_type as sub_transfer_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
from wms_transfer a
left join wms_transfer_detail b on b.transfer_id = a.transfer_id
where a.transfer_id = #{transferId}
</select>
<insert id="insertWmsTransfer" parameterType="WmsTransfer" useGeneratedKeys="true" keyProperty="transferId">
insert into wms_transfer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskCode != null">task_code,</if>
<if test="oriWarehouseId != null">ori_warehouse_id,</if>
<if test="oriLocationCode != null and oriLocationCode != ''">ori_location_code,</if>
<if test="targetWarehouseId != null">target_warehouse_id,</if>
<if test="targetLocationCode != null">target_location_code,</if>
<if test="materialId != null">material_id,</if>
<if test="productBatch != null and productBatch != ''">product_batch,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="applyQty != null">apply_qty,</if>
<if test="outstockQty != null">outstock_qty,</if>
<if test="instockQty != null">instock_qty,</if>
<if test="operationType != null and operationType != ''">operation_type,</if>
<if test="transferType != null and transferType != ''">transfer_type,</if>
<if test="applyReason != null">apply_reason,</if>
<if test="auditReason != null">audit_reason,</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>
<if test="auditDate != null">audit_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null">#{taskCode},</if>
<if test="oriWarehouseId != null">#{oriWarehouseId},</if>
<if test="oriLocationCode != null and oriLocationCode != ''">#{oriLocationCode},</if>
<if test="targetWarehouseId != null">#{targetWarehouseId},</if>
<if test="targetLocationCode != null">#{targetLocationCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="productBatch != null and productBatch != ''">#{productBatch},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="applyQty != null">#{applyQty},</if>
<if test="outstockQty != null">#{outstockQty},</if>
<if test="instockQty != null">#{instockQty},</if>
<if test="operationType != null and operationType != ''">#{operationType},</if>
<if test="transferType != null and transferType != ''">#{transferType},</if>
<if test="applyReason != null">#{applyReason},</if>
<if test="auditReason != null">#{auditReason},</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>
<if test="auditDate != null">#{auditDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</insert>
<update id="updateWmsTransfer" parameterType="WmsTransfer">
update wms_transfer
<trim prefix="SET" suffixOverrides=",">
<if test="taskCode != null">task_code = #{taskCode},</if>
<if test="oriWarehouseId != null">ori_warehouse_id = #{oriWarehouseId},</if>
<if test="oriLocationCode != null and oriLocationCode != ''">ori_location_code = #{oriLocationCode},</if>
<if test="targetWarehouseId != null">target_warehouse_id = #{targetWarehouseId},</if>
<if test="targetLocationCode != null">target_location_code = #{targetLocationCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="productBatch != null and productBatch != ''">product_batch = #{productBatch},</if>
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="applyQty != null">apply_qty = #{applyQty},</if>
<if test="outstockQty != null">outstock_qty = #{outstockQty},</if>
<if test="instockQty != null">instock_qty = #{instockQty},</if>
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
<if test="transferType != null and transferType != ''">transfer_type = #{transferType},</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>
<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>
<if test="auditDate != null">audit_date = #{auditDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="beginTime != null">begin_time = #{beginTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
</trim>
where transfer_id = #{transferId}
</update>
<delete id="deleteWmsTransferByTransferId" parameterType="Long">
delete from wms_transfer where transfer_id = #{transferId}
</delete>
<delete id="deleteWmsTransferByTransferIds" parameterType="String">
delete from wms_transfer where transfer_id in
<foreach item="transferId" collection="array" open="(" separator="," close=")">
#{transferId}
</foreach>
</delete>
<delete id="deleteWmsTransferDetailByTransferIds" parameterType="String">
delete from wms_transfer_detail where transfer_id in
<foreach item="transferId" collection="array" open="(" separator="," close=")">
#{transferId}
</foreach>
</delete>
<delete id="deleteWmsTransferDetailByTransferId" parameterType="Long">
delete from wms_transfer_detail where transfer_id = #{transferId}
</delete>
<insert id="batchWmsTransferDetail">
insert into wms_transfer_detail( transfer_detail_id, transfer_id, location_code, material_barcode, instock_batch, material_id, plan_amount, real_amount, execute_status, execute_person, execute_time, transfer_detail_type, machine_name, create_by, create_date, update_by, update_date, active_flag) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.transferDetailId}, #{item.transferId}, #{item.locationCode}, #{item.materialBarcode}, #{item.instockBatch}, #{item.materialId}, #{item.planAmount}, #{item.realAmount}, #{item.executeStatus}, #{item.executePerson}, #{item.executeTime}, #{item.transferDetailType}, #{item.machineName}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}, #{item.activeFlag})
</foreach>
</insert>
<select id="selectWmsTransferJoinList" parameterType="WmsTransfer" resultMap="WmsTransferResult">
select wt.transfer_id, wt.task_code, wt.ori_warehouse_id, wt.ori_location_code, wt.target_warehouse_id, wt.target_location_code, wt.material_id, wt.product_batch,
wt.plan_code, wt.apply_qty, wt.outstock_qty, wt.instock_qty, wt.operation_type, wt.transfer_type,
wt.audit_status, wt.execute_status, wt.apply_by, wt.apply_date,
wbw.warehouse_name ori_warehouse_name,wbw2.warehouse_name target_warehouse_name,mbmi.material_code,mbmi.material_name
from wms_transfer wt
left join wms_base_warehouse wbw on wbw.warehouse_id = wt.ori_warehouse_id
left join wms_base_warehouse wbw2 on wbw2.warehouse_id = wt.target_warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id=wt.material_id
<where>
<if test="taskCode != null and taskCode != ''"> and wt.task_code = #{taskCode}</if>
<if test="oriWarehouseId != null "> and wt.ori_warehouse_id = #{oriWarehouseId}</if>
<if test="oriLocationCode != null and oriLocationCode != ''"> and wt.ori_location_code = #{oriLocationCode}</if>
<if test="targetWarehouseId != null "> and wt.target_warehouse_id = #{targetWarehouseId}</if>
<if test="targetLocationCode != null and targetLocationCode != ''"> and wt.target_location_code = #{targetLocationCode}</if>
<if test="materialId != null "> and wt.material_id = #{materialId}</if>
<if test="productBatch != null and productBatch != ''"> and wt.product_batch = #{productBatch}</if>
<if test="planCode != null and planCode != ''"> and wt.plan_code = #{planCode}</if>
<if test="applyQty != null "> and wt.apply_qty = #{applyQty}</if>
<if test="outstockQty != null "> and wt.outstock_qty = #{outstockQty}</if>
<if test="instockQty != null "> and wt.instock_qty = #{instockQty}</if>
<if test="operationType != null and operationType != ''"> and wt.operation_type = #{operationType}</if>
<if test="transferType != null and transferType != ''"> and wt.transfer_type = #{transferType}</if>
<if test="auditStatus != null and auditStatus != ''"> and wt.audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and wt.execute_status = #{executeStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus = 'notFinish'"> and (wt.execute_status = '0' or wt.execute_status = '1')</if>
<if test="applyBy != null and applyBy != ''"> and wt.apply_by = #{applyBy}</if>
<if test="applyDate != null "> and wt.apply_date = #{applyDate}</if>
<if test="auditBy != null and auditBy != ''"> and wt.audit_by = #{auditBy}</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save