Merge remote-tracking branch 'origin/master'

master
xs 3 months ago
commit b664df36a0

@ -158,6 +158,28 @@ public class MesPurchaseOrder extends BaseEntity {
/** 条码数 */
private BigDecimal barcodeAmount;
/** 更新绑定数量 */
private BigDecimal updateAmount;
/** 序号 */
private Long serialNumber;
public Long getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(Long serialNumber) {
this.serialNumber = serialNumber;
}
public BigDecimal getUpdateAmount() {
return updateAmount;
}
public void setUpdateAmount(BigDecimal updateAmount) {
this.updateAmount = updateAmount;
}
public BigDecimal getBoundAmount() {
return boundAmount;
}

@ -246,6 +246,8 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
if (StringUtils.isNull(saleOrderId)){
return 0;
}
//校验数据
checkSaveSalesBindPurchase(purchaseOrderList);
MesSaleOrder mesSaleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(saleOrderId);
String saleorderCode = mesSaleOrder.getSaleorderCode();
Long productId = mesSaleOrder.getMaterialId();
@ -267,7 +269,6 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
String materialCode = mesPurchaseOrder.getMaterialCode();
String materialName = mesPurchaseOrder.getMaterialName();
String poNo = mesPurchaseOrder.getPoNo();
BigDecimal orderAmount = mesPurchaseOrder.getOrderAmount();
orderBind.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
orderBind.setSaleOrderId(saleOrderId);
orderBind.setSaleOrderCode(saleorderCode);
@ -278,14 +279,14 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
orderBind.setMaterialId(materialId);
orderBind.setMaterialCode(materialCode);
orderBind.setMaterialName(materialName);
orderBind.setBindAmount(purchaseOrder.getSaleBindAmount());
orderBind.setBindAmount(purchaseOrder.getUpdateAmount());
orderBind.setPoNo(poNo);
orderBind.setCreateTime(currentDate);
orderBind.setCreateBy(userName);
mesOrderBindMapper.insertMesOrderBind(orderBind);
} else {
MesOrderBind bind = bindList.get(0);
bind.setBindAmount(purchaseOrder.getSaleBindAmount());
bind.setBindAmount(purchaseOrder.getUpdateAmount());
bind.setUpdateBy(SecurityUtils.getUsername());
bind.setUpdateTime(DateUtils.getNowDate());
mesOrderBindMapper.updateMesOrderBind(bind);
@ -294,6 +295,23 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
return 1;
}
private void checkSaveSalesBindPurchase(List<MesPurchaseOrder> purchaseOrderList) {
for (MesPurchaseOrder purchaseOrder : purchaseOrderList) {
BigDecimal boundAmount = purchaseOrder.getBoundAmount();//已绑定总数
BigDecimal saleBindAmount = purchaseOrder.getSaleBindAmount();//销售订单已绑定数
BigDecimal updateAmount = purchaseOrder.getUpdateAmount();//更新绑定数量
BigDecimal orderAmount = purchaseOrder.getOrderAmount();//采购订单数量
BigDecimal safeAmount = purchaseOrder.getSafeAmount();//安全库存数
BigDecimal barcodeAmount = purchaseOrder.getBarcodeAmount();//条码数
BigDecimal totalBindAmount = boundAmount.subtract(saleBindAmount).add(updateAmount);
// (已绑定总数 - 销售订单已绑定数 + 更新绑定数量) 需要小于等于 采购订单数量
if (totalBindAmount.compareTo(orderAmount) > 0) {
throw new ServiceException("序号: " + purchaseOrder.getSerialNumber() + " 总绑定数大于订单数!");
}
}
}
/**
*
*

@ -256,12 +256,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from mes_purchase_order mpo
left join mes_base_material_info mbmi on mbmi.material_id = mpo.material_id
<where>
<if test="poNo != null and poNo != ''"> and mpo.po_no = #{poNo}</if>
<if test="materialCode != null and materialCode != ''"> and mpo.material_code = #{materialCode}</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mpo.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mpo.material_name like concat('%', #{materialName}, '%')</if>
<if test="specificationParameter != null and specificationParameter != ''"> and mpo.specification_parameter like concat('%', #{specificationParameter}, '%')</if>
<if test="materialSpec != null and materialSpec != ''"> and mbmi.material_spec like concat('%', #{materialSpec}, '%')</if>
</where>
order by sale_bind_amount desc
order by mpo.po_no ,mpo.material_code
</select>
<select id="saleBindPurchaseOrderList" parameterType="MesPurchaseOrder" resultMap="MesPurchaseOrderResult">

@ -529,7 +529,7 @@ export const dynamicRoutes = [
path: '/wms/product-outstock',
component: Layout,
hidden: true,
permissions: ['wms:productoutstock:info'],
permissions: ['wms:productoutstock:audit:list'],
children: [
{
path: 'audit/:taskCode',
@ -544,7 +544,7 @@ export const dynamicRoutes = [
path: '/wms/raw-outstock',
component: Layout,
hidden: true,
permissions: ['wms:rawoutstock:audit'],
permissions: ['wms:rawoutstock:audit:list'],
children: [
{
path: 'audit/:taskCode/:detailFlag/:warehouseName',
@ -575,7 +575,7 @@ export const dynamicRoutes = [
path: '/wms/raw-return',
component: Layout,
hidden: true,
permissions: ['wms:rawreturn:audit'],
permissions: ['wms:rawreturn:audit:list'],
children: [
{
path: 'audit/:rawReturnId/:detailFlag/:warehouseName',

@ -30,10 +30,77 @@
</el-form>
<el-row>
<el-col :span="12">
<h4 class="form-header h4">已选采购订单</h4>
<el-form :model="allocatePurchaseOrderQueryParams" ref="allocateMaterialQueryForm" size="small" :inline="true"
v-show="showSearch"
<!-- <el-col :span="12">-->
<!-- <h4 class="form-header h4">已选采购订单</h4>-->
<!-- <el-form :model="allocatePurchaseOrderQueryParams" ref="allocateMaterialQueryForm" size="small" :inline="true"-->
<!-- v-show="showSearch"-->
<!-- label-width="68px">-->
<!-- <el-form-item label="订单编号" prop="poNo">-->
<!-- <el-input-->
<!-- v-model="allocatePurchaseOrderQueryParams.poNo"-->
<!-- placeholder="请输入物料编码"-->
<!-- style="width:140px;"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleAllocateMaterialQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料编码" prop="materialCode">-->
<!-- <el-input-->
<!-- v-model="allocatePurchaseOrderQueryParams.materialCode"-->
<!-- placeholder="请输入物料编码"-->
<!-- style="width:140px;"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleAllocateMaterialQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料名称" prop="materialName">-->
<!-- <el-input-->
<!-- v-model="allocatePurchaseOrderQueryParams.materialName"-->
<!-- placeholder="请输入物料名称"-->
<!-- style="width:140px;"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleAllocateMaterialQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleAllocateMaterialQuery">-->
<!-- </el-button>-->
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetAllocateMaterialQuery"></el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- @click="handleUnallocateBarCodes"-->
<!-- v-hasPermi="['mes:saleOrder:bind']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-table v-loading="allocateLoading" :data="allocatePurchaseOrderList"-->
<!-- @selection-change="handleAllocateMaterialSelectionChange">-->
<!-- <el-table-column type="selection" width="55" align="center"/>-->
<!-- <el-table-column label="订单编号" align="center" prop="poNo"/>-->
<!-- <el-table-column label="物料编码" align="center" prop="materialCode"/>-->
<!-- <el-table-column label="物料名称" align="center" prop="materialName"/>-->
<!-- <el-table-column label="物料规格" align="center" prop="materialSpec"/>-->
<!-- <el-table-column label="规格参数" align="center" prop="specificationParameter" :show-overflow-tooltip="true"/>-->
<!-- <el-table-column label="数量" align="center" prop="orderAmount"/>-->
<!-- </el-table>-->
<!-- <pagination-->
<!-- v-show="allocatePurchaseOrderTotal>0"-->
<!-- :total="allocatePurchaseOrderTotal"-->
<!-- :page.sync="allocatePurchaseOrderQueryParams.pageNum"-->
<!-- :limit.sync="allocatePurchaseOrderQueryParams.pageSize"-->
<!-- @pagination="getAllocatePurchaseOrderList"-->
<!-- />-->
<!-- </el-col>-->
<!-- <el-col :span="12" >-->
<h4 class="form-header h4">可选采购订单</h4>
<el-form :model="purchaseOrderQueryParams" ref="materialQueryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="订单编号" prop="poNo">
<el-input
@ -46,84 +113,35 @@
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="allocatePurchaseOrderQueryParams.materialCode"
v-model="purchaseOrderQueryParams.materialCode"
placeholder="请输入物料编码"
style="width:140px;"
clearable
@keyup.enter.native="handleAllocateMaterialQuery"
@keyup.enter.native="handlePurchaseOrderQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="allocatePurchaseOrderQueryParams.materialName"
v-model="purchaseOrderQueryParams.materialName"
placeholder="请输入物料名称"
style="width:140px;"
clearable
@keyup.enter.native="handleAllocateMaterialQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleAllocateMaterialQuery">
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetAllocateMaterialQuery"></el-button>
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
@click="handleUnallocateBarCodes"
v-hasPermi="['mes:productOrder:bind']"
>删除
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="allocateLoading" :data="allocatePurchaseOrderList"
@selection-change="handleAllocateMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="订单编号" align="center" prop="poNo"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="规格参数" align="center" prop="specificationParameter" :show-overflow-tooltip="true"/>
<el-table-column label="数量" align="center" prop="orderAmount"/>
</el-table>
<pagination
v-show="allocatePurchaseOrderTotal>0"
:total="allocatePurchaseOrderTotal"
:page.sync="allocatePurchaseOrderQueryParams.pageNum"
:limit.sync="allocatePurchaseOrderQueryParams.pageSize"
@pagination="getAllocatePurchaseOrderList"
/>
</el-col>
<el-col :span="12" >
<h4 class="form-header h4">可选采购订单</h4>
<el-form :model="purchaseOrderQueryParams" ref="materialQueryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="订单编号" prop="poNo">
<el-input
v-model="allocatePurchaseOrderQueryParams.poNo"
placeholder="请输入物料编码"
style="width:140px;"
clearable
@keyup.enter.native="handleAllocateMaterialQuery"
@keyup.enter.native="handlePurchaseOrderQuery"
/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="purchaseOrderQueryParams.materialCode"
placeholder="请输入物料编码"
v-model="purchaseOrderQueryParams.materialSpec"
placeholder="请输入物料规格"
style="width:140px;"
clearable
@keyup.enter.native="handlePurchaseOrderQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-form-item label="规格参数" prop="specificationParameter">
<el-input
v-model="purchaseOrderQueryParams.materialName"
placeholder="请输入物料名称"
v-model="purchaseOrderQueryParams.specificationParameter"
placeholder="请输入规格参数"
style="width:140px;"
clearable
@keyup.enter.native="handlePurchaseOrderQuery"
@ -137,24 +155,46 @@
plain
icon="el-icon-plus"
size="mini"
:disabled="allocateBarCodeBtnDisable"
:disabled="multiple"
@click="submitForm"
v-hasPermi="['mes:productOrder:bind']"
v-hasPermi="['mes:saleOrder:bind']"
>保存
</el-button>
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
@click="handleUnallocateBarCodes"
v-hasPermi="['mes:saleOrder:bind']"
>删除
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="selectableLoading" :data="purchaseOrderList"
@selection-change="handleMaterialSelectionChange">
<el-table v-loading="selectableLoading"
:data="purchaseOrderList"
@selection-change="handleMaterialSelectionChange"
:row-class-name="rowSerialNumberProcess"
:row-style="getRowStyle">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="serialNumber"/>
<el-table-column label="订单编号" align="center" prop="poNo"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="规格参数" align="center" prop="specificationParameter" :show-overflow-tooltip="true"/>
<el-table-column label="数量" align="center" prop="orderAmount"/>
<el-table-column label="订单数" align="center" prop="orderAmount"/>
<el-table-column label="已绑定数" align="center" prop="boundAmount"/>
<el-table-column label="销售订单绑定数" align="center" prop="saleBindAmount"/>
<el-table-column label="更新绑定数" align="center" prop="updateAmount" width="150">
<template slot-scope="scope">
<el-input-number v-model="scope.row.updateAmount" size="mini"/>
</template>
</el-table-column>
<el-table-column label="安全库存数" align="center" prop="safeAmount"/>
<el-table-column label="条码数" align="center" prop="barcodeAmount"/>
</el-table>
<pagination
@ -164,7 +204,7 @@
:limit.sync="purchaseOrderQueryParams.pageSize"
@pagination="getUnbindPurchaseOrderList"
/>
</el-col>
<!-- </el-col>-->
</el-row>
</div>
@ -192,6 +232,8 @@ export default {
barcodeInfos: [],
//ID
purchaseOrderIds: [],
//
purchaseOrderSelectableList: [],
//
allocateMaterialSingle: true,
//
@ -202,6 +244,8 @@ export default {
materialMultiple: true,
//
showSearch: true,
single: true,
multiple: true,
//
allocatePurchaseOrderTotal: 0,
//
@ -231,6 +275,7 @@ export default {
saleOrderId: null,
materialCode: null,
materialName: null,
specificationParameter: null,
poNo: null
},
};
@ -240,16 +285,14 @@ export default {
const saleOrderId = this.$route.params && this.$route.params.saleOrderId;
let saleorderCode = this.$route.query && this.$route.query.saleorderCode;
this.purchaseOrderQueryParams.saleOrderId = saleOrderId;
// this.purchaseOrderQueryParams.saleorderCode = saleorderCode;
this.allocatePurchaseOrderQueryParams.saleOrderId = saleOrderId;
// this.allocatePurchaseOrderQueryParams.saleorderCode = saleorderCode;
this.saleOrderForm.saleorderCode = saleorderCode;
this.saleOrderForm.saleOrderId = saleOrderId;
this.saleOrderForm.materialCode = this.$route.query && this.$route.query.materialCode;
this.saleOrderForm.materialName = this.$route.query && this.$route.query.materialName;
this.saleOrderForm.materialModel = this.$route.query && this.$route.query.materialModel;
this.getAllocatePurchaseOrderList();
// this.getAllocatePurchaseOrderList();
this.getUnbindPurchaseOrderList();
},
methods: {
@ -278,6 +321,9 @@ export default {
this.allocatePurchaseOrderQueryParams.pageNum = 1;
this.getAllocatePurchaseOrderList();
},
getRowStyle({ row }) {
return row.saleBindAmount > 0 ? { backgroundColor: '#8ee38e' } : {};
},
/** 已选采购订单重置按钮操作 */
resetAllocateMaterialQuery() {
this.resetForm("allocateMaterialQueryForm");
@ -286,8 +332,7 @@ export default {
/** 已选采购订单多选框选中数据 */
handleAllocateMaterialSelectionChange(selection) {
this.orderBindIds = selection.map(item => item.orderBindId)
this.allocatePoNos = selection.map(item => item.poNo)
this.single = selection.length !== 1
// this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 可选采购订单搜索按钮操作 */
@ -303,20 +348,25 @@ export default {
//
handleMaterialSelectionChange(selection) {
this.purchaseOrderIds = selection.map(item => item.purchaseOrderId)
this.allocatePoNos = selection.map(item => item.poNo)
this.purchaseOrderSelectableList = selection.map(item => item)
this.single = selection.length !== 1
this.multiple = !selection.length
},
rowSerialNumberProcess({row, rowIndex}) {
row.serialNumber = rowIndex + 1;
},
handleUnallocateBarCodes() {
const orderBindIds = this.orderBindIds.join(",");
const purchaseOrderIds = this.purchaseOrderIds.join(",");
const allocatePoNos = this.allocatePoNos;
const params = {
orderBindIds: orderBindIds
saleOrderId: this.saleOrderForm.saleOrderId,
purchaseOrderIds: purchaseOrderIds,
}
this.$modal.confirm('是否确认删除采购订单编号为"' + allocatePoNos + '"的数据项?').then(function () {
return removeSalesBindPurchase(params);
}).then(() => {
this.getAllocatePurchaseOrderList();
// this.getAllocatePurchaseOrderList();
this.getUnbindPurchaseOrderList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
@ -325,19 +375,39 @@ export default {
/** 提交按钮 */
submitForm() {
this.allocateBarCodeBtnDisable = true;
const saleOrderId = this.saleOrderForm.saleOrderId;
const purchaseOrderIds = this.purchaseOrderIds.join(",");
saveSalesBindPurchase({
saleOrderId: saleOrderId,
purchaseOrderIds: purchaseOrderIds
}).then((response) => {
// const purchaseOrderIds = this.purchaseOrderIds.join(",");
for (let obj of this.purchaseOrderSelectableList) {
obj.saleOrderId = this.saleOrderForm.saleOrderId;
const orderAmount = obj.orderAmount;
const boundAmount = obj.boundAmount;
const saleBindAmount = obj.saleBindAmount;
const safeAmount = obj.safeAmount;
const barcodeAmount = obj.barcodeAmount;
const updateAmount = obj.updateAmount;
if (updateAmount == null){
this.$modal.msgWarning("订单编号:" + obj.poNo + "请输入更新绑定数");
return;
}
// - +
// if ((boundAmount - saleBindAmount + updateAmount) > orderAmount){
// this.$modal.msgWarning(":" + obj.poNo + "");
// return;
// }
// if (updateAmount > barcodeAmount){
// this.$modal.msgWarning(":" + obj.poNo + "");
// return;
// }
// obj.saleBindAmount = updateAmount;
}
saveSalesBindPurchase(this.purchaseOrderSelectableList).then((response) => {
this.$modal.msgSuccess("保存成功");
this.selectBarCodeAllocationWarehouse();
this.getAllocatePurchaseOrderList();
this.getUnbindPurchaseOrderList();
// this.getAllocatePurchaseOrderList();
this.allocateBarCodeBtnDisable = false;
}).catch(() => {
this.getAllocatePurchaseOrderList();
this.getUnbindPurchaseOrderList();
// this.getAllocatePurchaseOrderList();
// this.getUnbindPurchaseOrderList();
this.allocateBarCodeBtnDisable = false;
});
},

Loading…
Cancel
Save