我们解决了一个逻辑上的问题:
1.医院向供货商下单,如果供货商一时不能提供足够的数量,应该怎么办。
2.科室库向中心库提交申请,如果中心库库存不满足申请的数量,应该怎么办。
经过一番讨论,对于第一个问题,后端的负责人表示,应该有一个功能,允许供货商分批次配送,每次配送都会修改订单,将所需数量下调(具体数量等于原本需要的量-已配送的量)。而我认为不应该对订单发生修改,否则会引起商业上的问题(既然开了修改的口子,就有可能发生取消订单,转移订单等现象,进而导致损失信任)。最终我们取了一个折衷但是比较合理的方案:允许供货商分批次配送,每次配送后会显示已配送的数量和未配送的数量,直至完全完成订单。
对于第二个问题,我们一致认为,科室库不应该能够申请超出库存的数量,也就是说当科室库提交申请时会进行检查,如果超出库存则将提示“库存不足”的字样。
供货商页面显示的操作按钮代码:
<el-table-column label="操作" width="220" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="handleViewOrder(scope.$index, scope.row)"
v-show="scope.row.orderStatus!=0"
>查看
</el-button>
<el-button
size="mini"
type="primary"
@click="handlePlaceOrder(scope.$index, scope.row)"
v-show="(scope.row.orderStatus==1 || scope.row.orderStatus==2) && (roleId == 1 || roleId == 5)"
>配货
</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="handleViewOrder(scope.$index, scope.row)"
v-show="scope.row.orderStatus==0">编辑
</el-button>
<el-button
size="mini"
type="danger"
v-show="scope.row.orderStatus==0"
@click="handleDeleteOrder(scope.$index, scope.row)">删除
</el-button>
<el-button
size="mini"
type="danger"
v-show="(roleId == 2 || roleId == 6 || roleId == 1) && (scope.row.orderStatus==1)"
@click="handleRevoke(scope.$index, scope.row)">撤销
</el-button>
<el-button
size="mini"
type="danger"
v-show="(roleId == 2 || roleId == 6 || roleId == 1) && (scope.row.orderStatus==1 || scope.row.orderStatus==2|| scope.row.orderStatus==5)"
@click="handleClose(scope.$index, scope.row)">关闭
</el-button>
</template>
</el-table-column>
</el-table>
点击“配货”按钮后执行的方法:
handlePlaceOrder(index, row) {
this.$router.push({
path: '/oms/preInBillAdd',
query: {orderNo: row.orderNo, supplierShortName: row.supplierShortName, createBy: row.createBy}
})
},
然后是上述方法调用的方法,由于我们采用的代码结构,中间还有不少方法,在此我就不放了。只放一个最终配货的方法。
submitOrder(submitType) {
this.$refs.form.validate(valid => {
if (valid) {
this.loadingbut = true;
const arr = [];
this.model.tableData.forEach(item => {
const obj = {
code: item.code,
quantity: item.quantity,
price: item.price,
batchNo: item.batchNo,
expireDate: item.expireDate,
supplierId: item.supplierId,
factory: item.factory,
supplierShortName: item.supplierShortName
}
arr.push(obj);
})
const isRepeat = this.getNewList(arr);
let flag = true;
this.orderInfo.forEach(item => {
isRepeat.forEach(item1 => {
if (item.reagentId === parseInt(item1.code, 10) && item1.quantity > item.unsendNum) {
flag = false;
}
})
})
//只有配货数量小于等于未发货数量时,才可以配货
if (flag) {
console.log('配货数量没问题!');
let sendData = {
billType: this.listQuery.billType,
billStatus: this.listQuery.billStatus,
preInBillMessList: arr,
remark: this.listQuery.remark,
billCreator: this.listQuery.billCreator,
orderNo: this.$route.query.orderNo
}
createPreInBillItem(sendData).then(response => {
if (response.data > 0) {
this.loadingbut = false;
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
this.$router.push("/oms/preInBill");
}
}).catch(error => {
this.loadingbut = false;
})
} else {
console.log('配货数量超出!');
this.loadingbut = false;
this.$message({
message: '配货数量与订单不符!',
type: 'warning'
});
}
} else {
console.log('参数验证不合法!');
this.loadingbut = false;
this.$message({
message: '提交失败!',
type: 'warning'
});
return false
}
})
},
可见对配货数量也是有比较严格的限定条件。毕竟真要使用系统的话,就不能出逻辑上的问题才对。