From a1c916e4b05662b45d437c02db4effd40abe6296 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 25 五月 2024 17:19:44 +0800 Subject: [PATCH] 延迟同步库存信息给MES --- 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs | 27 + 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs | 21 + 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs | 58 ++++ 代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs | 13 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs | 92 ++++++ 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs | 122 ++++---- 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs | 21 + 代码管理/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs | 18 + 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs | 84 ++--- 代码管理/WMS/WMS_Server/WIDESEA_Entity/MappingConfiguration/ToMES/dt_info_to_mesMapConfig.cs | 16 + 代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs | 12 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs | 1 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs | 2 代码管理/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue | 63 ++++ 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_info_to_mesController.cs | 33 ++ 代码管理/WMS/WMS_Client/src/extension/widesea_wms/tomes/dt_info_to_mes.js | 75 +++++ 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs | 41 ++ 代码管理/WMS/WMS_Client/src/api/http.js | 2 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs | 72 +--- 代码管理/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs | 24 + 代码管理/WMS/WMS_Client/src/router/viewGird.js | 4 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs | 4 22 files changed, 638 insertions(+), 167 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js" index 9b0280d..eb0a016 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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/'; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/extension/widesea_wms/tomes/dt_info_to_mes.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/extension/widesea_wms/tomes/dt_info_to_mes.js" new file mode 100644 index 0000000..8935403 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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 銆愪唬鐮佺敓鎴愰〉闈iewGrid銆� +**甯哥敤绀轰緥瑙侊細http://v2.volcore.xyz/document/vueDev +**鍚庡彴鎿嶄綔瑙侊細http://v2.volcore.xyz/document/netCoreDev +*****************************************************************************************/ +//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 + +let extension = { + components: { + //鏌ヨ鐣岄潰鎵╁睍缁勪欢 + gridHeader: '', + gridBody: '', + gridFooter: '', + //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) + buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� + methods: { + //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� + onInit() { //妗嗘灦鍒濆鍖栭厤缃墠锛� + //绀轰緥锛氬湪鎸夐挳鐨勬渶鍓嶉潰娣诲姞涓�涓寜閽� + // this.buttons.unshift({ //涔熷彲浠ョ敤push鎴栬�卻plice鏂规硶鏉ヤ慨鏀筨uttons鏁扮粍 + // name: '鎸夐挳', //鎸夐挳鍚嶇О + // icon: 'el-icon-document', //鎸夐挳鍥炬爣vue2鐗堟湰瑙乮view鏂囨。icon锛寁ue3鐗堟湰瑙乪lement ui鏂囨。icon(娉ㄦ剰涓嶆槸element puls鏂囨。) + // type: 'primary', //鎸夐挳鏍峰紡vue2鐗堟湰瑙乮view鏂囨。button锛寁ue3鐗堟湰瑙乪lement ui鏂囨。button + // onClick: function () { + // this.$Message.success('鐐瑰嚮浜嗘寜閽�'); + // } + // }); + + //绀轰緥锛氳缃慨鏀规柊寤恒�佺紪杈戝脊鍑烘瀛楁鏍囩鐨勯暱搴� + // this.boxOptions.labelWidth = 150; + }, + onInited() { + //妗嗘灦鍒濆鍖栭厤缃悗 + //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 + //this.detailOptions.columns.forEach(column=>{ }); + }, + searchBefore(param) { + //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 + //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ + return true; + }, + searchAfter(result) { + //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊� + return true; + }, + addBefore(formData) { + //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� + return true; + }, + updateBefore(formData) { + //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d + return true; + }, + rowClick({ row, column, event }) { + //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� + // this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; + }, + modelOpenAfter(row) { + //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 + //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; + //(2)缁欏脊鍑烘璁剧疆榛樿鍊� + //(3)this.editFormFields.瀛楁='xxx'; + //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� + //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + } + } +}; +export default extension; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/router/viewGird.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/router/viewGird.js" index 060560a..92e310e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/router/viewGird.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue" new file mode 100644 index 0000000..9641ee8 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/tomes/dt_info_to_mes.vue" @@ -0,0 +1,63 @@ +<!-- +*Author锛歫xx + *Contact锛�283591387@qq.com + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *涓氬姟璇峰湪@/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> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs" new file mode 100644 index 0000000..e971d18 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_info_to_mes.cs" @@ -0,0 +1,92 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *濡傛灉鏁版嵁搴撳瓧娈靛彂鐢熷彉鍖栵紝璇峰湪浠g爜鐢熷櫒閲嶆柊鐢熸垚姝odel + */ +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; } + + + } +} \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs" new file mode 100644 index 0000000..ac225c6 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/dt_info_to_mes.cs" @@ -0,0 +1,21 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *濡傛灉鏁版嵁搴撳瓧娈靛彂鐢熷彉鍖栵紝璇峰湪浠g爜鐢熷櫒閲嶆柊鐢熸垚姝odel + */ +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鐨勫彟涓�涓猵artial),濡傛灉琛ㄤ腑娌℃湁姝ゅ瓧娈佃鍔犱笂 [NotMapped]灞炴�э紝鍚﹀垯浼氬紓甯� + } +} \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/MappingConfiguration/ToMES/dt_info_to_mesMapConfig.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/MappingConfiguration/ToMES/dt_info_to_mesMapConfig.cs" new file mode 100644 index 0000000..5b5f841 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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); + } + } +} + diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" index 24685db..7ede5a5 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" index dddca41..d60667a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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,9 +39,10 @@ } 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()) + if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString()) { foreach (var item in task.bindSN.Split(",")) { @@ -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; @@ -66,23 +65,22 @@ list.Add(detail); } } - + agvInWarehousePara outWarehousePara = new agvInWarehousePara() { WorkOrder = task.jobID, zoneID = task.agv_fromaddress, - //processCode = task.agv_worktype.ToString(), details = list, layerNo = 1, stackID = "1", warehouseName = "Agv搴�", - Operator="AGV鑷姩", + Operator = "AGV鑷姩", }; obj = outWarehousePara; 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); - //} } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs" new file mode 100644 index 0000000..928dbe2 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/ToMES/info.cs" @@ -0,0 +1,58 @@ +锘縰sing 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; + } + + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs" new file mode 100644 index 0000000..bbd1023 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IRepositories/ToMES/Idt_info_to_mesRepository.cs" @@ -0,0 +1,18 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *Repository鎻愪緵鏁版嵁搴撴搷浣滐紝濡傛灉瑕佸鍔犳暟鎹簱鎿嶄綔璇峰湪褰撳墠鐩綍涓婸artial鏂囦欢澶笽dt_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> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs" new file mode 100644 index 0000000..75b81e2 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Idt_info_to_mesService.cs" @@ -0,0 +1,12 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + */ +using WIDESEA_Core.BaseProvider; +using WIDESEA_Entity.DomainModels; + +namespace WIDESEA_WMS.IServices +{ + public partial interface Idt_info_to_mesService : IService<dt_info_to_mes> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs" new file mode 100644 index 0000000..996ebc4 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/ToMES/Partial/Idt_info_to_mesService.cs" @@ -0,0 +1,13 @@ +/* +*鎵�鏈夊叧浜巇t_info_to_mes绫荤殑涓氬姟浠g爜鎺ュ彛搴斿湪姝ゅ缂栧啓 +*/ +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 + { + } + } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs" new file mode 100644 index 0000000..35d327b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Repositories/ToMES/dt_info_to_mesRepository.cs" @@ -0,0 +1,24 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *Repository鎻愪緵鏁版嵁搴撴搷浣滐紝濡傛灉瑕佸鍔犳暟鎹簱鎿嶄綔璇峰湪褰撳墠鐩綍涓婸artial鏂囦欢澶筪t_info_to_mesRepository缂栧啓浠g爜 + */ +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>(); } } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs" new file mode 100644 index 0000000..77e171a --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/Partial/dt_info_to_mesService.cs" @@ -0,0 +1,41 @@ +/* + *鎵�鏈夊叧浜巇t_info_to_mes绫荤殑涓氬姟浠g爜搴斿湪姝ゅ缂栧啓 +*鍙娇鐢╮epository.璋冪敤甯哥敤鏂规硶锛岃幏鍙朎F/Dapper绛変俊鎭� +*濡傛灉闇�瑕佷簨鍔¤浣跨敤repository.DbContextBeginTransaction +*涔熷彲浣跨敤DBServerProvider.鎵嬪姩鑾峰彇鏁版嵁搴撶浉鍏充俊鎭� +*鐢ㄦ埛淇℃伅銆佹潈闄愩�佽鑹茬瓑浣跨敤UserContext.Current鎿嶄綔 +*dt_info_to_mesService瀵瑰銆佸垹銆佹敼鏌ャ�佸鍏ャ�佸鍑恒�佸鏍镐笟鍔′唬鐮佹墿灞曞弬鐓erviceFunFilter +*/ +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; + //澶氱鎴蜂細鐢ㄥ埌杩檌nit浠g爜锛屽叾浠栨儏鍐靛彲浠ヤ笉鐢� + //base.Init(dbRepository); + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs" new file mode 100644 index 0000000..b291b72 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/ToMES/dt_info_to_mesService.cs" @@ -0,0 +1,27 @@ +/* + *Author锛歫xx + *Contact锛�283591387@qq.com + *浠g爜鐢辨鏋剁敓鎴�,姝ゅ浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *鎵�鏈変笟鍔$紪鍐欏叏閮ㄥ簲鍦≒artial鏂囦欢澶逛笅dt_info_to_mesService涓嶪dt_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>(); } } + } + } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs" index 64201bf..9ec980a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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); - 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); - } + 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); 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,78 +247,72 @@ } 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) + foreach (var inventory in inventorys) + { + var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); + station.quantity = station.quantity - 1; + if (station.quantity < 1) { - var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); - station.quantity = station.quantity - 1; - if (station.quantity == 0) - { - station.stationType = string.Empty; - station.heatNumber = string.Empty; - station.Number = string.Empty; - station.billetID = string.Empty; - station.bindSN = string.Empty; - station.enable = false; - station.tray_status = string.Empty; - station.location_state = LocationStateEnum.Empty.ToString(); - } - else - { - var bindSNS = station.bindSN.Split(","); - station.bindSN = ToMesServer.OperStr(bindSNS, inventory.SN); - var billetS = station.billetID.Split(","); - station.billetID = ToMesServer.OperStr(billetS, inventory.BilletNumber.ToString()); - } - - #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣� - var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault(); - if (currentEntry != null) currentEntry.State = EntityState.Detached; - #endregion - - stationinfoRepository.Update(station, true); - _repository.Delete(inventory, true); + station.quantity = 0; + station.stationType = string.Empty; + station.heatNumber = string.Empty; + station.Number = string.Empty; + station.billetID = string.Empty; + station.bindSN = string.Empty; + station.enable = false; + station.tray_status = string.Empty; + station.location_state = LocationStateEnum.Empty.ToString(); } - WriteDBLog.Write($"鎵嬪姩鍒犻櫎搴撳瓨 ", $"璐т綅缂栧彿锛歿inventorys.Key}锛汼N鍙凤細{str}", LogState.Sucess, "WMS", UserContext.Current.UserName); + else + { + var bindSNS = station.bindSN.Split(","); + station.bindSN = ToMesServer.OperStr(bindSNS, inventory.SN); + var billetS = station.billetID.Split(","); + station.billetID = ToMesServer.OperStr(billetS, inventory.BilletNumber.ToString()); + } + + #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣� + var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault(); + if (currentEntry != null) currentEntry.State = EntityState.Detached; + #endregion + + stationinfoRepository.Update(station, true); + _repository.Delete(inventory, true); } - else - { - WriteWMSLog.LogAdd("", "澶辫触", "MES", "WMS", postJson, mesData, "浜哄伐鍚屾MES杞﹁疆鍑哄簱", "agvOutWarehouse", requestMes.message); - throw new Exception("浜哄伐鍚屾MES杞﹁疆鍑哄簱澶辫触锛�" + requestMes.message); - } + WriteDBLog.Write($"浜哄伐鍑哄簱鎴愬姛 ", $"璐т綅缂栧彿锛歿inventorys.Key}锛汼N鍙凤細{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; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs" index 5ac0d19..acc2855 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToAGV/ToAGVServer.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" index 332d8f8..aa074ec 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" @@ -63,62 +63,60 @@ } 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) + foreach (var inventory in inventorys) + { + var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); + station.quantity = station.quantity - 1; + if (station.quantity < 1) { - var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); - station.quantity = station.quantity - 1; - if (station.quantity == 0) - { - station.stationType = string.Empty; - station.heatNumber = string.Empty; - station.Number = string.Empty; - station.billetID = string.Empty; - station.bindSN = string.Empty; - station.enable = false; - station.tray_status = string.Empty; - station.location_state = LocationStateEnum.Empty.ToString(); - } - else - { - var bindSNS = station.bindSN.Split(","); - station.bindSN = OperStr(bindSNS, inventory.SN); - var billetS = station.billetID.Split(","); - station.billetID = OperStr(billetS, inventory.BilletNumber.ToString()); - } - - #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣� - var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault(); - if (currentEntry != null) currentEntry.State = EntityState.Detached; - #endregion - - stationinfoRepository.Update(station, true); - inventoryRepository.Delete(inventory, true); + station.quantity = 0; + station.stationType = string.Empty; + station.heatNumber = string.Empty; + station.Number = string.Empty; + station.billetID = string.Empty; + station.bindSN = string.Empty; + station.enable = false; + station.tray_status = string.Empty; + station.location_state = LocationStateEnum.Empty.ToString(); } - WriteDBLog.Write($"浜哄伐鍑哄簱鎴愬姛 ", $"璐т綅缂栧彿锛歿inventorys.Key}锛汼N鍙凤細{str}", LogState.Sucess, "PDA", user); + else + { + var bindSNS = station.bindSN.Split(","); + station.bindSN = OperStr(bindSNS, inventory.SN); + var billetS = station.billetID.Split(","); + station.billetID = OperStr(billetS, inventory.BilletNumber.ToString()); + } + + #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣� + var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault(); + if (currentEntry != null) currentEntry.State = EntityState.Detached; + #endregion + + stationinfoRepository.Update(station, true); + inventoryRepository.Delete(inventory, true); } - else - { - WriteWMSLog.LogAdd("", "澶辫触", "MES", "PDA", postJson, mesData, "浜哄伐鍚屾MES杞﹁疆鍑哄簱", "agvOutWarehouse", requestMes.message); - throw new Exception("浜哄伐鍑哄簱鍚屾MES杞﹁疆鍑哄簱澶辫触锛�" + requestMes.message); - } + WriteDBLog.Write($"浜哄伐鍑哄簱鎴愬姛 ", $"璐т綅缂栧彿锛歿inventorys.Key}锛汼N鍙凤細{str}", LogState.Sucess, "PDA", user); + } catch (Exception ex) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" index 48d3bd6..21f3cb6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" @@ -9,6 +9,7 @@ public void QueueTaskTiem() { QueueTask.ReplaceTrayTask(); + ToMes.InfoToMes(); } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_info_to_mesController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_info_to_mesController.cs" new file mode 100644 index 0000000..ae76234 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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;//璁块棶涓氬姟浠g爜 + private readonly IHttpContextAccessor _httpContextAccessor; + + [ActivatorUtilitiesConstructor] + public dt_info_to_mesController( + Idt_info_to_mesService service, + IHttpContextAccessor httpContextAccessor + ) + : base(service) + { + _service = service; + _httpContextAccessor = httpContextAccessor; + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs" new file mode 100644 index 0000000..4b795d5 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/dt_info_to_mesController.cs" @@ -0,0 +1,21 @@ +/* + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *濡傛灉瑕佸鍔犳柟娉曡鍦ㄥ綋鍓嶇洰褰曚笅Partial鏂囦欢澶筪t_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) + { + } + } +} + -- Gitblit v1.9.3