dengjunjie
2025-01-04 296b4aec849d45a075b6068cb121dd0c117d3818
WMS添加物料码信息打印
已修改6个文件
已添加9个文件
592 ■■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/extend/printView.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/router/viewGird.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/basic/materielCodeInfo.vue 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/basic/palletCodeInfo.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/MaterielCodeInfoRepository.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MaterielCodeInfoService.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/MaterielInfoService.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/IMaterielCodeInfoRepository.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMaterielCodeInfoService.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMaterielInfoService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielCodeInfo.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielCodeInfoController.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,154 @@
<template>
  <div>
    <vol-box
      v-model="showDetialBox"
      :lazy="true"
      width="300px"
      :padding="15"
      title="打印"
    >
      <div
        id="printContent"
        style="display: flex; justify-content: center; align-items: center"
      >
        <div
          style="display: flex; justify-content: center; align-items: center"
        >
          <VueQrcode id="qrcode" :value="Code" :size="200"></VueQrcode>
        </div>
      </div>
      <div id="palletcode">
        <span
          style="display: flex; justify-content: center; align-items: center"
          >物料编码:{{ materielCode }}</span
        >
      </div>
      <template #footer>
        <el-button type="primary" size="small" @click="print()">打印</el-button>
        <el-button type="danger" size="small" @click="showDetialBox = false"
          >关闭</el-button
        >
      </template>
    </vol-box>
  </div>
</template>
  <script>
