分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-25 a1c916e4b05662b45d437c02db4effd40abe6296
延迟同步库存信息给MES
已修改8个文件
已添加14个文件
685 ■■■■ 文件已修改
代码管理/WMS/WMS_Client/src/api/http.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/extension/widesea_wms/tomes/dt_info_to_mes.js 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/router/viewGird.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_Entity/MappingConfiguration/ToMES/dt_info_to_mesMapConfig.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_info_to_mesController.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WMS_Client/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
    axios.defaults.baseURL = 'http://192.168.12.118:8098/';
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
}
else if (process.env.NODE_ENV == 'debug') {
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
´úÂë¹ÜÀí/WMS/WMS_Client/src/extension/widesea_wms/tomes/dt_info_to_mes.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
/*****************************************************************************************
**  Author:jxx 2022
**  QQ:283591387
**完整文档见:http://v2.volcore.xyz/document/api ã€ä»£ç ç”Ÿæˆé¡µé¢ViewGrid】
**常用示例见:http://v2.volcore.xyz/document/vueDev
**后台操作见:http://v2.volcore.xyz/document/netCoreDev
*****************************************************************************************/
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridBody: '',
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: { view: [], box: [], detail: [] }, //扩展的按钮
  methods: {
     //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前,
        //示例:在按钮的最前面添加一个按钮
        //   this.buttons.unshift({  //也可以用push或者splice方法来修改buttons数组
        //     name: '按钮', //按钮名称
        //     icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon,vue3版本见element ui文档icon(注意不是element puls文档)
        //     type: 'primary', //按钮样式vue2版本见iview文档button,vue3版本见element ui文档button
        //     onClick: function () {
        //       this.$Message.success('点击了按钮');
        //     }
        //   });
        //示例:设置修改新建、编辑弹出框字段标签的长度
        // this.boxOptions.labelWidth = 150;
    },
    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/WMS_Client/src/router/viewGird.js
@@ -181,6 +181,10 @@
        path: '/dt_geometry_data_detectionline',
        name: 'dt_geometry_data_detectionline',
        component: () => import('@/views/widesea_wms/baseinfo/dt_geometry_data_detectionline.vue')
    }    ,{
        path: '/dt_info_to_mes',
        name: 'dt_info_to_mes',
        component: () => import('@/views/widesea_wms/tomes/dt_info_to_mes.vue')
    }]
export default viewgird
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
<!--
*Author:jxx
 *Contact:283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/widesea_wms/tomes/dt_info_to_mes.js此处编写
 -->
