WMS:
PDA接口成品出库申请完善
master
xs 3 months ago
parent 70b7fb9d54
commit d54ff8c378

@ -248,5 +248,5 @@ public class WmsConstants {
public static final String WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES = "1";
public static final String WMS_SAFE_FLAG_YES = "1";//安全库存,是
public static final String WMS_SAFE_FLAG_NO = "0";//安全库存,否
}

@ -68,6 +68,9 @@ public class WmsMobileController extends BaseController {
@Autowired
private IWmsInventoryCheckService wmsInventoryCheckService;
@Autowired
private IWmsStockTotalService wmsStockTotalService;
@Resource
private RemoteMesService remoteMesService;
@ -316,17 +319,17 @@ public class WmsMobileController extends BaseController {
/**
*
* Join material,warehouse,saleorder,totalAmount>0,FOR PDA apply
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getProductStocksBySalesorderCode")
public TableDataInfo getProductStocksBySalesorderCode(WmsProductStock queryProductStock) {
public TableDataInfo getProductStocksBySalesorderCode(WmsStockTotal queryStockTotal) {
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);
List<WmsStockTotal> wmsStockTotals = wmsStockTotalService.selectWmsStockTotalList4ProductApply(queryStockTotal);
return getDataTable(wmsStockTotals);
}
/**

@ -122,6 +122,13 @@ public class WmsStockTotal extends BaseEntity {
private String stockTypeStr;
private BigDecimal orderAmount;
private BigDecimal applyAmount;
private Long productId;
public String getWarehouseName() {
return warehouseName;
}
@ -307,6 +314,30 @@ public class WmsStockTotal extends BaseEntity {
this.stockTypeStr = stockTypeStr;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
public BigDecimal getApplyAmount() {
return applyAmount;
}
public void setApplyAmount(BigDecimal applyAmount) {
this.applyAmount = applyAmount;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -1,6 +1,7 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsStockTotal;
/**
@ -9,8 +10,7 @@ import com.hw.wms.domain.WmsStockTotal;
* @author xins
* @date 2024-03-14
*/
public interface WmsStockTotalMapper
{
public interface WmsStockTotalMapper {
/**
*
*
@ -60,10 +60,6 @@ public interface WmsStockTotalMapper
public int deleteWmsStockTotalByStockTotalIds(Long[] stockTotalIds);
/**
* (plancodeplandetailcode)
*
@ -88,4 +84,22 @@ public interface WmsStockTotalMapper
* @return
*/
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal);
/**
* ,Join warehouse,material,sale_order,for pda使
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotal> selectWmsStockTotalList4ProductApply(WmsStockTotal wmsStockTotal);
/**
* stocktotal
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotal> selectOnlyWmsStockTotalList(WmsStockTotal wmsStockTotal);
}

@ -87,4 +87,13 @@ public interface IWmsStockTotalService
* @return
*/
public JSONObject selectWmsStockTotalJoinRealListBySaleOrder(WmsStockTotal wmsStockTotal);
/**
* Join material,warehouse,saleorder,totalAmount>0,FOR PDA apply
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotal> selectWmsStockTotalList4ProductApply(WmsStockTotal wmsStockTotal);
}

@ -13,14 +13,11 @@ import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.wms.config.WmsConfig;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.WmsProduceInstockVo;
import com.hw.wms.domain.vo.WmsProductOutstockAuditVo;
import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo;
import com.hw.wms.mapper.WmsBaseWarehouseMapper;
import com.hw.wms.mapper.WmsProductOutstockDetailMapper;
import com.hw.wms.mapper.WmsProductStockMapper;
import com.hw.wms.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,9 +25,6 @@ import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.wms.domain.WmsProductOutstockDetail;
import com.hw.wms.mapper.WmsProductOutstockMapper;
import com.hw.wms.domain.WmsProductOutstock;
import com.hw.wms.service.IWmsProductOutstockService;
import javax.annotation.Resource;
@ -52,6 +46,9 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
@Autowired
private WmsStockTotalMapper wmsStockTotalMapper;
@Autowired
private WmsBaseWarehouseMapper wmsBaseWarehouseMapper;
@ -98,6 +95,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertWmsProductOutstock(WmsProductOutstock wmsProductOutstock) {
Long warehouseId = wmsProductOutstock.getWarehouseId();
String saleorderCode = wmsProductOutstock.getSaleorderCode();
@ -107,26 +105,22 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
throw new ServiceException("申请数量需大于0");
}
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setWarehouseId(warehouseId);
queryProductStock.setSaleorderCode(saleorderCode);
queryProductStock.setProductId(productId);
queryProductStock.setSaleOrderId(wmsProductOutstock.getSaleOrderId());
//group by wps.warehouse_id,wps.sale_order_id,wps.product_id获取的以下库存信息
List<WmsProductStock> productStocks = wmsProductStockMapper.selectWmsProductStocksBySaleorder(queryProductStock);
if (productStocks == null || productStocks.isEmpty()) {
WmsStockTotal queryStockTotal = new WmsStockTotal();
queryStockTotal.setWarehouseId(warehouseId);
queryStockTotal.setMaterialId(productId);
queryStockTotal.setSaleOrderId(wmsProductOutstock.getSaleOrderId());
List<WmsStockTotal> wmsStockTotals = wmsStockTotalMapper.selectOnlyWmsStockTotalList(queryStockTotal);
if (wmsStockTotals == null || wmsStockTotals.isEmpty()) {
throw new ServiceException("没有库存");
}
WmsStockTotal wmsStockTotal = wmsStockTotals.get(0);
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 totalAmount = wmsStockTotal.getTotalAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getTotalAmount();
BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount();//冻结数量暂时没用
BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount();//
BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount);
BigDecimal sumApplyQty = productStock.getApplyAmount() == null ? BigDecimal.ZERO : productStock.getApplyAmount();//获取已申请出库数量
// BigDecimal sumApplyQty = productStock.getApplyAmount() == null ? BigDecimal.ZERO : productStock.getApplyAmount();//获取已申请出库数量
// WmsProductOutstock queryProductOutStock = new WmsProductOutstock();
// queryProductOutStock.setSaleorderCode(saleorderCode);
@ -136,11 +130,8 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
// 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);
if (applyQty.compareTo(availableAmount) > 0) {
throw new ServiceException("可申请数量为" + availableAmount);
}
WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
@ -165,6 +156,12 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
int rows = wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock);
wmsStockTotal.setOccupyAmount(occupyAmount.add(applyQty));
wmsStockTotal.setUpdateBy(userName);
wmsStockTotal.setUpdateDate(currentDate);
wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal);
//如果是agv自动仓库需要调用WCS轮询查询成品出库记录进行调度出库
return rows;

@ -7,6 +7,9 @@ import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.wms.domain.WmsProductStock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsStockTotalMapper;
@ -169,4 +172,24 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService
}
/**
* Join material,warehouse,saleorder,totalAmount>0
*
* @param wmsStockTotal
* @return
*/
@Override
public List<WmsStockTotal> selectWmsStockTotalList4ProductApply(WmsStockTotal wmsStockTotal) {
wmsStockTotal.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
wmsStockTotal.setSafeFlag(WmsConstants.WMS_SAFE_FLAG_NO);
List<WmsStockTotal> list = wmsStockTotalMapper.selectWmsStockTotalList4ProductApply(wmsStockTotal);
if (list == null || list.isEmpty()) {
throw new ServiceException("没有销售订单成品库存信息");
}
return list;
}
}

@ -28,6 +28,33 @@
<result property="saleorderCode" column="saleorder_code"/>
</resultMap>
<resultMap type="WmsStockTotal" id="WmsStockTotal4ApplyResult">
<result property="stockTotalId" column="stock_total_id"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="warehouseFloor" column="warehouse_floor"/>
<result property="stockType" column="stock_type"/>
<result property="productId" column="product_id"/>
<result property="saleOrderId" column="sale_order_id"/>
<result property="safeFlag" column="safe_flag"/>
<result property="totalAmount" column="total_amount"/>
<result property="frozenAmount" column="frozen_amount"/>
<result property="occupyAmount" column="occupy_amount"/>
<result property="createBy" column="create_by"/>
<result property="createDate" column="create_date"/>
<result property="updateBy" column="update_by"/>
<result property="updateDate" column="update_date"/>
<result property="activeFlag" column="active_flag"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="outstockAmount" column="outstock_amount"/>
<result property="saleorderCode" column="saleorder_code"/>
<result property="orderAmount" column="order_amount"/>
<result property="applyAmount" column="apply_amount"/>
</resultMap>
<sql id="selectWmsStockTotalVo">
select wst.stock_total_id,
wst.warehouse_id,
@ -218,6 +245,7 @@
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id = mso.sale_order_id
<where>
wst.total_amount > 0
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
@ -234,6 +262,85 @@
<if test="updateDate != null ">and wst.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wst.active_flag = #{activeFlag}</if>
</where>
</select>
<select id="selectWmsStockTotalList4ProductApply" parameterType="WmsStockTotal" resultMap="WmsStockTotal4ApplyResult">
select wst.stock_total_id,
wst.warehouse_id,
wbw.warehouse_name,
wst.warehouse_floor,
wst.stock_type,
wst.material_id as product_id,
wst.sale_order_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
wst.total_amount,
wst.frozen_amount,
wst.occupy_amount,
wst.occupy_amount as apply_amount,
wst.create_by,
wst.create_date,
wst.update_by,
wst.update_date,
wst.active_flag,
mso.order_amount,mso.saleorder_code,
(select sum(wpo.apply_qty) from wms_product_outstock wpo where wpo.sale_order_id=wst.sale_order_id and
wpo.warehouse_id=wst.warehouse_id and wpo.product_id=wst.material_id and (wpo.execute_status='0' or
wpo.execute_status='1')) apply_amount
from wms_stock_total wst
left join wms_base_warehouse wbw on wbw.warehouse_id = wst.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id=mso.sale_order_id
<where>
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
<if test="materialId != null ">and wst.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wst.sale_order_id = #{saleOrderId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%',#{saleorderCode},'%')</if>
<if test="safeFlag != null and safeFlag != ''">and wst.safe_flag = #{safeFlag}</if>
<if test="createDate != null ">and wst.create_date = #{createDate}</if>
<if test="updateDate != null ">and wst.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wst.active_flag = #{activeFlag}</if>
</where>
</select>
<select id="selectOnlyWmsStockTotalList" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
select wst.stock_total_id,
wst.warehouse_id,
wst.warehouse_floor,
wst.stock_type,
wst.material_id,
wst.sale_order_id,
wst.total_amount,
wst.frozen_amount,
wst.occupy_amount,
wst.create_by,
wst.create_date,
wst.update_by,
wst.update_date,
wst.active_flag
from wms_stock_total wst
<where>
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
<if test="materialId != null ">and wst.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wst.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wst.safe_flag = #{safeFlag}</if>
<if test="createDate != null ">and wst.create_date = #{createDate}</if>
<if test="updateDate != null ">and wst.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wst.active_flag = #{activeFlag}</if>
</where>
</select>
</mapper>

@ -231,22 +231,15 @@
v-hasPermi="['mes:barcode:printBarcode']"
>打印
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['mes:barcode:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:barcode:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-printer"
@click="reprintBarcodes(scope.row)"
v-if="scope.row.printFlag ==='1'"
v-hasPermi="['mes:barcode:reprint']"
>补打印
</el-button>
</template>
</el-table-column>
</el-table>
@ -580,7 +573,7 @@
<script>
import {
listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode,
listBarcode, getBarcode, delBarcode, addBarcode, reprintBarcodes,
printBarcodes, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode, regenerateBarcode, checkRawStock, addNoPurchaseBarcode, addRegularBarcode
} from "@/api/mes/barcode";
@ -637,7 +630,7 @@ export default {
materialCode: null,
materialName: null,
materialSpec: null,
barcodeSpec:null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
machineName: null,
@ -967,6 +960,7 @@ export default {
/** 打印条码按钮操作 */
handlePrintBarcodes(row) {
this.loading = true;
const barcodeIds = row.barcodeId || this.ids;
if (barcodeIds == null || barcodeIds === '') {
this.$modal.msgWarning("请选择要打印的物料条码");
@ -974,7 +968,7 @@ export default {
}
if (row.printFlag) {
row.printFlag = '1';
// row.printFlag = '1';
} else {
this.batchPrintBtnDisabled = true;
}
@ -984,12 +978,15 @@ export default {
this.getList();
this.batchPrintBtnDisabled = false;
}).catch(() => {
}).finally(e => {
this.loading = false;
this.batchPrintBtnDisabled = false;
});
},
//
regenerateBarcode(row) {
this.loading = true;
const barcodeId = row.barcodeId;
const barcodeInfo = row.barcodeInfo;
const barcodeType = row.barcodeType;
@ -1000,10 +997,28 @@ export default {
this.getList();
this.$modal.msgSuccess("重新生成成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
});
},
reprintBarcodes(row){
this.loading = true;
const barcodeId = row.barcodeId;
const barcodeInfo = row.barcodeInfo;
this.$modal.confirm('请确认是否要补打印条码内容为"' + barcodeInfo + '"的数据项?').then(function () {
return reprintBarcodes(barcodeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("重新生成成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -1160,8 +1175,8 @@ export default {
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName:null,
barcodeSpec:null,
materialName: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,

Loading…
Cancel
Save