dengjunjie
2025-01-15 e6b95b867105e7be676510c248638ecb41dd6f87
优化物料码查询
已修改7个文件
233 ■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/basic/materielCodeInfo.vue 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IPurchaseOrderDetailService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/PurchaseOrderDetailService.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielCodeInfo.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/PurchaseOrderDetailController.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js
@@ -26,26 +26,47 @@
      })
      return option;
    },
    formatDate(dateStr) {
      let date = new Date(dateStr);
      let year = date.getFullYear();
      let month = String(date.getMonth() + 1).padStart(2, "0");
      let day = String(date.getDate()).padStart(2, "0");
      return year + "-" + month + "-" + day;
    },
    //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前,
      let warehouseIdOption = this.getOption("warehouseId");
      let materielCodeOption = this.getOption("materielCode");
      let purchaseOrderNoOption = this.getOption("purchaseOrderNo");
      purchaseOrderNoOption.onChange = (val, option) => {
      warehouseIdOption.onChange=(val,option)=>{
        this.editFormFields.materielCode = "";
        materielCodeOption.data = [];
        this.editFormFields.purchaseOrderNo = "";
        purchaseOrderNoOption.data = [];
        if (val == null || val == 0) {
          return this.$error("请选择物料编号!")
          return this.$error("请选择仓库!")
        }
        // console.log(val)
        // console.log(option)
        this.http.post("/api/PurchaseOrder/GetPurchaseOrderInfo?purchaseOrderNo=" + val, {}, true).then(
        this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + val, {}, true).then(
          source => {
            if (!source.status) return this.$error(source.message);
            for (let i = 0; i < source.data.length; i++) {
              materielCodeOption.data.push({ key: source.data[i], value: source.data[i] })
            }
            // this.editFormFields.InputOder_itemname = source.data.itemName;
            // this.$success(source.data.itemName);
            this.refresh();
          })
      }
      materielCodeOption.onChange = (val, option) => {
        this.editFormFields.purchaseOrderNo = "";
        purchaseOrderNoOption.data = [];
        if (val == null || val == 0) {
          return this.$error("请选择物料编号!")
        }
        this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderNos?materielCode=" + val, {}, true).then(
          source => {
            if (!source.status) return this.$error(source.message);
            for (let i = 0; i < source.data.length; i++) {
              purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] })
            }
            this.refresh();
          })
      }
@@ -99,6 +120,16 @@
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看:console.log(this.editFormOptions)
      let isAdd = this.currentAction == 'Add';
      if (isAdd) {
        let date = new Date();
        let year = date.getFullYear();
        let month = String(date.getMonth() + 1).padStart(2, "0");
        let day = String(date.getDate()).padStart(2, "0");
        this.editFormFields.lotNo = year + month + day;
        this.editFormFields.productionDate = year + "-" + month + "-" + day;
        this.editFormFields.effectiveDate = year + 2 + "-" + month + "-" + day;
      }
    }
  }
};
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/outOrderDetail.vue
@@ -1,6 +1,12 @@
<template>
  <div>
    <vol-box v-model="showDetialBox" :lazy="true" width="75%" :padding="15" title="单据明细信息">
    <vol-box
      v-model="showDetialBox"
      :lazy="true"
      width="75%"
      :padding="15"
      title="单据明细信息"
    >
      <div class="box-head">
        <el-alert :closable="false" style="width: 100%">
          <el-row>
