山东大学项目实训开发日志——基于vue+springboot的医院耗材管理系统(14)

本文记录了在开发基于vue+springboot的医院耗材管理系统中遇到的问题及其解决方案。针对供货商无法一次性满足订单数量的情况,采取了分批次配送的策略,并在每次配送后更新订单状态。同时,对于科室库申请超出库存数量的情况,系统进行了库存检查并给出提示。详细介绍了供货商页面的操作按钮逻辑和配货功能的实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        我们解决了一个逻辑上的问题:

        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
        }
      })
    },

        可见对配货数量也是有比较严格的限定条件。毕竟真要使用系统的话,就不能出逻辑上的问题才对。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值