1
helongyang
7 小时以前 78ac0aac3c9e71ac661cc49e5b0f148e6af5073e
1
已添加2个文件
已修改4个文件
628 ■■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSClient/src/extension/stock/ToUserStockView.js 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/router/viewGird.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/stock/ToUserStockView.vue 425 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/stock/stockView.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/stock/ToUserStockView.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,185 @@
//此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 SelectTake = this.buttons.find(x => x.value == 'SelectStockTake');
      if (SelectTake) {
        SelectTake.onClick = function () {
          let stockViews = this.$refs.table.getSelected();
          this.http
            .post("api/Task/TakeOutbound",stockViews, "数据处理中")
            .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 = list[0] == "" ? "无" : str;
          }
        }
        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 => {
                        const date = new Date(x.effectiveDate);
                        const diffInDays = Math.ceil((date - today) / (1000 * 60 * 60 * 24)); // æ”¹ä¸ºè®¡ç®—剩余天数
                        return { date, diffInDays };
                    })
                    .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
                    .date;
                const daysRemaining = Math.ceil((closestDate - today) / (1000 * 60 * 60 * 24));
                row.expiryDays = daysRemaining;
                if (daysRemaining <= 0) {
                    return '<span style="color:rgb(30, 27, 27)">无保质期</span>';
                } else {
                    return '<span style="color: #F56C6C">' + daysRemaining + "天" + '</span>';
                }
            } else {
                row.expiryDays = null;
                return '<span style="color:rgb(24, 18, 18)">无保质期</span>';
            }
        }
      }
      if (column.field == 'inventoryage') {
          const today = new Date()
          column.formatter = (row) => {
              if (row.details.length > 0) {
                  const closestDate = row.details
                      .map(x => {
                          const date = new Date(x.createDate);
                          const ageInDays = Math.ceil((today - date) / (1000 * 60 * 60 * 24));
                          return { date, ageInDays };
                      })
                      .reduce((closest, current) => (current.ageInDays < closest.ageInDays ? current : closest))
                      .date;
                  const inventoryAge = Math.ceil((today - closestDate) / (1000 * 60 * 60 * 24));
                  row.inventoryAge = inventoryAge;
                  return `${inventoryAge} å¤©`;
              }
              // å¦‚果没有明细,返回空或提示信息
              return '-';
          }
        }
        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: rgb(24, 18, 18)">' + sum.toFixed(3) + row.details[0].unit + '</span>';
            } else {
              return '<span style="color: rgb(24, 18, 18)">' + "1个" + '</span>';
            }
          }
        }
      })
      this.columns.forEach((column) => {
        column.cellStyle = (row) => {
          if (row.expirationlabel !== undefined && row.expirationlabel !== null) {
            if (row.expirationlabel === 2) {
              return { background: 'yellow' };
            } else if (row.expirationlabel === 3) {
              return { background: '#ffc0cb' };
            }
          }
          return {};
        };
      });
    },
    onInited() {
      //框架初始化配置后
      //如果要配置明细表,在此方法操作
      //this.detailOptions.columns.forEach(column=>{ });
      this.detailOptions.summary = true;
        this.detailOptions.columns.forEach(x => {
          if (x.field == 'stockQuantity') {
              x.summary = true;
              //计算平均值
              // x.summary = 'avg';//2023.05.03更新voltable文件后才能使用
              //设置小数显示位数(默认2位)
              // x.numberLength = 4;
          }
        });
    },
    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;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/router/viewGird.js
@@ -306,6 +306,10 @@
    path: '/proCollectOutOrder',
    name: 'proCollectOutOrder',
    component: () => import('@/views/outbound/proCollectOutOrder.vue')
  }, {
    path: '/ToUserStockView',
    name: 'ToUserStockView',
    component: () => import('@/views/stock/ToUserStockView.vue')
  }
]
export default viewgird
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/stock/ToUserStockView.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,425 @@
<template>
  <view-grid
    ref="grid"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  </view-grid>
</template>
    <script>