@@ -8,27 +14,71 @@
              <span>已选中 {{ selection.length }} é¡¹</span>
            </el-col>
            <el-col :span="8">
              <el-link type="primary" size="small" style="float: right; height: 20px" @click="lockstocks">锁定库存</el-link>
              <el-link type="primary" size="small" style="float: right; height: 20px; margin-right: 10px"
                @click="outbound">直接出库</el-link>
              <el-link type="primary" size="small" style="float: right; height: 20px; margin-right: 10px"
                @click="getData">刷新</el-link></el-col>
              <el-link
                type="primary"
                size="small"
                style="float: right; height: 20px"
                @click="lockstocks"
                >锁定库存</el-link
              >
              <el-link
                type="primary"
                size="small"
                style="float: right; height: 20px; margin-right: 10px"
                @click="outbound"
                >直接出库</el-link
              >
              <el-link
                type="primary"
                size="small"
                style="float: right; height: 20px; margin-right: 10px"
                @click="getData"
                >刷新</el-link
              ></el-col
            >
          </el-row>
        </el-alert>
      </div>
      <div class="box-table" style="margin-top: 1%">
        <el-table ref="singleTable" :data="tableData" style="width: 100%; height: 100%" highlight-current-row
          @current-change="handleCurrentChange" height="500px" @row-click="handleRowClick"
          @selection-change="handleSelectionChange">
        <el-table
          ref="singleTable"
          :data="tableData"
          style="width: 100%; height: 100%"
          highlight-current-row
          @current-change="handleCurrentChange"
          height="500px"
          @row-click="handleRowClick"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55"> </el-table-column>
          <el-table-column label="序号" type="index" fixed="left" width="55" align="center"></el-table-column>
          <el-table-column v-for="(item, index) in tableColumns.filter((x) => !x.hidden)" :key="index" :prop="item.prop"
            :label="item.title" :width="item.width" align="center">
          <el-table-column
            label="序号"
            type="index"
            fixed="left"
            width="55"
            align="center"
          ></el-table-column>
          <el-table-column
            v-for="(item, index) in tableColumns.filter((x) => !x.hidden)"
            :key="index"
            :prop="item.prop"
            :label="item.title"
            :width="item.width"
            align="center"
          >
            <template #default="scoped">
              <div v-if="item.type == 'icon'">
                <el-tooltip class="item" effect="dark" :content="item.title" placement="bottom"><el-link type="primary"
                    :disabled="getButtonEnable(item.prop, scoped.row)" @click="tableButtonClick(scoped.row, item)"><i
                      :class="item.icon" style="font-size: 22px"></i></el-link></el-tooltip>
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="item.title"
                  placement="bottom"
                  ><el-link
                    type="primary"
                    :disabled="getButtonEnable(item.prop, scoped.row)"
                    @click="tableButtonClick(scoped.row, item)"
                    ><i :class="item.icon" style="font-size: 22px"></i></el-link
                ></el-tooltip>
              </div>
              <div v-else-if="item.type == 'tag'">
@@ -42,7 +92,10 @@
      </div>
    </vol-box>
    <stock-select ref="child" @parentCall="parentCall"></stock-select>
    <selected-stock ref="selectedStock" @parentCall="parentCall"></selected-stock>
    <selected-stock
      ref="selectedStock"
      @parentCall="parentCall"
    ></selected-stock>
  </div>
