dengjunjie
2025-01-10 7cc4be28036bef1aa1f2fbc0f0e6aea6fc5a77c0
优化库存视图前端,优化获取旧WMS辅料库存
已修改10个文件
314 ■■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSClient/public/webconfig.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js 213 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/stock/stockView.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockViewDTO.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/淮安PDA/pages/stash/OutEmpty.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/public/webconfig.js
@@ -1,3 +1,3 @@
window.webConfig = {
    "webApiBaseUrl": "http://127.0.0.1:9293/"
    "webApiBaseUrl": "http://10.30.4.92:9283/"
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js
@@ -1,123 +1,134 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import { el } from "element-plus/es/locales.mjs";
let extension = {
    components: {
      //查询界面扩展组件
      gridHeader: '',
      gridBody: '',
      gridFooter: '',
      //新建、编辑弹出框扩展组件
      modelHeader: '',
      modelBody: '',
      modelFooter: ''
    },
    tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
    buttons: { view: [], box: [], detail: [] }, //扩展的按钮
    methods: {
       //下面这些方法可以保留也可以删除
      onInit() {
        // let InOrder = this.buttons.find(x => x.value == 'StockOutbound');
        // if (InOrder) {
        //   InOrder.onClick = function () {
        //     let rows = this.$refs.table.getSelected();
        //     if (rows.length == 0) return this.$error("请选择数据!");
        //     if (rows.length > 1) return this.$error("请选择单条数据!");
        //     var keys = rows.map(x => { return x.stockId });
        //     this.http
        //       .post("api/Task/Outbound?id="+keys[0], null, "数据处理中")
        //       .then((x) => {
        //         if (!x.status) return this.$message.error(x.message);
        //         this.$message.success("操作成功");
        //         this.refresh();
        //       });
        //   }
        // }
        this.columns.forEach(column => {
          if (column.field == 'materielCode') {
            column.formatter = (row) => {
              var str='';
              var list=row.materielCode.split(',');
              for (let index = 0; index < list.length; index++) {
                str+=list[index]+'<br>';
              }
              return str;
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridBody: '',
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: { view: [], box: [], detail: [] }, //扩展的按钮
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {
      // let InOrder = this.buttons.find(x => x.value == 'StockOutbound');
      // if (InOrder) {
      //   InOrder.onClick = function () {
      //     let rows = this.$refs.table.getSelected();
      //     if (rows.length == 0) return this.$error("请选择数据!");
      //     if (rows.length > 1) return this.$error("请选择单条数据!");
      //     var keys = rows.map(x => { return x.stockId });
      //     this.http
      //       .post("api/Task/Outbound?id="+keys[0], null, "数据处理中")
      //       .then((x) => {
      //         if (!x.status) return this.$message.error(x.message);
      //         this.$message.success("操作成功");
      //         this.refresh();
      //       });
      //   }
      // }
      this.columns.forEach(column => {
        if (column.field == 'materielCode') {
          column.formatter = (row) => {
            var str = '';
            var list = row.materielCode.split(',');
            for (let index = 0; index < list.length; index++) {
              str += list[index] + '<br>';
            }
            return str = list[0] == "" ? "空箱" : str;
          }
          if (column.field == 'batchNo') {
            column.formatter = (row) => {
              var str='';
              var list=row.batchNo.split(',');
              for (let index = 0; index < list.length; index++) {
                str+=list[index]+'<br>';
              }
              return str;
        }
        if (column.field == 'batchNo') {
          column.formatter = (row) => {
            var str = '';
            var list = row.batchNo.split(',');
            for (let index = 0; index < list.length; index++) {
              str += list[index] + '<br>';
            }
            return str = list[0] == "" ? "无" : str;
          }
          if (column.field == 'materielInfo') {
            const today = new Date()
            column.formatter = (row) => {
        }
        if (column.field == 'materielInfo') {
          const today = new Date()
          column.formatter = (row) => {
            if (row.details.length > 0) {
              const today = new Date();
              const closestDate = row.details
              .map(x => {
                .map(x => {
                  const date = new Date(x.effectiveDate);
                  const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
                  return { date, diffInDays };
                })
              .reduce((closest, current) => (current.diffInDays < closest.diffInDays? current : closest))
              .date;
                .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
                .date;
              const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
              return '<span style="color: #F56C6C">'+ daysSinceClosest+"天"+'</span>';
              return '<span style="color: #F56C6C">' + daysSinceClosest + "天" + '</span>';
            } else {
              return '<span style="color: #F56C6C">' + "无保质期" + '</span>';
            }
          }
          if (column.field == 'sumStock') {
            column.formatter = (row) => {
              var sum=0;
        }
        if (column.field == 'sumStock') {
          column.formatter = (row) => {
            if (row.details.length > 0) {
              var sum = 0;
              const closestDate = row.details
              .map(x => {
                sum+=(x.stockQuantity)
              })
              return '<span style="color: #F56C6C">'+ sum+row.details[0].unit+'</span>';
                .map(x => {
                  sum += (x.stockQuantity)
                })
              return '<span style="color: #F56C6C">' + sum + row.details[0].unit + '</span>';
            } else {
              return '<span style="color: #F56C6C">' + "1个" + '</span>';
            }
          }
        })
      },
      onInited() {
        //框架初始化配置后
        //如果要配置明细表,在此方法操作
        //this.detailOptions.columns.forEach(column=>{ });
      },
      searchBefore(param) {
        //界面查询前,可以给param.wheres添加查询参数
        //返回false,则不会执行查询
        return true;
      },
      searchAfter(result) {
        //查询后,result返回的查询数据,可以在显示到表格前处理表格的值
        return true;
      },
      addBefore(formData) {
        //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
        return true;
      },
      updateBefore(formData) {
        //编辑保存前formData为对象,包括明细表、删除行的Id
        return true;
      },
      rowClick({ row, column, event }) {
        //查询界面点击行事件
        this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
      },
      modelOpenAfter(row) {
        //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
        //(1)判断是编辑还是新建操作: this.currentAction=='Add';
        //(2)给弹出框设置默认值
        //(3)this.editFormFields.字段='xxx';
        //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
        //看不懂就把输出看:console.log(this.editFormOptions)
      }
        }
      })
    },
    onInited() {
      //框架初始化配置后
      //如果要配置明细表,在此方法操作
      //this.detailOptions.columns.forEach(column=>{ });
    },
    searchBefore(param) {
      //界面查询前,可以给param.wheres添加查询参数
      //返回false,则不会执行查询
      return true;
    },
    searchAfter(result) {
      //查询后,result返回的查询数据,可以在显示到表格前处理表格的值
      return true;
    },
    addBefore(formData) {
      //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
      return true;
    },
    updateBefore(formData) {
      //编辑保存前formData为对象,包括明细表、删除行的Id
      return true;
    },
    rowClick({ row, column, event }) {
      //查询界面点击行事件
      this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
    },
    modelOpenAfter(row) {
      //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
      //(1)判断是编辑还是新建操作: this.currentAction=='Add';
      //(2)给弹出框设置默认值
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看:console.log(this.editFormOptions)
    }
  };
  export default extension;
  }
};
export default extension;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/stock/stockView.vue
@@ -49,7 +49,8 @@
      ],
      [
        { title: "物料编号", field: "materielCode",type: "like"},
        { title: "批次号", field: "batchNo",type: "like"}
        { title: "批次号", field: "batchNo",type: "like"},
        { title: "所属仓库", field: "warehouseId",type: "selectList",dataKey: "warehouse",data: [],},
      ],
    ]);
    const columns = ref([
@@ -86,6 +87,14 @@
        align: "left",
      },
      {
        field: "warehouseId",
        title: "所属仓库",
        type: "string",
        width: 80,
        align: "left",
        bind: { key: "warehouse", data: [] },
      },
      {
        field: "roadwayNo",
        title: "巷道编号",
        type: "decimal",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
@@ -131,6 +131,7 @@
                            Details = new List<Dt_StockInfoDetail>()
                        };
                        var ContainerDetailsInfos = TesugarClient.Queryable("ContainerDetailsInfo", "x").Where("CId", "=", id).ToList();
                        if (ContainerDetailsInfos.Count < 1) stockInfo.PalletType = PalletTypeEnum.Empty.ObjToInt();
                        foreach (var ContainerDetailsInfo in ContainerDetailsInfos)
                        {
                            dynamic ruleConfig1 = ContainerDetailsInfo;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockViewDTO.cs
@@ -16,62 +16,67 @@
    public class StockViewDTO
    {
        /// <summary>
        ///
        /// è´§ä½ç¼–号
        /// </summary>
        public string LocationCode { get; set; }
        /// <summary>
        ///
        /// è´§ä½åç§°
        /// </summary>
        public string LocationName { get; set; }
        /// <summary>
        ///
        /// è´§ä½åˆ—
        /// </summary>
        public int Column { get; set; }
        /// <summary>
        ///
        /// è´§ä½è¡Œ
        /// </summary>
        public int Row { get; set; }
        /// <summary>
        ///
        /// è´§ä½å±‚
        /// </summary>
        public int Layer { get; set; }
        /// <summary>
        ///
        /// åº“区主键
        /// </summary>
        public int WarehouseId {  get; set; }
        /// <summary>
        /// è´§ä½æ·±åº¦
        /// </summary>
        public int Depth { get; set; }
        /// <summary>
        ///
        /// è´§ä½çŠ¶æ€
        /// </summary>
        public int LocationStatus { get; set; }
        /// <summary>
        ///
        /// è´§ä½ç±»åž‹
        /// </summary>
        public int LocationType { get; set; }
        /// <summary>
        ///
        /// å··é“编号
        /// </summary>
        public string RoadwayNo { get; set; }
        /// <summary>
        ///
        /// ç¦ç”¨çŠ¶æ€
        /// </summary>
        public int EnalbeStatus { get; set; }
        /// <summary>
        ///
        /// åº“存主键
        /// </summary>
        public int StockId { get; set; }
        /// <summary>
        ///
        /// æ‰˜ç›˜å·
        /// </summary>
        public string PalletCode { get; set; }
@@ -81,47 +86,47 @@
        public bool IsFull { get; set; }
        /// <summary>
        ///
        /// ç‰©æ–™ç¼–码
        /// </summary>
        public string MaterielCode { get; set; }
        /// <summary>
        ///
        /// ç‰©æ–™æ‰¹å·
        /// </summary>
        public string BatchNo { get; set; }
        /// <summary>
        ///
        /// åº“存状态
        /// </summary>
        public int StockStatus { get; set; }
        /// <summary>
        ///
        /// åº“存备注
        /// </summary>
        public string StockRemark { get; set; }
        /// <summary>
        ///
        /// åˆ›å»ºäºº
        /// </summary>
        public string Creater { get; set; }
        /// <summary>
        ///
        /// åˆ›å»ºæ—¶é—´
        /// </summary>
        public DateTime CreateDate { get; set; }
        /// <summary>
        ///
        /// ä¿®æ”¹äºº
        /// </summary>
        public string Modifier { get; set; }
        /// <summary>
        ///
        /// ä¿®æ”¹æ—¶é—´
        /// </summary>
        public DateTime? ModifyDate { get; set; }
        /// <summary>
        ///
        /// åº“存详情
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(Dt_StockInfoDetail.StockId), nameof(StockId))]
        public List<Dt_StockInfoDetail> Details { get; set; }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -76,7 +76,7 @@
        /// <param name="qty">数量</param>
        /// <param name="address">地址</param>
        /// <returns></returns>
        WebResponseContent OutEmpty(int qty, string address, int WarehouseId);
        WebResponseContent OutEmpty(int qty, string address, int WarehouseId, string barcode);
        /// <summary>
        /// WCS申请入库
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs
@@ -88,6 +88,7 @@
                    Depth = a.Depth,
                    EnalbeStatus = a.EnableStatus,
                    Layer = a.Layer,
                    WarehouseId = b.WarehouseId,
                    LocationName = a.LocationName,
                    LocationStatus = a.LocationStatus,
                    LocationType = a.LocationType,
@@ -101,7 +102,7 @@
                    StockStatus = b.StockStatus,
                    Details = b.Details,
                });
            int totalCount = 0;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
@@ -53,7 +53,7 @@
                {
                    return WebResponseContent.Instance.Error($"未找到组盘信息");
                }
                if (stockInfo.StockStatus != StockStatusEmun.组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.手动组盘暂存.ObjToInt() && stockInfo.StockStatus!=StockStatusEmun.出库完成.ObjToInt())
                if (stockInfo.StockStatus != StockStatusEmun.组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.手动组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.出库完成.ObjToInt())
                {
                    return WebResponseContent.Instance.Error($"该托盘状态不正确,不可申请入库");
                }
@@ -173,7 +173,7 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent OutEmpty(int qty, string address, int WarehouseId)
        public WebResponseContent OutEmpty(int qty, string address, int WarehouseId, string barcode)
        {
            try
            {
@@ -182,8 +182,17 @@
                {
                    return WebResponseContent.Instance.Error($"未找到库区");
                }
                var stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.WarehouseId == WarehouseId && x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.入库完成.ObjToInt(), qty, nameof(Dt_StockInfo.CreateDate));
                if (stockInfos == null) return WebResponseContent.Instance.Error($"{warehouse.WarehouseName}未找到空箱库存");
                List<Dt_StockInfo> stockInfos = null;
                if (string.IsNullOrEmpty(barcode))
                {
                    stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.WarehouseId == WarehouseId && x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.入库完成.ObjToInt(), qty, nameof(Dt_StockInfo.CreateDate));
                }
                else
                {
                    stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.WarehouseId == WarehouseId && x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && x.PalletCode == barcode);
                    if (stockInfos.Count == 0) return WebResponseContent.Instance.Error($"{warehouse.WarehouseName}未找到空箱【{barcode}】");
                }
                if (stockInfos.Count < qty) return WebResponseContent.Instance.Error($"{warehouse.WarehouseName}空箱库存不足,库存数【{stockInfos.Count}】");
                List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutEmpty);
                stockInfos.ForEach(x =>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs
@@ -61,9 +61,9 @@
        /// <param name="address">地址</param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("OutEmpty"), AllowAnonymous]
        public WebResponseContent OutEmpty(int qty, string address, int WarehouseId)
        public WebResponseContent OutEmpty(int qty, string address, int WarehouseId, string barcode)
        {
            return Service.OutEmpty(qty, address, WarehouseId);
            return Service.OutEmpty(qty, address, WarehouseId,barcode);
        }
        [HttpPost, HttpGet, Route("DeviceRequestInboundTask"), AllowAnonymous]
´úÂë¹ÜÀí/»´°²PDA/pages/stash/OutEmpty.vue
@@ -6,6 +6,9 @@
                    <uni-easyinput type="text" placeholder="请输入数量" ref='midInput' :focus="!focus" v-model="qty"
                        @input="barcodeInput" />
                </uni-forms-item>
                <uni-forms-item label="托盘条码:">
                    <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="focus" v-model="barcode" />
                </uni-forms-item>
                <uni-forms-item>
                    <button @click="OutEmpty" type="primary" size="default" style="margin-top: 2%;">空箱出库</button>
                </uni-forms-item>
@@ -23,12 +26,14 @@
                focus: false,
                qty: "",
                address: "",
                barcode: "",
            }
        },
        onShow() {},
        onLoad(res) {
            this.WarehouseId = res.warehouseId;
            this.focus = false;
            this.qty = 1;
            if (res.warehouseId == 5) {
                this.address = "8001";
            }
@@ -53,8 +58,15 @@
                    })
                    return;
                }
                if (this.qty < 1) {
                    this.$refs.uToast.show({
                        title: "数量不能小于1",
                        type: 'error'
                    })
                    return;
                }
                this.$u.post('/api/Task/OutEmpty?qty=' + this.qty + '&address=' + this.address + '&WarehouseId=' +
                    this.WarehouseId).then(
                    this.WarehouseId + '&barcode=' + this.barcode).then(
                    res => {
                        if (res.status) {
                            this.$refs.uToast.show({