import extend from "@/extension/stock/ToUserStockView.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
  setup() {
    const table = ref({
      key: "stockId",
      footer: "Foots",
      cnName: "库存视图",
      name: "StockView",
      url: "/StockView/",
      sortName: "stockId",
    });
    const editFormFields = ref({
      palletCode: "",
      locationCode: "",
      locationName: "",
    });
    const editFormOptions = ref([
    ]);
    const searchFormFields = ref({
      palletCode: "",
      // locationCode: "",
      materielCode:"",
      batchNo:"",
      expirationlabel:"1",
    });
    const searchFormOptions = ref([
      [
        { title: "托盘编号", field: "palletCode",type: "like" },
        { title: "货位编号", field: "locationCode",type: "like" },
        { title: "货位状态", field: "locationStatus" ,type: "selectList",dataKey: "locationStatusEnum",data: [],},
        { title: "库存状态", field: "stockStatus",type: "selectList",dataKey: "stockStatusEmun",data: [],},
      ],
      [
        { title: "物料编号", field: "materielCode",type: "like"},
        { title: "批次号", field: "batchNo",type: "like"},
        { title: "所属仓库", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],},
        { title: "库存创建时间",field: "createDate",type: "datetime"},
      ],
      [
        { title: "有效期查询",field: "effectiveDate",type: "date"},
        {title: "物料有效期",field: "expirationlabel",type: "selectList",dataKey:"expirationlabelEnum",data:[]},
        { title: "库龄(小于)", field: "inventoryage",type: "string"},
        { title: "库龄(大于)", field: "inventoryage1",type: "string"},
      ],
    ]);
    const columns = ref([
      {
        field: "stockId",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "palletCode",
        title: "托盘编号",
        type: "string",
        width: 150,
        link: true,
        align: "left",
      },
      {
        field: "locationCode",
        title: "货位编号",
        type: "string",
        width: 200,
        align: "left",
      },
      {
        field: "locationName",
        title: "货位名称",
        type: "string",
        width: 270,
        align: "left",
      },
      {
        field: "warehouseId",
        title: "所属仓库",
        type: "string",
        width: 80,
        align: "left",
        bind: { key: "warehouses", data: [] },
      },
      {
        field: "roadwayNo",
        title: "巷道编号",
        type: "decimal",
        width: 100,
        align: "left",
        hidden:true
      },
      {
        field: "materielCode",
        title: "所含物料编号",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "batchNo",
        title: "所含物料批次",
        type: "string",
        width: 200,
        align: "left"
      },
      {
        field: "expirationlabel",
        title: "物料有效期",
        type: "string",
        width: 140,
        align: "left",
        bind: { key: "expirationlabelEnum", data: [] },
      },
      {
        field: "materielInfo",
        title: "所含物料最早临期",
        type: "string",
        width: 140,
        align: "left",
      },
      {
        field: "inventoryage",
        title: "库龄",
        type: "string",
        width: 140,
        align: "left",
      },
      {
        field: "sumStock",
        title: "总库存",
        type: "string",
        width: 140,
        align: "left",
      },
      {
        field: "row",
        title: "货位行",
        type: "string",
        width: 90,
        align: "left",
        hidden: true,
      },
      {
        field: "column",
        title: "货位列",
        type: "int",
        width: 120,
        align: "left",
        hidden: true,
      },
      {
        field: "layer",
        title: "货位层",
        type: "string",
        width: 200,
        align: "left",
        hidden: true,
      },
      {
        field: "depth",
        title: "货位深度",
        type: "string",
        width: 180,
        align: "left",
        hidden: true,
      },
      {
        field: "stockStatus",
        title: "库存状态",
        type: "string",
        width: 200,
        align: "left",
        bind: { key: "stockStatusEmun", data: [] },
      },
      {
        field: "locationType",
        title: "货位类型",
        type: "string",
        width: 100,
        align: "left",
        bind:{key: "locationTypeEnum", data: []}
      },
      {
        field: "locationStatus",
        title: "货位状态",
        type: "string",
        width: 120,
        align: "left",
        bind: { key: "locationStatusEnum", data: [] },
      },
      {
        field: "enalbeStatus",
        title: "禁用状态",
        type: "string",
        width: 80,
        align: "left",
        bind: { key: "enableStatusEnum", data: [] },
      },
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
        hidden:true
      },
    ]);
    const detail = ref({
      cnName: "库存明细信息",
      table: "StockInfoDetail",
      columns: [
        {
          field: "id",
          title: "Id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "stockId",
          title: "库存信息主键",
          type: "string",
          width: 90,
          align: "left",
          hidden: true
        },
        {
          field: "materielCode",
          title: "物料编号",
          type: "string",
          width: 110,
          align: "left",
        },
        {
          field: "materielName",
          title: "物料名称",
          type: "string",
          width: 130,
          align: "left",
        },
        {
          field: "orderNo",
          title: "单据编号",
          type: "decimal",
          width: 130,
          align: "left",
        },
        {
          field: "batchNo",
          title: "批次号",
          type: "string",
          width: 180,
          align: "left",
        },
        {
          field: "materielSpec",
          title: "规格型号",
          type: "string",
          width: 180,
          align: "left",
        },
        {
          field: "serialNumber",
          title: "序列号",
          type: "int",
          width: 120,
          align: "left",
          hidden: true,
        },
        {
          field: "stockQuantity",
          title: "库存数量",
          type: "string",
          width: 80,
          align: "left",
        },
        {
          field: "outboundQuantity",
          title: "出库数量",
          type: "string",
          width: 80,
          align: "left",
        },
        {
          field: "unit",
          title: "单位",
          type: "string",
          width: 50,
          align: "left",
        },
        {
          field: "productionDate",
          title: "生产日期",
          type: "string",
          width: 120,
          align: "left",
        },
        {
          field: "effectiveDate",
          title: "有效日期",
          type: "string",
          width: 120,
          align: "left",
        },
        {
          field: "status",
          title: "库存明细状态",
          type: "string",
          width: 120,
          align: "left",
          bind: { key: "stockStatusEmun", data: [] }
        },
        {
          field: "creater",
          title: "创建人",
          type: "string",
          width: 90,
          align: "left",
          hidden: true
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 160,
          align: "left",
          hidden: true
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 100,
          align: "left",
          hidden: true
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 160,
          align: "left",
          hidden: true
        },
        {
          field: "remark",
          title: "备注",
          type: "string",
          width: 100,
          align: "left",
          hidden: true
        },
      ],
      sortName: "id",
      key: "id",
    });
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
    };
  },
});
</script>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/stock/stockView.vue
@@ -30,6 +30,7 @@
      palletCode: "",
      locationCode: "",
      locationName: "",
    });
    const editFormOptions = ref([
      
@@ -38,7 +39,9 @@
      palletCode: "",
      // locationCode: "",
      materielCode:"",
      batchNo:""
      batchNo:"",
      expirationlabel:"",
    });
    const searchFormOptions = ref([
      [
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs
@@ -80,6 +80,13 @@
                                                .Where(x => x.LocationCode == param.Value.ToString());
                                        }
                                        break;
                                    case var name when name == nameof(Dt_StockInfo.PalletCode).FirstLetterToLower():
                                        if (!string.IsNullOrEmpty(param.Value?.ToString()))
                                        {
                                            sugarQueryable1 = sugarQueryable1
                                                .Where(x => x.PalletCode == param.Value.ToString());
                                        }
                                        break;
                                    case var name when name == nameof(Dt_StockInfo.CreateDate).FirstLetterToLower():
                                        if (DateTime.TryParse(param.Value?.ToString(), out DateTime minDate))
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -1303,7 +1303,7 @@
                        }
                    }
                }
                if(task.WarehouseId == 11 || task.WarehouseId == 4||task.WarehouseId == 13)
                if(task.WarehouseId == 11 || task.WarehouseId == 4||task.WarehouseId == 12)
                {
                    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.自动删除 : OperateTypeEnum.人工删除);
                    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.自动删除 : OperateTypeEnum.人工删除);