</template>
<script>
@@ -122,7 +175,7 @@
          title: "订单明细状态",
          type: "tag",
          width: 180,
          bindKey: "orderDetailStatusEnum"
          bindKey: "orderDetailStatusEnum",
        },
        {
          prop: "assignStock",
@@ -285,7 +338,8 @@
        if (
          row.orderDetailStatus !== 0 &&
          row.orderDetailStatus !== 60 &&
          row.orderDetailStatus !== 70
          row.orderDetailStatus !== 70 &&
          row.orderDetailStatus !== 80
        ) {
          return true;
        } else {
@@ -358,12 +412,12 @@
  background: oldlace;
}
.box-table .el-table tbody tr:hover>td {
.box-table .el-table tbody tr:hover > td {
  background-color: #d8e0d4 !important;
  /* color: #ffffff; */
}
.box-table .el-table tbody tr.current-row>td {
.box-table .el-table tbody tr.current-row > td {
  background-color: #f0f9eb !important;
  /* color: #ffffff; */
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/basic/materielCodeInfo.vue
@@ -27,25 +27,42 @@
      sortName: "id",
    });
    const editFormFields = ref({
      purchaseOrderNo:"",
      materielCode:"",
      lotNo: "",
      warehouseId: "",
      purchaseOrderNo: "",
      materielCode: "",
      productionDate: "",
      effectiveDate: "",
    });
    const editFormOptions = ref([
      [
        {
          title: "采购单号",
          field: "purchaseOrderNo",
          type:"select",
          dataKey: "purchaseOrderNos",
          title: "仓库",
          field: "warehouseId",
          type: "select",
          dataKey: "areainfo",
          data: [],
          required: true,
        },
      ],
      [
        {
          title: "物料编码",
          field: "materielCode",
          type: "select",
          dataKey: "MaterielCodes",
          required: true,
          // dataKey: "MaterielCodes",
          data: [],
        },
      ],
      [
        {
          title: "采购单号",
          field: "purchaseOrderNo",
          type: "select",
          // dataKey: "purchaseOrderNos",
          data: [],
          required: true,
        },
      ],
      [
@@ -54,6 +71,8 @@
          field: "lotNo",
          required: true,
        },
      ],
      [
        {
          title: "数量",
          field: "quantity",
@@ -64,13 +83,15 @@
        {
          title: "生产日期",
          field: "productionDate",
          type: "date",
          // type: "date",
          required: true,
        },
      ],
      [
        {
          title: "有效期",
          field: "effectiveDate",
          type: "date",
          // type: "date",
          required: true,
        },
      ],
@@ -100,6 +121,14 @@
        align: "left",
      },
      {
        field: "warehouseId",
        title: "仓库",
        type: "string",
        width: 90,
        align: "left",
        bind: { key: "areainfo", data: [] },
      },
      {
        field: "purchaseOrderNo",
        title: "采购单号",
        type: "string",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IPurchaseOrderDetailService.cs
@@ -12,5 +12,7 @@
{
    public interface IPurchaseOrderDetailService : IService<Dt_PurchaseOrderDetail>
    {
        WebResponseContent GetPurchaseOrderDetailMaterielCode(int warehouseId);
        WebResponseContent GetPurchaseOrderNos(string materielCode);
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/PurchaseOrderDetailService.cs
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
@@ -20,5 +21,33 @@
        public PurchaseOrderDetailService(IPurchaseOrderDetailRepository BaseDal) : base(BaseDal)
        {
        }
        public WebResponseContent GetPurchaseOrderDetailMaterielCode(int warehouseId)
        {
            try
            {
                List<Dt_PurchaseOrderDetail> purchaseOrderDetails = BaseDal.QueryData(x => x.WarehouseId == warehouseId && x.PurchaseDetailStatus != PurchaseOrderDetailStatusEnum.Received.ObjToInt());
                List<string> MaterielCodes = purchaseOrderDetails.Select(x => x.MaterielCode).ToList();
                return WebResponseContent.Instance.OK(data: MaterielCodes);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent GetPurchaseOrderNos(string materielCode)
        {
            try
            {
                List<Dt_PurchaseOrderDetail> purchaseOrderDetails = BaseDal.QueryData(x => x.MaterielCode == materielCode && x.PurchaseDetailStatus != PurchaseOrderDetailStatusEnum.Received.ObjToInt());
                List<int> PurchaseOrderIds = purchaseOrderDetails.Select(x => x.PurchaseOrderId).ToList();
                List<Dt_PurchaseOrder> purchaseOrders = BaseDal.Db.Queryable<Dt_PurchaseOrder>().Where(x => PurchaseOrderIds.Contains(x.Id)).ToList();
                List<string> PurchaseOrderNos = purchaseOrders.Select(x => x.PurchaseOrderNo).ToList();
                return WebResponseContent.Instance.OK(data: PurchaseOrderNos);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielCodeInfo.cs
@@ -28,6 +28,12 @@
        public string MaterielCode { get; set; }
        /// <summary>
        /// ä»“库主键
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "仓库编号")]
        public int WarehouseId { get; set; }
        /// <summary>
        /// æ‰¹æ¬¡å·
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "批次号")]
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/PurchaseOrderDetailController.cs
@@ -18,5 +18,15 @@
        public PurchaseOrderDetailController(IPurchaseOrderDetailService service) : base(service)
        {
        }
        [HttpPost, HttpGet, Route("GetPurchaseOrderDetailMaterielCode"), AllowAnonymous]
        public WebResponseContent GetPurchaseOrderDetailMaterielCode(int warehouseId)
        {
            return Service.GetPurchaseOrderDetailMaterielCode(warehouseId);
        }
        [HttpPost, HttpGet, Route("GetPurchaseOrderNos"), AllowAnonymous]
        public WebResponseContent GetPurchaseOrderNos(string materielCode)
        {
            return Service.GetPurchaseOrderNos(materielCode);
        }
    }
}