<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/widesea_wms/tomes/dt_info_to_mes.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'ID',
                footer: "Foots",
                cnName: '信息同步MES',
                name: 'tomes/dt_info_to_mes',
                url: "/dt_info_to_mes/",
                sortName: "ID"
            });
            const editFormFields = ref({});
            const editFormOptions = ref([]);
            const searchFormFields = ref({"State":""});
            const searchFormOptions = ref([[{"dataKey":"infoStates","data":[],"title":"状态","field":"State","type":"select"}]]);
            const columns = ref([{field:'ID',title:'ID',type:'int',width:80,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'Info',title:'申请参数信息',type:'string',width:220,require:true,align:'left'},
                       {field:'ActionName',title:'方法名',type:'string',width:120,require:true,align:'left'},
                       {field:'State',title:'状态',type:'bool',bind:{ key:'infoStates',data:[]},width:80,require:true,align:'left'},
                       {field:'Createtime',title:'创建时间',type:'datetime',sort:true,width:140,require:true,align:'left',sort:true},
                       {field:'Remark',title:'备注',type:'string',width:160,require:true,align:'left'},
                       {field:'Message',title:'返回参数信息',type:'string',width:220,align:'left'},
                       {field:'Successtime',title:'成功时间',type:'datetime',sort:true,width:140,align:'left',sort:true}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,92 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *如果数据库字段发生变化,请在代码生器重新生成此Model
 */
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Entity.SystemModels;
namespace WIDESEA_Entity.DomainModels
{
    [Entity(TableCnName = "信息同步MES",TableName = "dt_info_to_mes")]
    public partial class dt_info_to_mes:BaseEntity
    {
        /// <summary>
       ///
       /// </summary>
       [Key]
       [Display(Name ="ID")]
       [Column(TypeName="int")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public int ID { get; set; }
       /// <summary>
       ///参数信息
       /// </summary>
       [Display(Name ="参数信息")]
       [Column(TypeName="nvarchar(max)")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public string Info { get; set; }
       /// <summary>
       ///方法名
       /// </summary>
       [Display(Name ="方法名")]
       [MaxLength(255)]
       [Column(TypeName="nvarchar(255)")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public string ActionName { get; set; }
       /// <summary>
       ///状态
       /// </summary>
       [Display(Name ="状态")]
       [Column(TypeName="bit")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public bool State { get; set; }
       /// <summary>
       ///创建时间
       /// </summary>
       [Display(Name ="创建时间")]
       [Column(TypeName="datetime")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public DateTime Createtime { get; set; }
       /// <summary>
       ///备注
       /// </summary>
       [Display(Name ="备注")]
       [MaxLength(255)]
       [Column(TypeName="varchar(255)")]
       [Editable(true)]
       [Required(AllowEmptyStrings=false)]
       public string Remark { get; set; }
       /// <summary>
       ///返回参数信息
       /// </summary>
       [Display(Name ="返回参数信息")]
       [Column(TypeName="nvarchar(max)")]
       public string Message { get; set; }
       /// <summary>
       ///成功时间
       /// </summary>
       [Display(Name ="成功时间")]
       [Column(TypeName="datetime")]
       public DateTime? Successtime { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *如果数据库字段发生变化,请在代码生器重新生成此Model
 */
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Entity.SystemModels;
namespace WIDESEA_Entity.DomainModels
{
    public partial class dt_info_to_mes
    {
        //此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上 [NotMapped]属性,否则会异常
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_Entity/MappingConfiguration/ToMES/dt_info_to_mesMapConfig.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
using WIDESEA_Entity.MappingConfiguration;
using WIDESEA_Entity.DomainModels;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace WIDESEA_Entity.MappingConfiguration
{
    public class dt_info_to_mesMapConfig : EntityMappingConfiguration<dt_info_to_mes>
    {
        public override void Map(EntityTypeBuilder<dt_info_to_mes>
        builderTable)
        {
          //b.Property(x => x.StorageName).HasMaxLength(45);
        }
     }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs
@@ -168,6 +168,7 @@
            if (task.agv_taskstate == AGVTaskStateEnum.Complete1.ToString())
            {
                var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress);
                if (station2 == null) throw new Exception("未找到终点地址!");
                ////空托任务需修改逻辑
                if (station2.stationCode.Contains("X"))
                    station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty;
@@ -188,6 +189,7 @@
            else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
            {
                var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress);
                if (station1 == null) throw new Exception("未找到起点地址!");
                #region MyRegion
                //if (station1.stationCode.Contains("S"))
                //    station1.quantity = 0;
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs
@@ -24,10 +24,9 @@
        /// </summary>
        /// <param name="task"></param>
        /// <exception cref="Exception"></exception>
        public static MES_Response UploadMESInfo(dt_agvtask task)
        public static void UploadMESInfo(dt_agvtask task)
        {
            object obj = new object();  //上传MES数据
            string mesData = "";//返回数据
            string ActionName = "";  //调用MES方法名
            string name = "";
            MES_Response requestMes = new MES_Response();
@@ -40,7 +39,8 @@
                }
                VOLContext context = new VOLContext();
                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
                if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() /*|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceOutbound.ToString()*/|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString())
                Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context);
                if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() || task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString())
                {
                    if(task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString())
                    {
@@ -58,7 +58,6 @@
                    {
                        foreach (var item in task.bindSN.Split(","))
                        {
                            //var work = workinfoRepository.Find(x => x.SN == item && x.processCode == "28").FirstOrDefault();
                            detail detail = new detail();
                            detail.sn = item;
                            detail.jobID = task.jobID;
@@ -71,7 +70,6 @@
                    {
                        WorkOrder = task.jobID,
                        zoneID = task.agv_fromaddress,
                        //processCode = task.agv_worktype.ToString(),
                        details = list,
                        layerNo = 1,
                        stackID = "1",
@@ -82,7 +80,7 @@
                    ActionName = "agvOutWarehouse";//AGV->MES车轮出库
                    name = "AGV同步MES车轮出库";
                }
                else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString() /*|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString()*/)
                else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString())
                {
                    foreach (var item in task.bindSN.Split(","))
                    {
@@ -97,7 +95,6 @@
                    {
                        WorkOrder = task.jobID,
                        zoneID = task.agv_toaddress,
                        //processCode = task.agv_worktype.ToString(),
                        details = list,
                        layerNo = 1,
                        stackID = "1",
@@ -108,7 +105,6 @@
                    ActionName = "agvInWarehouse";//AGV->MES车轮入库
                    name = "AGV同步MES车轮入库";
                }
                //else if (task.agv_tasktype == "Transfer")  //移库区分  åº“内移库
                else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Carry.ToString())  //移库区分  åº“内移库
                {
                    List<detail1> list1 = new List<detail1>(); //车轮信息
@@ -135,56 +131,24 @@
                    ActionName = "agvMoveWarehouse";//AGV->MES车轮移库
                    name = "AGV同步MES车轮AB库移库";
                }
                //else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString())// å¤–协移库
                //{
                //    var mes_head = FreeDB.Select<dt_mes_head>().Where(x => x.jobID == task.jobID).First();
                //    agvTransferListPara agvTransferListPara = new agvTransferListPara()
                //    {
                //        transferListID = task.agv_tasknum,
                //        materialCode = mes_head.materialCode,
                //        details = list,
                //        drawingNoVer = mes_head.drawingNoVer,
                //        fromWarehouse = "AGV库",
                //        toWarehouse = "毛轮库",
                //        Operator = task.agv_userid,
                //        updateTime = task.agv_createtime.ToString(),
                //    };
                //    obj = agvTransferListPara;
                //    ActionName = "agvTransferList";
                //    name = "AGV同步MES车轮移库AB库->BC库";
                //}
                else
                {
                    requestMes.code = "200";
                    requestMes.Type = "success";
                    return requestMes;
                }
                var postJson = JsonConvert.SerializeObject(obj);
                mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + ActionName);
                if (mesData.Contains("连接尝试失败"))
                    throw new Exception(mesData);
                requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
                if (requestMes.code == "200" && requestMes.Type == "success")
                if (string.IsNullOrEmpty(postJson))
                {
                    //日志记录上传数据成功
                    WriteWMSLog.LogAdd(task.agv_tasknum, "成功", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, requestMes.message);
                    dt_info_to_mes info_To_Mes = new dt_info_to_mes()
                    {
                        Info = postJson,
                        ActionName = ActionName,
                        Createtime = DateTime.Now,
                        Remark = name,
                        State = false
                    };
                    mesRepository.Add(info_To_Mes, true);
                }
                else
                    throw new Exception(requestMes.message);
            }
            catch (Exception ex)
            {
                requestMes.message = ex.Message;
                WriteWMSLog.LogAdd(task.agv_tasknum, "失败", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, ex.Message);
            }
            return requestMes;
            //finally
            //{
            //    WriteWMSLog.LogAdd(task.agv_tasknum, "失败", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, requestMes.message);
            //}
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
using Confluent.Kafka;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.MES_Info;
using WIDESEA_Core.EFDbContext;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.Repositories;
namespace WIDESEA_WMS.Common
{
    public class ToMes
    {
        public static void InfoToMes()
        {
            try
            {
                VOLContext context = new VOLContext();
                Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context);
                var infos = mesRepository.Find(x => !x.State).OrderBy(x => x.Createtime).ToList();
                foreach (var info in infos)
                {
                    try
                    {
                        var mesData = Request.RequestData(info.Info, MESAPIAddress.IPAddress_MES + info.ActionName);
                        if (mesData.Contains("连接尝试失败")) throw new Exception(mesData);
                        if (mesData.Contains("向一个无法连接的网络尝试了一个套接字操作")) throw new Exception(mesData);
                        var requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
                        if (requestMes.code == "200" && requestMes.Type == "success")
                        {
                            info.State = true;
                            info.Successtime = DateTime.Now;
                            info.Message = requestMes.message;
                        }
                        else
                            throw new Exception(requestMes.message);
                    }
                    catch (Exception ex)
                    {
                        info.Message = ex.Message;
                    }
                    mesRepository.Update(info, x => new { x.State, x.Successtime, x.Message }, true);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹Idt_info_to_mesRepository编写接口
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseProvider;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Core.Extensions.AutofacManager;
namespace WIDESEA_WMS.IRepositories
{
    public partial interface Idt_info_to_mesRepository : IDependency,IRepository<dt_info_to_mes>
    {
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 */
using WIDESEA_Core.BaseProvider;
using WIDESEA_Entity.DomainModels;
namespace WIDESEA_WMS.IServices
{
    public partial interface Idt_info_to_mesService : IService<dt_info_to_mes>
    {
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
/*
*所有关于dt_info_to_mes类的业务代码接口应在此处编写
*/
using WIDESEA_Core.BaseProvider;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Core.Utilities;
using System.Linq.Expressions;
namespace WIDESEA_WMS.IServices
{
    public partial interface Idt_info_to_mesService
    {
    }
 }
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹dt_info_to_mesRepository编写代码
 */
using WIDESEA_WMS.IRepositories;
using WIDESEA_Core.BaseProvider;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Core.Extensions.AutofacManager;
using WIDESEA_Entity.DomainModels;
namespace WIDESEA_WMS.Repositories
{
    public partial class dt_info_to_mesRepository : RepositoryBase<dt_info_to_mes> , Idt_info_to_mesRepository
    {
    public dt_info_to_mesRepository(VOLContext dbContext)
    : base(dbContext)
    {
    }
    public static Idt_info_to_mesRepository Instance
    {
      get {  return AutofacContainerModule.GetService<Idt_info_to_mesRepository>(); } }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
/*
 *所有关于dt_info_to_mes类的业务代码应在此处编写
*可使用repository.调用常用方法,获取EF/Dapper等信息
*如果需要事务请使用repository.DbContextBeginTransaction
*也可使用DBServerProvider.手动获取数据库相关信息
*用户信息、权限、角色等使用UserContext.Current操作
*dt_info_to_mesService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
*/
using WIDESEA_Core.BaseProvider;
using WIDESEA_Core.Extensions.AutofacManager;
using WIDESEA_Entity.DomainModels;
using System.Linq;
using WIDESEA_Core.Utilities;
using System.Linq.Expressions;
using WIDESEA_Core.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using WIDESEA_WMS.IRepositories;
namespace WIDESEA_WMS.Services
{
    public partial class dt_info_to_mesService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly Idt_info_to_mesRepository _repository;//访问数据库
        [ActivatorUtilitiesConstructor]
        public dt_info_to_mesService(
            Idt_info_to_mesRepository dbRepository,
            IHttpContextAccessor httpContextAccessor
            )
        : base(dbRepository)
        {
            _httpContextAccessor = httpContextAccessor;
            _repository = dbRepository;
            //多租户会用到这init代码,其他情况可以不用
            //base.Init(dbRepository);
        }
  }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
/*
 *Author:jxx
 *Contact:283591387@qq.com
 *代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
 *所有业务编写全部应在Partial文件夹下dt_info_to_mesService与Idt_info_to_mesService中编写
 */
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.IServices;
using WIDESEA_Core.BaseProvider;
using WIDESEA_Core.Extensions.AutofacManager;
using WIDESEA_Entity.DomainModels;
namespace WIDESEA_WMS.Services
{
    public partial class dt_info_to_mesService : ServiceBase<dt_info_to_mes, Idt_info_to_mesRepository>
    , Idt_info_to_mesService, IDependency
    {
    public dt_info_to_mesService(Idt_info_to_mesRepository repository)
    : base(repository)
    {
    Init(repository);
    }
    public static Idt_info_to_mesService Instance
    {
      get { return AutofacContainerModule.GetService<Idt_info_to_mesService>(); } }
    }
 }
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs
@@ -187,34 +187,31 @@
                    toWarehouseName = "Agv库",
                    Operator = UserContext.Current.UserName,
                };
                Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context);
                var postJson = JsonConvert.SerializeObject(moveWarehousePara);
                var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvMoveWarehouse");
                if (mesData.Contains("连接尝试失败"))
                    throw new Exception(mesData);
                MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
                if (requestMes.code == "200" && requestMes.Type == "success")
                dt_info_to_mes info_To_Mes = new dt_info_to_mes()
                {
                    //日志记录上传数据成功
                    WriteWMSLog.LogAdd("", "成功", "MES", "WMS", postJson, mesData, "人工同步MES车轮移库", "agvMoveWarehouse", requestMes.message);
                    Info = postJson,
                    ActionName = "agvMoveWarehouse",
                    Createtime = DateTime.Now,
                    Remark = "人工同步MES车轮移库",
                    State = false
                };
                mesRepository.Add(info_To_Mes, true);
                    inventory.stationCode = stationCode;
                    _repository.Update(inventory, true);
                    WriteDBLog.Write($"手动移库库存 ", str, LogState.Sucess, "WMS", UserContext.Current.UserName);
                }
                else
                {
                    WriteWMSLog.LogAdd("", "失败", "MES", "WMS", postJson, mesData, "人工同步MES车轮移库", "agvMoveWarehouse", requestMes.message);
                    throw new Exception("人工同步MES车轮移库失败!" + requestMes.message);
                }
                WriteDBLog.Write($"人工移库", str, LogState.Sucess, "WMS", UserContext.Current.UserName);
                content.OK();
            }
            catch (Exception ex)
            {
                content.Message = ex.Message;
                WriteDBLog.Write($"手动移库库存 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
                WriteDBLog.Write($"人工移库", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
            }
            return content;
            //return base.Update(saveModel);
        }
        /// <summary>
        /// åˆ é™¤åº“å­˜
@@ -236,7 +233,6 @@
                    KeyList.Add(key);
                }
                var inventoryList = _repository.Find(x => KeyList.Contains(x.ID.ToString())).ToList();
                //str = $"{string.Join('、', inventoryList.Select(t => t.SN).ToArray())}";
                foreach (var inventorys in inventoryList.GroupBy(x => x.stationCode))
                {
                    try
@@ -251,30 +247,32 @@
                        }
                        agvInWarehousePara outWarehousePara = new agvInWarehousePara()
                        {
                            //WorkOrder = task.jobID,
                            zoneID = inventorys.Key,
                            //processCode = task.agv_worktype.ToString(),
                            details = lists,
                            layerNo = 1,
                            stackID = "1",
                            warehouseName = "Agv库",
                            Operator = UserContext.Current.UserName,
                        };
                        Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context);
                        var postJson = JsonConvert.SerializeObject(outWarehousePara);
                        var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvOutWarehouse");
                        if (mesData.Contains("连接尝试失败")) throw new Exception(mesData);
                        MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
                        if (requestMes.code == "200" && requestMes.Type == "success")
                        dt_info_to_mes info_To_Mes = new dt_info_to_mes()
                        {
                            //日志记录上传数据成功
                            WriteWMSLog.LogAdd("", "成功", "MES", "WMS", postJson, mesData, "人工同步MES车轮出库", "agvOutWarehouse", requestMes.message);
                            Info = postJson,
                            ActionName = "agvOutWarehouse",
                            Createtime = DateTime.Now,
                            Remark = "人工同步MES车轮出库",
                            State = false
                        };
                        mesRepository.Add(info_To_Mes, true);
                            foreach (var inventory in inventorys)
                            {
                                var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
                                station.quantity = station.quantity - 1;
                                if (station.quantity == 0)
                            if (station.quantity < 1)
                                {
                                station.quantity = 0;
                                    station.stationType = string.Empty;
                                    station.heatNumber = string.Empty;
                                    station.Number = string.Empty;
@@ -300,29 +298,21 @@
                                stationinfoRepository.Update(station, true);
                                _repository.Delete(inventory, true);
                            }
                            WriteDBLog.Write($"手动删除库存 ", $"货位编号:{inventorys.Key};SN号:{str}", LogState.Sucess, "WMS", UserContext.Current.UserName);
                        }
                        else
                        {
                            WriteWMSLog.LogAdd("", "失败", "MES", "WMS", postJson, mesData, "人工同步MES车轮出库", "agvOutWarehouse", requestMes.message);
                            throw new Exception("人工同步MES车轮出库失败!" + requestMes.message);
                        }
                        WriteDBLog.Write($"人工出库成功 ", $"货位编号:{inventorys.Key};SN号:{str}", LogState.Sucess, "WMS", UserContext.Current.UserName);
                    }
                    catch (Exception ex)
                    {
                        content.Message = ex.Message;
                        WriteDBLog.Write($"手动删除库存 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
                        WriteDBLog.Write($"人工出库失败 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
                    }
                }
                content.OK();
                //content = base.Del(keys, delList);
                //WriteDBLog.Write($"手动删除库存 ", str, LogState.Sucess, "WMS", UserContext.Current.UserName);
            }
            catch (Exception ex)
            {
                content.Message = ex.Message;
                WriteDBLog.Write($"手动删除库存 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
                WriteDBLog.Write($"人工出库失败 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
            }
            return content;
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs
@@ -80,9 +80,7 @@
                    task.agv_finishedtime = DateTime.Now;
                    #region åŒæ­¥MES出入库信息
                    var mes = HandleTask_Mes.UploadMESInfo(task);
                    if (mes.code != "200" && mes.Type != "success")
                        throw new Exception(mes.message);
                    HandleTask_Mes.UploadMESInfo(task);
                    #endregion
                    HandleTask.Updateinventory(task);
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs
@@ -63,30 +63,33 @@
                        }
                        agvInWarehousePara outWarehousePara = new agvInWarehousePara()
                        {
                            //WorkOrder = task.jobID,
                            zoneID = inventorys.Key,
                            //processCode = task.agv_worktype.ToString(),
                            details = lists,
                            layerNo = 1,
                            stackID = "1",
                            warehouseName = "Agv库",
                            Operator = UserContext.Current.UserName,
                        };
                        Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context);
                        var postJson = JsonConvert.SerializeObject(outWarehousePara);
                        var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvOutWarehouse");
                        if (mesData.Contains("连接尝试失败")) throw new Exception(mesData);
                        MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
                        if (requestMes.code == "200" && requestMes.Type == "success")
                        dt_info_to_mes info_To_Mes = new dt_info_to_mes()
                        {
                            //日志记录上传数据成功
                            WriteWMSLog.LogAdd("", "成功", "MES", "PDA", postJson, mesData, "人工同步MES车轮出库", "agvOutWarehouse", requestMes.message);
                            Info = postJson,
                            ActionName = "agvOutWarehouse",
                            Createtime = DateTime.Now,
                            Remark = "人工同步MES车轮出库",
                            State = false
                        };
                        mesRepository.Add(info_To_Mes, true);
                            foreach (var inventory in inventorys)
                            {
                                var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
                                station.quantity = station.quantity - 1;
                                if (station.quantity == 0)
                            if (station.quantity < 1)
                                {
                                station.quantity = 0;
                                    station.stationType = string.Empty;
                                    station.heatNumber = string.Empty;
                                    station.Number = string.Empty;
@@ -113,12 +116,7 @@
                                inventoryRepository.Delete(inventory, true);
                            }
                            WriteDBLog.Write($"人工出库成功 ", $"货位编号:{inventorys.Key};SN号:{str}", LogState.Sucess, "PDA", user);
                        }
                        else
                        {
                            WriteWMSLog.LogAdd("", "失败", "MES", "PDA", postJson, mesData, "人工同步MES车轮出库", "agvOutWarehouse", requestMes.message);
                            throw new Exception("人工出库同步MES车轮出库失败!" + requestMes.message);
                        }
                    }
                    catch (Exception ex)
                    {
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs
@@ -9,6 +9,7 @@
        public void QueueTaskTiem()
        {
            QueueTask.ReplaceTrayTask();
            ToMes.InfoToMes();
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_info_to_mesController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
/*
 *接口编写处...
*如果接口需要做Action的权限验证,请在Action上使用属性
*如: [ApiActionPermission("dt_info_to_mes",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WMS.IServices;
namespace WIDESEA_WMS.Controllers
{
    public partial class dt_info_to_mesController
    {
        private readonly Idt_info_to_mesService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        [ActivatorUtilitiesConstructor]
        public dt_info_to_mesController(
            Idt_info_to_mesService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *如果要增加方法请在当前目录下Partial文件夹dt_info_to_mesController编写
 */
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core.Controllers.Basic;
using WIDESEA_Entity.AttributeManager;
using WIDESEA_WMS.IServices;
namespace WIDESEA_WMS.Controllers
{
    [Route("api/dt_info_to_mes")]
    [PermissionTable(Name = "dt_info_to_mes")]
    public partial class dt_info_to_mesController : ApiBaseController<Idt_info_to_mesService>
    {
        public dt_info_to_mesController(Idt_info_to_mesService service)
        : base(service)
        {
        }
    }
}