import VolBox from "@/components/basic/VolBox.vue";
import VueQrcode from "vue-qrcode";
import QRCode from "qrcode";
import { da } from "element-plus/es/locales.mjs";
export default {
  components: { VolBox, VueQrcode },
  data() {
    return {
      showDetialBox: false,
      row: null,
      qrcodeDataURL: "",
      Code: "",
      materielCode: "",
      lotNo: "",
      purchaseOrderNo: "",
      quantity: "",
      productionDate: "",
      effectiveDate: "",
    };
  },
  methods: {
    open(row) {
      this.row = row;
      this.showDetialBox = true;
      if (row && row.materielCode) {
        this.materielCode = row.materielCode;
        this.lotNo = row.lotNo;
        this.purchaseOrderNo = row.purchaseOrderNo;
        this.quantity = row.quantity;
        this.productionDate = formatDate(row.productionDate);
        this.effectiveDate = formatDate(row.effectiveDate);
      }
      this.Code =
        "M:" +
        this.materielCode +
        ",BS:" +
        this.lotNo +
        ",DM:" +
        this.productionDate +
        ",DE:" +
        this.effectiveDate +
        ",Q:" +
        this.quantity +
        ",PO:" +
        this.purchaseOrderNo;
    },
    print() {
      let printContent = document.getElementById("printContent");
      let palletcode = document.getElementById("palletcode");
      var printWindow = window.open("", "");
      printWindow.document.write(printContent.innerHTML);
      printWindow.document.write(palletcode.innerHTML);
      printWindow.document.close();
      printWindow.focus();
      printWindow.print();
      printWindow.close();
    },
    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;
    },
  },
  created() {},
};
function formatDate(dateStr) {
  const date = new Date(dateStr);
  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
    2,
    "0"
  )}-${String(date.getDate()).padStart(2, "0")}`;
}
</script>
  <style scoped>
.el-col {
  border-radius: 4px;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.content-text {
  display: flex;
  align-items: center;
  justify-content: center;
}
.right-text {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
</style>
  <style>
.el-table .warning-row {
  background: #e6a23c;
}
.el-table .success-row {
  background: #f0f9eb;
}
.el-table .error-row {
  background: #f56c6c;
}
canvas {
  display: block;
  margin: auto;
}
</style>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/basic/extend/printView.vue
@@ -16,6 +16,8 @@
        >
          <VueQrcode id="qrcode" :value="palletCode" :size="200"></VueQrcode>
        </div>
      </div>
      <div id="palletcode">
        <span
          style="display: flex; justify-content: center; align-items: center"
          >{{ palletCode }}</span
@@ -56,8 +58,10 @@
    },
    print() {
      let printContent = document.getElementById("printContent");
      let palletcode=document.getElementById("palletcode");
      var printWindow = window.open("", "");
      printWindow.document.write(printContent.innerHTML);
      printWindow.document.write(palletcode.innerHTML);
      printWindow.document.close();
      printWindow.focus();
      printWindow.print();
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import gridBody from './extend/materielcodeprintView.vue'
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridBody: gridBody,
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: { view: [], box: [], detail: [] }, //扩展的按钮
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前,
      this.columns.push({
        field: '操作',
        title: '操作',
        width: 90,
        fixed: 'right',
        align: 'center',
        formatter: (row) => {
          return (
            '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-printer">打印</i>'
          );
        },
        click: (row) => {
          this.$refs.gridBody.open(row);
        }
      });
    },
    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;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/router/viewGird.js
@@ -54,6 +54,10 @@
    name: 'palletCodeInfo',
    component: () => import('@/views/basic/palletCodeInfo.vue')
  }, {
    path: '/MaterielCodeInfo',
    name: 'MaterielCodeInfo',
    component: () => import('@/views/basic/materielCodeInfo.vue')
  }, {
    path: '/inboundOrder',
    name: 'inboundOrder',
    component: () => import('@/views/inbound/inboundOrder.vue')
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/basic/materielCodeInfo.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,183 @@
<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/basic/materielCodeInfo.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
  setup() {
    const table = ref({
      key: "id",
      footer: "Foots",
      cnName: "物料码信息",
      name: "MaterielCodeInfo",
      url: "/MaterielCodeInfo/",
      sortName: "id",
    });
    const editFormFields = ref({});
    const editFormOptions = ref([
      [
        {
          title: "物料编码",
          field: "materielCode",
          required: true,
        },
        {
          title: "批次号",
          field: "lotNo",
          required: true,
        },
      ],
      [
        {
          title: "采购单号",
          field: "purchaseOrderNo",
          required: true,
        },
        {
          title: "数量",
          field: "quantity",
          required: true,
        },
      ],
      [
        {
          title: "生产日期",
          field: "productionDate",
          type:"date",
          required: true,
        },
        {
          title: "有效期",
          field: "effectiveDate",
          type:"date",
          required: true,
        },
      ],
    ]);
    const searchFormFields = ref({
      palletCode: "",
    });
    const searchFormOptions = ref([
      [{ title: "批次号", field: "lotNo", type: "like" }],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "materielCode",
        title: "物料编号",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "purchaseOrderNo",
        title: "采购单号",
        type: "string",
        width: 160,
        align: "left",
      },
      {
        field: "lotNo",
        title: "批次号",
        type: "string",
        width: 200,
        align: "left",
      },
      {
        field: "quantity",
        title: "数量",
        type: "int",
        width: 80,
        align: "left",
      },
      {
        field: "productionDate",
        title: "生产日期",
        type: "date",
        width: 100,
        align: "left",
        sort: true,
      },
      {
        field: "effectiveDate",
        title: "有效期",
        type: "date",
        width: 100,
        align: "left",
        sort: true,
      },
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
        sort: true,
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 100,
        hidden:true,
        align: "left",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
        hidden:true,
        sort: true,
      },
    ]);
    const detail = ref({
      cnName: "#detailCnName",
      table: "",
      columns: [],
      sortName: "",
    });
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
    };
  },
});
</script>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/basic/palletCodeInfo.vue
@@ -33,7 +33,7 @@
          title: "仓库",
          field: "warehouseId",
          type: "select",
          dataKey: "warehouses",
          dataKey: "warehouse",
          data: [],
          required: true,
        },
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/MaterielCodeInfoRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_IBasicRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_BasicRepository
{
    public class MaterielCodeInfoRepository : RepositoryBase<Dt_MaterielCodeInfo>, IMaterielCodeInfoRepository
    {
        public MaterielCodeInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MaterielCodeInfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_BasicService
{
    public class MaterielCodeInfoService : ServiceBase<Dt_MaterielCodeInfo, IMaterielCodeInfoRepository>, IMaterielCodeInfoService
    {
        public MaterielCodeInfoService(IMaterielCodeInfoRepository BaseDal) : base(BaseDal)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/MaterielInfoService.cs
@@ -59,6 +59,18 @@
            return BaseDal.QueryData(x => materielCodes.Contains(x.MaterielCode));
        }
        public WebResponseContent GetWarehouseMaterielInfos(int warehouseId)
        {
            try
            {
                List<Dt_MaterielInfo> materielInfos = BaseDal.QueryData(x => x.WarehouseId == warehouseId);
                return WebResponseContent.Instance.OK(data: materielInfos);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// æŽ¥æ”¶ERP物料信息
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/IMaterielCodeInfoRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_IBasicRepository
{
    public interface IMaterielCodeInfoRepository : IRepository<Dt_MaterielCodeInfo>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMaterielCodeInfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_Model.Models;
namespace WIDESEA_IBasicService
{
    public interface IMaterielCodeInfoService : IService<Dt_MaterielCodeInfo>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IMaterielInfoService.cs
@@ -43,6 +43,7 @@
        /// <param name="materielCodes"></param>
        /// <returns></returns>
        List<Dt_MaterielInfo> GetMaterielInfos(List<string> materielCodes);
        WebResponseContent GetWarehouseMaterielInfos(int warehouseId);
        /// <summary>
        /// æŽ¥æ”¶ERP物料信息
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielCodeInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
using Magicodes.ExporterAndImporter.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.DB.Models;
namespace WIDESEA_Model.Models
{
    [SugarTable(nameof(Dt_MaterielCodeInfo), "物料码信息")]
    public class Dt_MaterielCodeInfo : BaseEntity
    {
        /// <summary>
        /// ä¸»é”®
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public int Id { get; set; }
        /// <summary>
        /// ç‰©æ–™ç¼–号
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "物料编号")]
        public string MaterielCode { get; set; }
        /// <summary>
        /// æ‰¹æ¬¡å·
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "批次号")]
        public string LotNo { get; set; }
        /// <summary>
        /// ç”Ÿäº§æ—¥æœŸ
        /// </summary>
        [ImporterHeader(Name = "生产日期")]
        [ExporterHeader(DisplayName = "生产日期")]
        [SugarColumn(IsNullable = false, IsOnlyIgnoreUpdate = true, ColumnDescription = "生产日期")]
        public DateTime ProductionDate {  get; set; }
        /// <summary>
        /// æœ‰æ•ˆæœŸ
        /// </summary>
        [ImporterHeader(Name = "有效期")]
        [ExporterHeader(DisplayName = "有效期")]
        [SugarColumn(IsNullable = false, IsOnlyIgnoreUpdate = true, ColumnDescription = "有效期")]
        public DateTime EffectiveDate { get; set; }
        /// <summary>
        /// é‡‡è´­å•号
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "采购单号")]
        public string PurchaseOrderNo { get; set; }
        /// <summary>
        /// æ•°é‡
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "数量")]
        public float Quantity { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielCodeInfoController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core.BaseController;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_WMSServer.Controllers.Basic
{
    [Route("api/[controller]")]
    [ApiController]
    public class MaterielCodeInfoController : ApiBaseController<IMaterielCodeInfoService, Dt_MaterielCodeInfo>
    {
        public MaterielCodeInfoController(IMaterielCodeInfoService service) : base(service)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs
@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Http;
using Autofac.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core;
using WIDESEA_Core.BaseController;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.CodeConfigEnum;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Basic;
@@ -39,5 +41,15 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// èŽ·å–åº“åŒºç‰©æ–™ä¿¡æ¯
        /// </summary>
        /// <param name="warehouseId"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("GetWarehouseMaterielInfos")]
        public WebResponseContent GetWarehouseMaterielInfos(int warehouseId)
        {
            return Service.GetWarehouseMaterielInfos(warehouseId);
        }
    }
}