From 56538e602b927c232ac5b991ef84175edd2ce3ce Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期五, 24 四月 2026 14:20:20 +0800
Subject: [PATCH] feat(WMS/WCS): 增加机器人历史信息记录 fix(WMS/WCS): 修复前端bug
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs | 19
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTask_HtyService.cs | 14
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotTaskInfoRepository.cs | 18
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs | 18
Code/WCS/WIDESEAWCS_Client/src/extension/taskinfo/robotTaskHty.jsx | 69 +
Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTaskHty.vue | 290 ++++
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTask_HtyService.cs | 29
Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue | 24
Code/WCS/WIDESEAWCS_Client/src/api/http.js | 2
Code/WMS/WIDESEA_WMSClient/src/views/stock/stockInfo.vue | 31
Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotState.vue | 153 +
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs | 4
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs | 10
Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/UtilConvert.cs | 1980 ++++++++++++++--------------
Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTask.vue | 2
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_RobotTask_Hty.cs | 42
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTask_HtyController.cs | 24
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 5
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs | 2
Code/WCS/WIDESEAWCS_Client/src/router/viewGird.js | 127 +
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/UtilConvert.cs | 1125 ++++++++--------
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs | 1
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoRepository/IRobotTask_HtyRepository.cs | 15
23 files changed, 2,286 insertions(+), 1,718 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Client/src/api/http.js b/Code/WCS/WIDESEAWCS_Client/src/api/http.js
index 57f0d9f..0d7cc1f 100644
--- a/Code/WCS/WIDESEAWCS_Client/src/api/http.js
+++ b/Code/WCS/WIDESEAWCS_Client/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
- axios.defaults.baseURL = window.webConfig.webApiProduction;
+ axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
}
else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
diff --git a/Code/WCS/WIDESEAWCS_Client/src/extension/taskinfo/robotTaskHty.jsx b/Code/WCS/WIDESEAWCS_Client/src/extension/taskinfo/robotTaskHty.jsx
new file mode 100644
index 0000000..6bfb2c4
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Client/src/extension/taskinfo/robotTaskHty.jsx
@@ -0,0 +1,69 @@
+// 璇ユ墿灞曟枃浠剁敤浜庝换鍔″巻鍙查〉闈㈢殑涓氬姟鎵╁睍銆�
+// 鏂规硶鐩殑锛氱粺涓�棰勭暀鍒楄〃鏌ヨ銆佷繚瀛樺墠鍚庡拰寮圭獥鎵撳紑鏃剁殑鎵╁睍鍏ュ彛锛屼繚鎸佷笌椤圭洰鍐� task 椤甸潰涓�鑷寸殑鎵╁睍鐐广��
+// 鍙傛暟鍚箟锛氱敱妗嗘灦鎸夌敓鍛藉懆鏈熶紶鍏ワ紝鍖呭惈鏌ヨ鍙傛暟銆佽〃鍗曟暟鎹�佽鏁版嵁绛変笂涓嬫枃銆�
+// 杩斿洖鍊艰鏄庯細杩斿洖 true 浠h〃缁х画榛樿琛屼负锛岃繑鍥� false 浠h〃涓柇榛樿琛屼负銆�
+// 寮傚父澶勭悊璇存槑锛氬綋鍓嶆湭寮曞叆澶栭儴璋冪敤锛涜嫢鍚庣画鏂板鎺ュ彛璋冪敤锛岄渶鍦ㄦ柟娉曞唴琛ュ厖 try-catch 骞惰褰曞叧閿笟鍔″弬鏁般��
+
+let extension = {
+ components: {
+ gridHeader: "",
+ gridBody: "",
+ gridFooter: "",
+ modelHeader: "",
+ modelBody: "",
+ modelFooter: "",
+ },
+ tableAction: "",
+ buttons: { view: [], box: [], detail: [] },
+ methods: {
+ // 鏂规硶鐩殑锛氶〉闈㈠垵濮嬪寲鏃舵墽琛岃嚜瀹氫箟閫昏緫銆�
+ // 鍙傛暟锛氭棤銆�
+ // 杩斿洖鍊硷細鏃犮��
+ onInit() {},
+
+ // 鏂规硶鐩殑锛氶〉闈㈠垵濮嬪寲瀹屾垚鍚庢墽琛岃嚜瀹氫箟閫昏緫銆�
+ // 鍙傛暟锛氭棤銆�
+ // 杩斿洖鍊硷細鏃犮��
+ onInited() {},
+
+ // 鏂规硶鐩殑锛氭煡璇㈠墠澶勭悊鏌ヨ鏉′欢銆�
+ // 鍙傛暟锛歱aram 鏌ヨ鍙傛暟瀵硅薄銆�
+ // 杩斿洖鍊硷細true 缁х画鏌ヨ锛宖alse 缁堟鏌ヨ銆�
+ searchBefore(param) {
+ return true;
+ },
+
+ // 鏂规硶鐩殑锛氭煡璇㈠悗澶勭悊杩斿洖缁撴灉銆�
+ // 鍙傛暟锛歳esult 鍚庣杩斿洖鏁版嵁銆�
+ // 杩斿洖鍊硷細true 缁х画娓叉煋锛宖alse 缁堟鍚庣画澶勭悊銆�
+ searchAfter(result) {
+ return true;
+ },
+
+ // 鏂规硶鐩殑锛氭柊澧炲墠鏍¢獙鎴栬ˉ鍏呮彁浜ゅ瓧娈点��
+ // 鍙傛暟锛歠ormData 琛ㄥ崟鎻愪氦瀵硅薄銆�
+ // 杩斿洖鍊硷細true 缁х画鎻愪氦锛宖alse 缁堟鎻愪氦銆�
+ addBefore(formData) {
+ return true;
+ },
+
+ // 鏂规硶鐩殑锛氱紪杈戝墠鏍¢獙鎴栬ˉ鍏呮彁浜ゅ瓧娈点��
+ // 鍙傛暟锛歠ormData 琛ㄥ崟鎻愪氦瀵硅薄銆�
+ // 杩斿洖鍊硷細true 缁х画鎻愪氦锛宖alse 缁堟鎻愪氦銆�
+ updateBefore(formData) {
+ return true;
+ },
+
+ // 鏂规硶鐩殑锛氱偣鍑昏鏃舵墿灞曞鐞嗐��
+ // 鍙傛暟锛歳ow 琛屾暟鎹紝column 鍒楅厤缃紝event 鍘熷浜嬩欢銆�
+ // 杩斿洖鍊硷細鏃犮��
+ rowClick({ row, column, event }) {},
+
+ // 鏂规硶鐩殑锛氱紪杈戝脊绐楁墦寮�鍚庢墽琛屾墿灞曢�昏緫銆�
+ // 鍙傛暟锛歳ow 褰撳墠琛屾暟鎹��
+ // 杩斿洖鍊硷細鏃犮��
+ modelOpenAfter(row) {},
+ },
+};
+
+export default extension;
diff --git a/Code/WCS/WIDESEAWCS_Client/src/router/viewGird.js b/Code/WCS/WIDESEAWCS_Client/src/router/viewGird.js
index b8b1b7a..c4df3f2 100644
--- a/Code/WCS/WIDESEAWCS_Client/src/router/viewGird.js
+++ b/Code/WCS/WIDESEAWCS_Client/src/router/viewGird.js
@@ -1,97 +1,104 @@
let viewgird = [
{
- path: '/Sys_Log',
- name: 'sys_Log',
- component: () => import('@/views/system/Sys_Log.vue')
+ path: "/Sys_Log",
+ name: "sys_Log",
+ component: () => import("@/views/system/Sys_Log.vue"),
},
{
- path: '/Sys_User',
- name: 'Sys_User',
- component: () => import('@/views/system/Sys_User.vue')
+ path: "/Sys_User",
+ name: "Sys_User",
+ component: () => import("@/views/system/Sys_User.vue"),
},
{
- path: '/permission',
- name: 'permission',
- component: () => import('@/views/system/Permission.vue')
+ path: "/permission",
+ name: "permission",
+ component: () => import("@/views/system/Permission.vue"),
},
{
- path: '/Sys_Dictionary',
- name: 'Sys_Dictionary',
- component: () => import('@/views/system/Sys_Dictionary.vue')
+ path: "/Sys_Dictionary",
+ name: "Sys_Dictionary",
+ component: () => import("@/views/system/Sys_Dictionary.vue"),
},
{
- path: '/Sys_Role',
- name: 'Sys_Role',
- component: () => import('@/views/system/Sys_Role.vue')
+ path: "/Sys_Role",
+ name: "Sys_Role",
+ component: () => import("@/views/system/Sys_Role.vue"),
},
{
- path: '/Sys_Role1',
- name: 'Sys_Role1',
- component: () => import('@/views/system/Sys_Role1.vue')
+ path: "/Sys_Role1",
+ name: "Sys_Role1",
+ component: () => import("@/views/system/Sys_Role1.vue"),
},
{
- path: '/Sys_DictionaryList',
- name: 'Sys_DictionaryList',
- component: () => import('@/views/system/Sys_DictionaryList.vue')
+ path: "/Sys_DictionaryList",
+ name: "Sys_DictionaryList",
+ component: () => import("@/views/system/Sys_DictionaryList.vue"),
},
{
- path: '/Sys_Tenant',
- name: 'Sys_Tenant',
- component: () => import('@/views/system/Sys_Tenant.vue')
+ path: "/Sys_Tenant",
+ name: "Sys_Tenant",
+ component: () => import("@/views/system/Sys_Tenant.vue"),
},
{
- path: '/deviceInfo',
- name: 'deviceInfo',
- component: () => import('@/views/quartzJob/deviceInfo.vue')
+ path: "/deviceInfo",
+ name: "deviceInfo",
+ component: () => import("@/views/quartzJob/deviceInfo.vue"),
},
{
- path: '/deviceProtocol',
- name: 'deviceProtocol',
- component: () => import('@/views/quartzJob/deviceProtocol.vue')
+ path: "/deviceProtocol",
+ name: "deviceProtocol",
+ component: () => import("@/views/quartzJob/deviceProtocol.vue"),
},
{
- path: '/deviceProtocolDetail',
- name: 'deviceProtocolDetail',
- component: () => import('@/views/quartzJob/deviceProtocolDetail.vue')
+ path: "/deviceProtocolDetail",
+ name: "deviceProtocolDetail",
+ component: () => import("@/views/quartzJob/deviceProtocolDetail.vue"),
},
{
- path: '/dispatchInfo',
- name: 'dispatchInfo',
- component: () => import('@/views/quartzJob/dispatchInfo.vue')
+ path: "/dispatchInfo",
+ name: "dispatchInfo",
+ component: () => import("@/views/quartzJob/dispatchInfo.vue"),
},
{
- path: '/scheduler',
- name: 'scheduler',
- component: () => import('@/views/quartzJob/scheduler.vue')
- },{
- path: '/robotTask',
- name: 'robotTask',
- component: () => import('@/views/taskinfo/robotTask.vue')
+ path: "/scheduler",
+ name: "scheduler",
+ component: () => import("@/views/quartzJob/scheduler.vue"),
},
{
- path: '/robotState',
- name: 'robotState',
- component: () => import('@/views/taskinfo/robotState.vue')
+ path: "/robotTask",
+ name: "robotTask",
+ component: () => import("@/views/taskinfo/robotTask.vue"),
},
{
- path: '/task',
- name: 'task',
- component: () => import('@/views/taskinfo/task.vue')
- },{
- path: '/agvTask',
- name: 'agvTask',
- component: () => import('@/views/taskinfo/agvTask.vue')
+ path: "/robotTaskHty",
+ name: "robotTaskHty",
+ component: () => import("@/views/taskinfo/robotTaskHty.vue"),
},
{
- path: '/taskHty',
- name: 'taskHty',
- component: () => import('@/views/taskinfo/taskHty.vue')
+ path: "/robotState",
+ name: "robotState",
+ component: () => import("@/views/taskinfo/robotState.vue"),
},
{
- path: '/router',
- name: 'router',
- component: () => import('@/views/basicinfo/router.vue')
- }
+ path: "/task",
+ name: "task",
+ component: () => import("@/views/taskinfo/task.vue"),
+ },
+ {
+ path: "/agvTask",
+ name: "agvTask",
+ component: () => import("@/views/taskinfo/agvTask.vue"),
+ },
+ {
+ path: "/taskHty",
+ name: "taskHty",
+ component: () => import("@/views/taskinfo/taskHty.vue"),
+ },
+ {
+ path: "/router",
+ name: "router",
+ component: () => import("@/views/basicinfo/router.vue"),
+ },
];
export default viewgird;
diff --git a/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotState.vue b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotState.vue
index cb5c486..c76c871 100644
--- a/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotState.vue
+++ b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotState.vue
@@ -12,41 +12,42 @@
export default defineComponent({
setup() {
const table = ref({
- key: "Id",
+ key: "id",
footer: "Foots",
cnName: "鏈烘鎵嬬姸鎬佺鐞�",
name: "robotState",
- url: "/robotState/",
- sortName: "IPAddress",
+ url: "/RobotState/",
+ sortName: "CreateDate",
});
// 缂栬緫琛ㄥ崟瀛楁
const editFormFields = ref({
- IPAddress: "",
- Version: "",
- IsEventSubscribed: false,
- RobotRunMode: "",
- RobotControlMode: "",
- RobotArmObject: "",
- Homed: "",
- CurrentAction: "",
- OperStatus: "",
- RobotTaskTotalNum: 0,
- IsSplitPallet: false,
- IsGroupPallet: false,
- IsInFakeBatteryMode: false,
- CurrentBatchIndex: 1,
- ChangePalletPhase: 0,
- IsScanNG: false,
- BatteryArrived: false,
+ id: "",
+ ipAddress: "",
+ version: "",
+ isEventSubscribed: false,
+ robotRunMode: "",
+ robotControlMode: "",
+ robotArmObject: "",
+ homed: "",
+ currentAction: "",
+ operStatus: "",
+ robotTaskTotalNum: 0,
+ isSplitPallet: false,
+ isGroupPallet: false,
+ isInFakeBatteryMode: false,
+ currentBatchIndex: 1,
+ changePalletPhase: 0,
+ isScanNG: false,
+ batteryArrived: false,
});
// 缂栬緫琛ㄥ崟閰嶇疆
const editFormOptions = ref([
- [
- { title: "IP鍦板潃", field: "ipAddress", type: "string", readonly: true },
- { title: "鐗堟湰鍙�", field: "version", type: "int", readonly: true },
- ],
+ // [
+ // { title: "IP鍦板潃", field: "ipAddress", type: "string", readonly: true },
+ // { title: "鐗堟湰鍙�", field: "version", type: "int", readonly: true },
+ // ],
[
{
title: "杩愯妯″紡",
@@ -57,29 +58,46 @@
{ key: 2, value: "鑷姩妯″紡" },
],
},
+ // {
+ // title: "鎺у埗妯″紡",
+ // field: "robotControlMode",
+ // type: "select",
+ // data: [
+ // { key: 1, value: "瀹㈡埛绔帶鍒�" },
+ // { key: 2, value: "鍏朵粬" },
+ // ],
+ // },
+ // {
+ // title: "鎵嬭噦鐘舵��",
+ // field: "robotArmObject",
+ // type: "select",
+ // data: [
+ // { key: 0, value: "绌洪棽" },
+ // { key: 1, value: "鏈夌墿鏂�" },
+ // ],
+ // },
{
- title: "鎺у埗妯″紡",
- field: "robotControlMode",
- type: "select",
+ title: "鍥為浂鐘舵��", field: "homed", type: "select",
data: [
- { key: 1, value: "瀹㈡埛绔帶鍒�" },
- { key: 2, value: "鍏朵粬" },
- ],
+ { key: "Homed", value: "宸茬粡鍥為浂" },
+ { key: "Homing", value: "姝e湪鍥為浂" },
+ ]
},
{
- title: "鎵嬭噦鐘舵��",
- field: "robotArmObject",
- type: "select",
+ title: "褰撳墠鍔ㄤ綔", field: "currentAction", type: "select",
data: [
- { key: 0, value: "绌洪棽" },
- { key: 1, value: "鏈夌墿鏂�" },
- ],
+ { key: "Picking", value: "姝e湪鍙栬揣" },
+ { key: "Putting", value: "姝e湪鏀捐揣" },
+ { key: "AllPickFinished", value: "鍏ㄩ儴鍙栬揣瀹屾垚" },
+ { key: "AllPutFinished", value: "鍏ㄩ儴鏀捐揣瀹屾垚" },
+ { key: "PickFinished", value: "鍙栬揣瀹屾垚" },
+ { key: "PutFinished", value: "鏀捐揣瀹屾垚" },
+ ]
},
- ],
- [
- { title: "鍥為浂鐘舵��", field: "homed", type: "string" },
- { title: "褰撳墠鍔ㄤ綔", field: "currentAction", type: "string" },
- { title: "杩愯鐘舵��", field: "operStatus", type: "string" },
+ // ],
+ // [
+
+ // { title: "杩愯鐘舵��", field: "operStatus", type: "string" },
],
[
{ title: "浠诲姟鎬绘暟", field: "robotTaskTotalNum", type: "int" },
@@ -124,51 +142,62 @@
dataKey: "isTrue",
data: [],
},
- {
- title: "娑堟伅宸茶闃�",
- field: "isEventSubscribed",
- type: "select",
- dataKey: "isTrue",
- data: [],
- },
+ // {
+ // title: "娑堟伅宸茶闃�",
+ // field: "isEventSubscribed",
+ // type: "select",
+ // dataKey: "isTrue",
+ // data: [],
+ // },
],
]);
// 鎼滅储琛ㄥ崟瀛楁
const searchFormFields = ref({
- IPAddress: "",
- CurrentAction: "",
- OperStatus: "",
+ ipAddress: "",
+ currentAction: "",
+ operStatus: "",
});
// 鎼滅储琛ㄥ崟閰嶇疆
const searchFormOptions = ref([
[
- { title: "IP鍦板潃", field: "ipAddress", type: "string" },
+ { title: "IP鍦板潃", field: "ipAddress", type: "like" },
{ title: "褰撳墠鍔ㄤ綔", field: "currentAction", type: "string" },
- { title: "杩愯鐘舵��", field: "operStatus", type: "string" },
+ {
+ title: "杩愯鐘舵��", field: "operStatus", type: "select",
+ data: [
+ { key: "Picking", value: "姝e湪鍙栬揣" },
+ { key: "Putting", value: "姝e湪鏀捐揣" },
+ { key: "AllPickFinished", value: "鍏ㄩ儴鍙栬揣瀹屾垚" },
+ { key: "AllPutFinished", value: "鍏ㄩ儴鏀捐揣瀹屾垚" },
+ { key: "PickFinished", value: "鍙栬揣瀹屾垚" },
+ { key: "PutFinished", value: "鏀捐揣瀹屾垚" },
+ ]
+ },
],
]);
// 鍒楀畾涔�
const columns = ref([
- { field: "ipAddress", title: "IP鍦板潃", type: "string", width: 140, align: "left" },
+ { field: "id", title: "Id", type: "int", width: 90, hidden: true, readonly: true, require: true, align: "left" },
+ { field: "ipAddress", title: "IP鍦板潃", type: "string", width: 160, align: "left" },
{ field: "version", title: "鐗堟湰", type: "int", width: 80, align: "left" },
{ field: "robotRunMode", title: "杩愯妯″紡", type: "int", width: 100, bind: { key: "robotRunMode", data: [{ key: 1, value: "鎵嬪姩妯″紡" }, { key: 2, value: "鑷姩妯″紡" }] }, align: "center" },
- { field: "robotControlMode", title: "鎺у埗妯″紡", type: "int", width: 100, bind: { key: "robotControlMode", data: [{ key: 1, value: "瀹㈡埛绔帶鍒�" }, { key: 2, value: "鍏朵粬" }] }, align: "center" },
- { field: "robotArmObject", title: "鎵嬭噦鐘舵��", type: "int", width: 90, bind: { key: "robotArmObject", data: [{ key: 0, value: "绌洪棽" }, { key: 1, value: "鏈夌墿鏂�" }] }, align: "center" },
+ // { field: "robotControlMode", title: "鎺у埗妯″紡", type: "int", width: 100, bind: { key: "robotControlMode", data: [{ key: 1, value: "瀹㈡埛绔帶鍒�" }, { key: 2, value: "鍏朵粬" }] }, align: "center" },
+ // { field: "robotArmObject", title: "鎵嬭噦鐘舵��", type: "int", width: 90, bind: { key: "robotArmObject", data: [{ key: 0, value: "绌洪棽" }, { key: 1, value: "鏈夌墿鏂�" }] }, align: "center" },
{ field: "homed", title: "鍥為浂鐘舵��", type: "string", width: 100, align: "center", bind: { key: "homed", data: [{ key: "Homed", value: "鍥為浂" }, { key: "Homing", value: "鍥為浂涓�" }] }, },
{ field: "currentAction", title: "褰撳墠鍔ㄤ綔", type: "string", width: 100, align: "center", bind: { key: "currentAction", data: [{ key: "Picking", value: "姝e湪鍙栬揣" }, { key: "Putting", value: "姝e湪鏀捐揣" }, { key: "AllPickFinished", value: "鍏ㄩ儴鍙栬揣瀹屾垚" }, { key: "AllPutFinished", value: "鍏ㄩ儴鏀捐揣瀹屾垚" }, { key: "PickFinished", value: "鍙栬揣瀹屾垚" }, { key: "PutFinished", value: "鏀捐揣瀹屾垚" }] }, },
- { field: "operStatus", title: "杩愯鐘舵��", type: "string", width: 100, align: "center", hidden: true },
+ // { field: "operStatus", title: "杩愯鐘舵��", type: "string", width: 100, align: "center", hidden: true },
{ field: "robotTaskTotalNum", title: "浠诲姟鎬绘暟", type: "int", width: 90, align: "center" },
{ field: "isSplitPallet", title: "鎷嗙洏", type: "byte", width: 60, align: "center", bind: { key: "isTrue", data: [] }, },
- { field: "isGroupPallet", title: "缁勭洏", type: "byte", width: 60, align: "center" , bind: { key: "isTrue", data: [] }, },
- { field: "isInFakeBatteryMode", title: "鍋囩數鑺�", type: "byte", width: 70, align: "center" , bind: { key: "isTrue", data: [] }, },
+ { field: "isGroupPallet", title: "缁勭洏", type: "byte", width: 60, align: "center", bind: { key: "isTrue", data: [] }, },
+ { field: "isInFakeBatteryMode", title: "鍋囩數鑺�", type: "byte", width: 70, align: "center", bind: { key: "isTrue", data: [] }, },
{ field: "currentBatchIndex", title: "鎵规", type: "int", width: 60, align: "center" },
{ field: "changePalletPhase", title: "鎹㈢洏闃舵", type: "int", width: 80, align: "center" },
- { field: "isScanNG", title: "鎵爜NG", type: "byte", width: 80, align: "center" , bind: { key: "isTrue", data: [] }, },
- { field: "batteryArrived", title: "鐢佃姱鍒颁綅", type: "byte", width: 80, align: "center" , bind: { key: "isTrue", data: [] }, },
- { field: "isEventSubscribed", title: "宸茶闃�", type: "byte", width: 70, align: "center", bind: { key: "isTrue", data: [] }, },
+ { field: "isScanNG", title: "鎵爜NG", type: "byte", width: 80, align: "center", bind: { key: "isTrue", data: [] }, },
+ { field: "batteryArrived", title: "鐢佃姱鍒颁綅", type: "byte", width: 80, align: "center", bind: { key: "isTrue", data: [] }, },
+ // { field: "isEventSubscribed", title: "宸茶闃�", type: "byte", width: 70, align: "center", bind: { key: "isTrue", data: [] }, },
]);
const detail = ref({
diff --git a/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTask.vue b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTask.vue
index ac42c4e..8b6fec7 100644
--- a/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTask.vue
+++ b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTask.vue
@@ -154,7 +154,7 @@
field: "robotRoadway",
title: "宸烽亾",
type: "string",
- width: 100,
+ width: 120,
align: "left",
},
{
diff --git a/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTaskHty.vue b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTaskHty.vue
new file mode 100644
index 0000000..9978e91
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/robotTaskHty.vue
@@ -0,0 +1,290 @@
+<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/taskinfo/robotTaskHty.jsx";
+import { ref, defineComponent } from "vue";
+
+export default defineComponent({
+ setup() {
+ const table = ref({
+ key: "robotTaskId", // 涓婚敭瀛楁鍚�
+ footer: "Foots",
+ cnName: "鏈哄櫒浜哄巻鍙蹭换鍔�", // 涓枃鍚嶇О
+ name: "robotTaskHty", // 琛ㄥ悕
+ url: "/RobotTask_Hty/", // API璺緞
+ sortName: "insertTime", // 榛樿鎺掑簭瀛楁锛堟寜绉诲叆鏃堕棿鎺掑簭锛�
+ });
+
+ // 缂栬緫琛ㄥ崟瀛楁锛堝巻鍙茶〃閫氬父鍙锛屼絾淇濈暀缁撴瀯锛�
+ const editFormFields = ref({});
+
+ // 缂栬緫琛ㄥ崟閰嶇疆锛堝巻鍙茶〃閫氬父鍙锛�
+ const editFormOptions = ref([]);
+
+ // 鎼滅储琛ㄥ崟瀛楁
+ const searchFormFields = ref({
+ robotTaskNum: "",
+ robotRoadway: "",
+ robotTaskType: "",
+ robotTaskState: "",
+ robotSourceAddress: "",
+ robotTargetAddress: "",
+ operateType: "",
+ insertTime: "",
+ creater: "",
+ createDate: "",
+ });
+
+ // 鎼滅储琛ㄥ崟閰嶇疆锛堜笁琛屽竷灞�锛�
+ const searchFormOptions = ref([
+ [
+ { title: "浠诲姟缂栧彿", field: "robotTaskNum", type: "int" },
+ { title: "宸烽亾", field: "robotRoadway", type: "like" },
+ {
+ title: "浠诲姟绫诲瀷",
+ field: "robotTaskType",
+ type: "selectList",
+ dataKey: "taskType",
+ data: [],
+ },
+ {
+ title: "浠诲姟鐘舵��",
+ field: "robotTaskState",
+ type: "selectList",
+ dataKey: "taskState",
+ data: [],
+ },
+ ],
+ [
+ { title: "鏉ユ簮鍦板潃", field: "robotSourceAddress", type: "like" },
+ { title: "鐩爣鍦板潃", field: "robotTargetAddress", type: "like" },
+ { title: "鎿嶄綔绫诲瀷", field: "operateType", type: "like" },
+ { title: "绉诲叆鍘嗗彶鏃堕棿", field: "insertTime", type: "datetime" },
+ ],
+ [
+ { title: "鏉ユ簮绾夸唬鐮�", field: "robotSourceAddressLineCode", type: "like" },
+ { title: "鐩爣绾夸唬鐮�", field: "robotTargetAddressLineCode", type: "like" },
+ { title: "鍒涘缓浜�", field: "creater", type: "like" },
+ { title: "鍒涘缓鏃堕棿", field: "createDate", type: "datetime" },
+ ],
+ ]);
+
+ // 鍒楅厤缃�
+ const columns = ref([
+ {
+ field: "robotTaskId",
+ title: "鍘嗗彶ID",
+ type: "int",
+ width: 90,
+ hidden: true, // 闅愯棌鍘嗗彶琛ㄤ富閿�
+ readonly: true,
+ require: true,
+ align: "left",
+ },
+ {
+ field: "sourceId",
+ title: "浠诲姟鍙�",
+ type: "int",
+ width: 100,
+ align: "left",
+ },
+ {
+ field: "robotTaskNum",
+ title: "浠诲姟缂栧彿",
+ type: "int",
+ width: 100,
+ align: "left",
+ sortable: true,
+ },
+ {
+ field: "robotRoadway",
+ title: "宸烽亾",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
+ field: "robotTaskType",
+ title: "浠诲姟绫诲瀷",
+ type: "int",
+ width: 100,
+ align: "left",
+ bind: { key: "taskType", data: [] },
+ },
+ {
+ field: "robotTaskState",
+ title: "浠诲姟鐘舵��",
+ type: "int",
+ width: 120,
+ align: "left",
+ bind: { key: "taskState", data: [] },
+ },
+ {
+ field: "robotTaskTotalNum",
+ title: "浠诲姟鎬绘暟",
+ type: "int",
+ width: 90,
+ align: "left",
+ },
+ {
+ field: "robotSourceAddress",
+ title: "鏉ユ簮鍦板潃",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
+ field: "robotTargetAddress",
+ title: "鐩爣鍦板潃",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
+ field: "robotSourceAddressLineCode",
+ title: "鏉ユ簮绾夸綋鍦板潃",
+ type: "string",
+ width: 130,
+ align: "left",
+ },
+ {
+ field: "robotTargetAddressLineCode",
+ title: "鐩爣绾夸綋鍦板潃",
+ type: "string",
+ width: 130,
+ align: "left",
+ },
+ {
+ field: "robotSourceAddressPalletCode",
+ title: "鏉ユ簮鎵樼洏",
+ type: "string",
+ width: 130,
+ align: "left",
+ },
+ {
+ field: "robotTargetAddressPalletCode",
+ title: "鐩爣鎵樼洏",
+ type: "string",
+ width: 130,
+ align: "left",
+ },
+ {
+ field: "robotExceptionMessage",
+ title: "寮傚父淇℃伅",
+ type: "string",
+ width: 200,
+ align: "left",
+ overflow: "ellipsis",
+ tooltip: true, // 榧犳爣鎮仠鏄剧ず瀹屾暣鍐呭
+ },
+ {
+ field: "robotGrade",
+ title: "浼樺厛绾�",
+ type: "int",
+ width: 80,
+ align: "left",
+ bind: {
+ key: "robotGrade",
+ data: [
+ { id: 1, name: "浣�" },
+ { id: 2, name: "鏅��" },
+ { id: 3, name: "楂�" },
+ { id: 4, name: "绱ф��" },
+ ],
+ },
+ },
+ {
+ field: "operateType",
+ title: "鎿嶄綔绫诲瀷",
+ type: "string",
+ width: 120,
+ align: "left",
+ sortable: true,
+ },
+ {
+ field: "insertTime",
+ title: "绉诲叆鍘嗗彶鏃堕棿",
+ type: "datetime",
+ width: 170,
+ align: "left",
+ sortable: true,
+ },
+ {
+ field: "robotDispatchertime",
+ title: "璋冨害鏃堕棿",
+ type: "datetime",
+ width: 160,
+ align: "left",
+ },
+ {
+ field: "robotRemark",
+ title: "澶囨敞",
+ type: "string",
+ width: 150,
+ align: "left",
+ },
+ {
+ field: "creater",
+ title: "鍒涘缓浜�",
+ type: "string",
+ width: 100,
+ align: "left",
+ },
+ {
+ field: "createDate",
+ title: "鍒涘缓鏃堕棿",
+ type: "datetime",
+ width: 160,
+ align: "left",
+ },
+ {
+ field: "modifier",
+ title: "淇敼浜�",
+ type: "string",
+ width: 100,
+ align: "left",
+ },
+ {
+ field: "modifyDate",
+ title: "淇敼鏃堕棿",
+ type: "datetime",
+ width: 160,
+ align: "left",
+ },
+ ]);
+
+ // 璇︽儏寮圭獥閰嶇疆
+ const detail = ref({
+ cnName: "鏈哄櫒浜哄巻鍙蹭换鍔¤鎯�",
+ table: "robotTaskHty",
+ key: "robotTaskId",
+ sortName: "insertTime",
+ columns: columns.value.filter(col => !col.hidden), // 浣跨敤闈為殣钘忓瓧娈�
+ });
+
+ return {
+ table,
+ extend,
+ editFormFields,
+ editFormOptions,
+ searchFormFields,
+ searchFormOptions,
+ columns,
+ detail,
+ };
+ },
+});
+</script>
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/UtilConvert.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/UtilConvert.cs
index adb4432..d5b451a 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/UtilConvert.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/UtilConvert.cs
@@ -1,565 +1,562 @@
-锘縰sing Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using WIDESEAWCS_Core.Const;
-using WIDESEAWCS_Core.Enums;
-
-namespace WIDESEAWCS_Core.Helper
-{
- public static class UtilConvert
- {
- private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
-
- private static long longTime = 621355968000000000;
-
- private static int samllTime = 10000000;
-
- /// <summary>
- /// 灏嗘椂闂存埑杞崲涓烘湰鍦版棩鏈熸椂闂�
- /// </summary>
- /// <param name="timeStamp">瑕佽浆鎹㈢殑鏃堕棿鎴冲璞�</param>
- /// <returns>杞崲鍚庣殑鏈湴DateTime瀵硅薄</returns>
- /// <remarks>濡傛灉鍙傛暟涓簄ull锛屽垯杩斿洖榛樿璧峰鏃ユ湡</remarks>
- public static DateTime GetTimeSpmpToDate(this object timeStamp)
- {
- if (timeStamp == null) return dateStart;
- DateTime dateTime = new DateTime(longTime + Convert.ToInt64(timeStamp) * samllTime, DateTimeKind.Utc).ToLocalTime();
- return dateTime;
- }
-
- /// <summary>
- /// 灏嗗璞″簭鍒楀寲涓篔SON瀛楃涓�
- /// </summary>
- /// <param name="obj">瑕佸簭鍒楀寲鐨勫璞�</param>
- /// <param name="formatDate">鏃ユ湡鏍煎紡鍖栬缃紝榛樿涓�"yyyy-MM-dd HH:mm:ss"鏍煎紡</param>
- /// <returns>搴忓垪鍖栧悗鐨凧SON瀛楃涓诧紝濡傛灉瀵硅薄涓簄ull鍒欒繑鍥瀗ull</returns>
- public static string Serialize(this object obj, JsonSerializerSettings formatDate = null)
- {
- if (obj == null) return null;
- formatDate = formatDate ?? new JsonSerializerSettings
- {
- DateFormatString = "yyyy-MM-dd HH:mm:ss"
- };
- return JsonConvert.SerializeObject(obj, formatDate);
- }
-
- /// <summary>
- /// 灏咼SON瀛楃涓插弽搴忓垪鍖栦负鎸囧畾绫诲瀷鐨勫璞�
- /// </summary>
- /// <typeparam name="T">鐩爣瀵硅薄绫诲瀷</typeparam>
- /// <param name="json">瑕佸弽搴忓垪鍖栫殑JSON瀛楃涓�</param>
- /// <returns>鍙嶅簭鍒楀寲鍚庣殑瀵硅薄瀹炰緥锛屽鏋滆緭鍏ヤ负绌哄垯杩斿洖榛樿鍊�</returns>
- /// <remarks>
- /// 褰撹緭鍏ヤ负"{}"鏃朵細鑷姩杞崲涓�"[]"澶勭悊
- /// </remarks>
- public static T DeserializeObject<T>(this string json)
- {
- if (string.IsNullOrEmpty(json))
- {
- return default(T);
- }
- if (json == "{}")
- {
- json = "[]";
- }
- return JsonConvert.DeserializeObject<T>(json);
- }
-
- /// <summary>
- /// 灏嗗瓧绗︿覆鐨勯瀛楁瘝杞崲涓哄皬鍐�
- /// </summary>
- /// <param name="thisValue">瑕佸鐞嗙殑瀛楃涓�</param>
- /// <returns>棣栧瓧姣嶅皬鍐欑殑瀛楃涓诧紝鑻ヨ緭鍏ヤ负绌哄垯杩斿洖绌哄瓧绗︿覆</returns>
- public static string FirstLetterToLower(this string thisValue)
- {
- if (string.IsNullOrEmpty(thisValue)) return string.Empty;
- string result = thisValue.Substring(0, 1).ToLower() + thisValue.Substring(1, thisValue.Length - 1);
- return result;
- }
-
- /// <summary>
- /// 灏嗗瓧绗︿覆鐨勯瀛楁瘝杞崲涓哄ぇ鍐�
- /// </summary>
- /// <param name="thisValue">瑕佸鐞嗙殑瀛楃涓�</param>
- /// <returns>棣栧瓧姣嶅ぇ鍐欑殑瀛楃涓诧紝鑻ヨ緭鍏ヤ负绌哄垯杩斿洖绌哄瓧绗︿覆</returns>
- public static string FirstLetterToUpper(this string thisValue)
- {
- if (string.IsNullOrEmpty(thisValue)) return string.Empty;
- string result = thisValue.Substring(0, 1).ToUpper() + thisValue.Substring(1, thisValue.Length - 1);
- return result;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负鏁村瀷鍊�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑鏁村瀷鍊硷紝杞崲澶辫触杩斿洖0</returns>
- /// <remarks>
- /// 鏀寔澶勭悊null鍊笺�丏BNull.Value鍜屾灇涓剧被鍨�
- /// </remarks>
- public static int ObjToInt(this object thisValue)
- {
- int reval = 0;
- if (thisValue == null) return 0;
- if (thisValue is Enum && thisValue != DBNull.Value && Enum.TryParse(thisValue.GetType(), thisValue.ToString(), out var val))
- {
- return Convert.ToInt32(val.ChangeType(typeof(int)));
- }
- if (thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
- /// <summary>
- /// 灏嗗弻绮惧害娴偣鏁拌浆鎹负32浣嶆湁绗﹀彿鏁存暟
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑鍙岀簿搴︽诞鐐规暟</param>
- /// <returns>杞崲鍚庣殑32浣嶆湁绗﹀彿鏁存暟</returns>
- public static int DoubleToInt(this double thisValue)
- {
- int reval = 0;
-
- return Convert.ToInt32(thisValue);
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负鏁存暟锛岃嫢杞崲澶辫触鍒欒繑鍥炴寚瀹氱殑閿欒鍊�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑閿欒鍊�</param>
- /// <returns>杞崲鍚庣殑鏁存暟鍊兼垨鎸囧畾鐨勯敊璇��</returns>
- public static int ObjToInt(this object thisValue, int errorValue)
- {
- int reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负闀挎暣鍨�(long)
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑闀挎暣鍨嬪�硷紝杞崲澶辫触鎴栦负null鏃惰繑鍥�0</returns>
- /// <remarks>
- /// 澶勭悊DBNull.Value鎯呭喌锛屽苟灏濊瘯灏嗗璞¤浆鎹负long绫诲瀷
- /// </remarks>
- public static long ObjToLong(this object thisValue)
- {
- long reval = 0;
- if (thisValue == null) return 0;
- if (thisValue != DBNull.Value && long.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负閲戦(double绫诲瀷)銆傝嫢杞崲澶辫触鍒欒繑鍥�0銆�
- /// </summary>
- /// <param name="thisValue">寰呰浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑閲戦鍊硷紝澶辫触杩斿洖0</returns>
- public static double ObjToMoney(this object thisValue)
- {
- double reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return 0;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负閲戦(double)绫诲瀷锛岃浆鎹㈠け璐ユ椂杩斿洖鎸囧畾鐨勯敊璇��
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
- /// <returns>杞崲鎴愬姛鐨刣ouble鍊兼垨鎸囧畾鐨勯敊璇��</returns>
- public static double ObjToMoney(this object thisValue, double errorValue)
- {
- double reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负瀛楃涓诧紝鑻ュ璞′负null鍒欒繑鍥炵┖瀛楃涓�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>鍘婚櫎鍓嶅悗绌烘牸鐨勫瓧绗︿覆缁撴灉</returns>
- public static string ObjToString(this object thisValue)
- {
- if (thisValue != null) return thisValue.ToString().Trim();
- return "";
- }
-
- /// <summary>
- /// 鍒ゆ柇瀵硅薄鏄惁涓嶄负绌烘垨null鍊�
- /// </summary>
- /// <param name="thisValue">瑕佸垽鏂殑瀵硅薄</param>
- /// <returns>褰撳璞′笉涓虹┖涓斾笉绛変簬"undefined"鎴�"null"瀛楃涓叉椂杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool IsNotEmptyOrNull(this object thisValue)
- {
- return ObjToString(thisValue) != "" && ObjToString(thisValue) != "undefined" && ObjToString(thisValue) != "null";
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负瀛楃涓诧紝濡傛灉瀵硅薄涓簄ull鍒欒繑鍥炴寚瀹氱殑閿欒鍊�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="errorValue">褰撳璞′负null鏃惰繑鍥炵殑鍊�</param>
- /// <returns>瀵硅薄鐨勫瓧绗︿覆琛ㄧず鎴栨寚瀹氱殑閿欒鍊�</returns>
- public static string ObjToString(this object thisValue, string errorValue)
- {
- if (thisValue != null) return thisValue.ToString().Trim();
- return errorValue;
- }
-
- /// <summary>
- /// 鍒ゆ柇瀵硅薄鏄惁涓簄ull銆丏BNull鎴栫┖瀛楃涓�
- /// </summary>
- /// <param name="thisValue">瑕佹鏌ョ殑瀵硅薄</param>
- /// <returns>濡傛灉瀵硅薄涓簄ull銆丏BNull鎴栫┖瀛楃涓插垯杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool IsNullOrEmpty(this object thisValue) => thisValue == null || thisValue == DBNull.Value || string.IsNullOrWhiteSpace(thisValue.ToString());
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负Decimal绫诲瀷
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑Decimal鍊硷紝杞崲澶辫触杩斿洖0</returns>
- public static Decimal ObjToDecimal(this object thisValue)
- {
- Decimal reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return 0;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负Decimal绫诲瀷锛岃嫢杞崲澶辫触鍒欒繑鍥炴寚瀹氱殑榛樿鍊�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
- /// <returns>杞崲鎴愬姛鐨凞ecimal鍊兼垨鎸囧畾鐨勯粯璁ゅ��</returns>
- public static Decimal ObjToDecimal(this object thisValue, decimal errorValue)
- {
- Decimal reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负DateTime绫诲瀷
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑DateTime鍊硷紝杞崲澶辫触杩斿洖DateTime.MinValue</returns>
- public static DateTime ObjToDate(this object thisValue)
- {
- DateTime reval = DateTime.MinValue;
- if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
- {
- reval = Convert.ToDateTime(thisValue);
- }
-
- return reval;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负DateTime绫诲瀷锛岃浆鎹㈠け璐ユ椂杩斿洖鎸囧畾鐨勯粯璁ゅ��
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
- /// <returns>杞崲鎴愬姛鐨凞ateTime鍊兼垨鎸囧畾鐨勯粯璁ゅ��</returns>
- public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
- {
- DateTime reval = DateTime.MinValue;
- if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负甯冨皵鍊�
- /// </summary>
- /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <returns>杞崲鍚庣殑甯冨皵鍊硷紝杞崲澶辫触鏃惰繑鍥瀎alse</returns>
- public static bool ObjToBool(this object thisValue)
- {
- bool reval = false;
- if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
- /// <summary>
- /// 灏咲ateTime杞崲涓篣nix鏃堕棿鎴筹紙绉掔骇锛�
- /// </summary>
- /// <param name="thisValue">闇�瑕佽浆鎹㈢殑DateTime瀵硅薄</param>
- /// <returns>杩斿洖琛ㄧずUnix鏃堕棿鎴崇殑瀛楃涓�</returns>
- public static string DateToTimeStamp(this DateTime thisValue)
- {
- TimeSpan ts = thisValue - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- return Convert.ToInt64(ts.TotalSeconds).ToString();
- }
-
- /// <summary>
- /// 灏嗗璞¤浆鎹负鎸囧畾绫诲瀷
- /// </summary>
- /// <param name="value">瑕佽浆鎹㈢殑瀵硅薄</param>
- /// <param name="type">鐩爣绫诲瀷</param>
- /// <returns>杞崲鍚庣殑瀵硅薄</returns>
- /// <remarks>
- /// 鏀寔澶勭悊null鍊笺�佹灇涓剧被鍨嬨�佹硾鍨嬬被鍨嬨�丟uid銆乂ersion绛夌壒娈婄被鍨嬬殑杞崲銆�
- /// 濡傛灉杞崲澶辫触鎴栫被鍨嬩笉鍖归厤锛屽皢杩斿洖鍘熷鍊兼垨鎶涘嚭寮傚父銆�
- /// </remarks>
- public static object ChangeType(this object value, Type type)
- {
- if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
- if (value == null) return null;
- if (type == value.GetType()) return value;
- if (type.IsEnum)
- {
- if (value is string)
- return Enum.Parse(type, value as string);
- else
- return Enum.ToObject(type, value);
- }
-
- if (!type.IsInterface && type.IsGenericType)
- {
- Type innerType = type.GetGenericArguments()[0];
- object innerValue = ChangeType(value, innerType);
- return Activator.CreateInstance(type, new object[] { innerValue });
- }
-
- if (value is string && type == typeof(Guid)) return new Guid(value as string);
- if (value is string && type == typeof(Version)) return new Version(value as string);
- if (!(value is IConvertible)) return value;
- return Convert.ChangeType(value, type);
- }
-
- /// <summary>
- /// 灏嗗璞″�艰浆鎹负鎸囧畾绫诲瀷鐨勬硾鍨嬪垪琛ㄣ��
- /// </summary>
- /// <param name="value">寰呰浆鎹㈢殑瀵硅薄鍊�</param>
- /// <param name="type">鐩爣鍒楄〃鍏冪礌绫诲瀷</param>
- /// <returns>杞崲鍚庣殑娉涘瀷鍒楄〃瀵硅薄锛岃嫢杈撳叆涓簄ull鍒欒繑鍥為粯璁ゅ��</returns>
- /// <remarks>
- /// 鏀寔澶勭悊浠ユ嫭鍙峰寘瑁圭殑瀛楃涓叉牸寮忥紙濡�"(1,2,3)"鎴�"("a","b")"锛夛紝
- /// 鑷姩鍘婚櫎鍒嗛殧绗﹀苟灏嗗厓绱犺浆鎹负鐩爣绫诲瀷鍚庢坊鍔犲埌鍒楄〃銆�
- /// </remarks>
- public static object ChangeTypeList(this object value, Type type)
- {
- if (value == null) return default;
-
- var gt = typeof(List<>).MakeGenericType(type);
- dynamic lis = Activator.CreateInstance(gt);
-
- var addMethod = gt.GetMethod("Add");
- string values = value.ToString();
- if (values != null && values.StartsWith("(") && values.EndsWith(")"))
- {
- string[] splits;
- if (values.Contains("\",\""))
- {
- splits = values.Remove(values.Length - 2, 2)
- .Remove(0, 2)
- .Split("\",\"");
- }
- else
- {
- splits = values.Remove(0, 1)
- .Remove(values.Length - 2, 1)
- .Split(",");
- }
-
- foreach (var split in splits)
- {
- var str = split;
- if (split.StartsWith("\"") && split.EndsWith("\""))
- {
- str = split.Remove(0, 1)
- .Remove(split.Length - 2, 1);
- }
-
- addMethod.Invoke(lis, new object[] { ChangeType(str, type) });
- }
- }
-
- return lis;
- }
-
- /// <summary>
- /// 灏嗗璞″簭鍒楀寲涓篔SON瀛楃涓�
- /// </summary>
- /// <param name="value">瑕佸簭鍒楀寲鐨勫璞�</param>
- /// <returns>瀵硅薄鐨凧SON瀛楃涓茶〃绀�</returns>
- public static string ToJson(this object value)
- {
- return JsonConvert.SerializeObject(value);
- }
-
- /// <summary>
- /// 鍒ゆ柇瀵硅薄鏄惁鍙互杞崲涓烘暣鏁�
- /// </summary>
- /// <param name="obj">瑕佸垽鏂殑瀵硅薄</param>
- /// <returns>濡傛灉鍙互杞崲涓烘暣鏁拌繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool IsInt(this object obj)
- {
- if (obj == null)
- return false;
- bool reslut = Int32.TryParse(obj.ToString(), out int _number);
- return reslut;
-
- }
-
- /// <summary>
- /// 鍒ゆ柇瀵硅薄鏄惁涓烘湁鏁堟棩鏈熸牸寮�
- /// </summary>
- /// <param name="str">寰呮娴嬬殑瀵硅薄</param>
- /// <returns>true琛ㄧず鏄湁鏁堟棩鏈燂紝false鍒欎笉鏄�</returns>
- /// <remarks>姝ゆ柟娉曟槸鎵╁睍鏂规硶锛岄�氳繃璋冪敤IsDate(out _)瀹炵幇</remarks>
- public static bool IsDate(this object str)
- {
- return str.IsDate(out _);
- }
-
- /// <summary>
- /// 鍒ゆ柇瀵硅薄鏄惁鍙互杞崲涓烘湁鏁堢殑鏃ユ湡鏃堕棿
- /// </summary>
- /// <param name="str">瑕佸垽鏂殑瀵硅薄</param>
- /// <param name="dateTime">杈撳嚭杞崲鍚庣殑鏃ユ湡鏃堕棿鍊�</param>
- /// <returns>濡傛灉杞崲鎴愬姛杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool IsDate(this object str, out DateTime dateTime)
- {
- dateTime = DateTime.Now;
- if (str == null || str.ToString() == "")
- {
- return false;
- }
- return DateTime.TryParse(str.ToString(), out dateTime);
- }
-
- /// <summary>
- /// 鍒ゆ柇瀛楃涓叉槸鍚﹀彲浠ヨ浆鎹负鏁板瓧
- /// </summary>
- /// <param name="str">瑕佹鏌ョ殑瀛楃涓�</param>
- /// <param name="formatString">鏍煎紡瀛楃涓诧紙鏈娇鐢級</param>
- /// <returns>濡傛灉瀛楃涓插彲浠ヨ浆鎹负鏁板瓧鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
- /// <remarks>
- /// 浣跨敤姝e垯琛ㄨ揪寮忛獙璇佸瓧绗︿覆鏄惁涓烘暟瀛楁牸寮忥紝鏀寔姝h礋鍙峰拰灏忔暟鐐�
- /// </remarks>
- public static bool IsNumber(this string str, string formatString)
- {
- if (string.IsNullOrEmpty(str)) return false;
-
- return Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$");
- }
-
- /// <summary>
- /// 鍒ゆ柇瀛楃涓叉槸鍚︿负鏈夋晥鐨凣uid鏍煎紡
- /// </summary>
- /// <param name="guid">瑕侀獙璇佺殑瀛楃涓�</param>
- /// <returns>濡傛灉瀛楃涓叉槸鏈夋晥鐨凣uid鏍煎紡鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool IsGuid(this string guid)
- {
- Guid newId;
- return guid.GetGuid(out newId);
- }
-
- /// <summary>
- /// 灏嗗瓧绗︿覆杞崲涓篏uid绫诲瀷
- /// </summary>
- /// <param name="guid">瑕佽浆鎹㈢殑瀛楃涓�</param>
- /// <param name="outId">杈撳嚭杞崲鍚庣殑Guid</param>
- /// <returns>杞崲鎴愬姛杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
- public static bool GetGuid(this string guid, out Guid outId)
- {
- Guid emptyId = Guid.Empty;
- return Guid.TryParse(guid, out outId);
- }
-
- /// <summary>
- /// 灏嗗瓧绗︿覆绫诲瀷鐨勬潯浠惰浆鎹负瀵瑰簲鐨凩inq琛ㄨ揪寮忕被鍨�
- /// </summary>
- /// <param name="stringType">琛ㄧず鏉′欢鐨勫瓧绗︿覆</param>
- /// <returns>瀵瑰簲鐨凩inq琛ㄨ揪寮忕被鍨嬫灇涓惧��</returns>
- /// <remarks>
- /// 璇ユ柟娉曠敤浜庡皢鍓嶇浼犻�掔殑鏉′欢瀛楃涓叉槧灏勪负鍚庣Linq鏌ヨ浣跨敤鐨勮〃杈惧紡绫诲瀷锛�
- /// 鏀寔鍖呭惈銆佸ぇ浜庣瓑浜庛�佸皬浜庣瓑浜庛�佸ぇ浜庛�佸皬浜庛�佹ā绯婂尮閰嶇瓑甯歌鏉′欢绫诲瀷锛�
- /// 榛樿杩斿洖绛変簬(Equal)绫诲瀷
- /// </remarks>
- public static LinqExpressionType GetLinqCondition(this string stringType)
- {
- LinqExpressionType linqExpression;
- switch (stringType)
- {
- case HtmlElementType.Contains:
- case HtmlElementType.selectlist:
- case nameof(HtmlElementType.Contains):
- linqExpression = LinqExpressionType.In;
- break;
- case HtmlElementType.ThanOrEqual:
- case nameof(HtmlElementType.ThanOrEqual):
- case HtmlElementType.thanorequal:
- linqExpression = LinqExpressionType.ThanOrEqual;
- break;
- case HtmlElementType.LessOrEqual:
- case nameof(HtmlElementType.LessOrEqual):
- case HtmlElementType.lessorequal:
- linqExpression = LinqExpressionType.LessThanOrEqual;
- break;
- case HtmlElementType.GT:
- case nameof(HtmlElementType.GT):
- linqExpression = LinqExpressionType.GreaterThan;
- break;
- case HtmlElementType.lt:
- linqExpression = LinqExpressionType.LessThan;
- break;
- case HtmlElementType.like:
- linqExpression = LinqExpressionType.Contains;
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.Const;
+using WIDESEAWCS_Core.Enums;
+
+namespace WIDESEAWCS_Core.Helper
+{
+ public static class UtilConvert
+ {
+ private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
+
+ private static long longTime = 621355968000000000;
+
+ private static int samllTime = 10000000;
+
+ /// <summary>
+ /// 灏嗘椂闂存埑杞崲涓烘湰鍦版棩鏈熸椂闂�
+ /// </summary>
+ /// <param name="timeStamp">瑕佽浆鎹㈢殑鏃堕棿鎴冲璞�</param>
+ /// <returns>杞崲鍚庣殑鏈湴DateTime瀵硅薄</returns>
+ /// <remarks>濡傛灉鍙傛暟涓簄ull锛屽垯杩斿洖榛樿璧峰鏃ユ湡</remarks>
+ public static DateTime GetTimeSpmpToDate(this object timeStamp)
+ {
+ if (timeStamp == null) return dateStart;
+ DateTime dateTime = new DateTime(longTime + Convert.ToInt64(timeStamp) * samllTime, DateTimeKind.Utc).ToLocalTime();
+ return dateTime;
+ }
+
+ /// <summary>
+ /// 灏嗗璞″簭鍒楀寲涓篔SON瀛楃涓�
+ /// </summary>
+ /// <param name="obj">瑕佸簭鍒楀寲鐨勫璞�</param>
+ /// <param name="formatDate">鏃ユ湡鏍煎紡鍖栬缃紝榛樿涓�"yyyy-MM-dd HH:mm:ss"鏍煎紡</param>
+ /// <returns>搴忓垪鍖栧悗鐨凧SON瀛楃涓诧紝濡傛灉瀵硅薄涓簄ull鍒欒繑鍥瀗ull</returns>
+ public static string Serialize(this object obj, JsonSerializerSettings formatDate = null)
+ {
+ if (obj == null) return null;
+ formatDate = formatDate ?? new JsonSerializerSettings
+ {
+ DateFormatString = "yyyy-MM-dd HH:mm:ss"
+ };
+ return JsonConvert.SerializeObject(obj, formatDate);
+ }
+
+ /// <summary>
+ /// 灏咼SON瀛楃涓插弽搴忓垪鍖栦负鎸囧畾绫诲瀷鐨勫璞�
+ /// </summary>
+ /// <typeparam name="T">鐩爣瀵硅薄绫诲瀷</typeparam>
+ /// <param name="json">瑕佸弽搴忓垪鍖栫殑JSON瀛楃涓�</param>
+ /// <returns>鍙嶅簭鍒楀寲鍚庣殑瀵硅薄瀹炰緥锛屽鏋滆緭鍏ヤ负绌哄垯杩斿洖榛樿鍊�</returns>
+ /// <remarks>
+ /// 褰撹緭鍏ヤ负"{}"鏃朵細鑷姩杞崲涓�"[]"澶勭悊
+ /// </remarks>
+ public static T DeserializeObject<T>(this string json)
+ {
+ if (string.IsNullOrEmpty(json))
+ {
+ return default(T);
+ }
+ if (json == "{}")
+ {
+ json = "[]";
+ }
+ return JsonConvert.DeserializeObject<T>(json);
+ }
+
+ /// <summary>
+ /// 灏嗗瓧绗︿覆鐨勯瀛楁瘝杞崲涓哄皬鍐�
+ /// </summary>
+ /// <param name="thisValue">瑕佸鐞嗙殑瀛楃涓�</param>
+ /// <returns>棣栧瓧姣嶅皬鍐欑殑瀛楃涓诧紝鑻ヨ緭鍏ヤ负绌哄垯杩斿洖绌哄瓧绗︿覆</returns>
+ public static string FirstLetterToLower(this string thisValue)
+ {
+ if (string.IsNullOrEmpty(thisValue)) return string.Empty;
+ string result = thisValue.Substring(0, 1).ToLower() + thisValue.Substring(1, thisValue.Length - 1);
+ return result;
+ }
+
+ /// <summary>
+ /// 灏嗗瓧绗︿覆鐨勯瀛楁瘝杞崲涓哄ぇ鍐�
+ /// </summary>
+ /// <param name="thisValue">瑕佸鐞嗙殑瀛楃涓�</param>
+ /// <returns>棣栧瓧姣嶅ぇ鍐欑殑瀛楃涓诧紝鑻ヨ緭鍏ヤ负绌哄垯杩斿洖绌哄瓧绗︿覆</returns>
+ public static string FirstLetterToUpper(this string thisValue)
+ {
+ if (string.IsNullOrEmpty(thisValue)) return string.Empty;
+ string result = thisValue.Substring(0, 1).ToUpper() + thisValue.Substring(1, thisValue.Length - 1);
+ return result;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负鏁村瀷鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑鏁村瀷鍊硷紝杞崲澶辫触杩斿洖0</returns>
+ /// <remarks>
+ /// 鏀寔澶勭悊null鍊笺�丏BNull.Value鍜屾灇涓剧被鍨�
+ /// </remarks>
+ public static int ObjToInt(this object thisValue)
+ {
+ int reval = 0;
+ if (thisValue == null) return 0;
+ if (thisValue is Enum && thisValue != DBNull.Value && Enum.TryParse(thisValue.GetType(), thisValue.ToString(), out var val))
+ {
+ return Convert.ToInt32(val.ChangeType(typeof(int)));
+ }
+ if (thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ /// 灏嗗弻绮惧害娴偣鏁拌浆鎹负32浣嶆湁绗﹀彿鏁存暟
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑鍙岀簿搴︽诞鐐规暟</param>
+ /// <returns>杞崲鍚庣殑32浣嶆湁绗﹀彿鏁存暟</returns>
+ public static int DoubleToInt(this double thisValue)
+ {
+ int reval = 0;
+
+ return Convert.ToInt32(thisValue);
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负鏁存暟锛岃嫢杞崲澶辫触鍒欒繑鍥炴寚瀹氱殑閿欒鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑閿欒鍊�</param>
+ /// <returns>杞崲鍚庣殑鏁存暟鍊兼垨鎸囧畾鐨勯敊璇��</returns>
+ public static int ObjToInt(this object thisValue, int errorValue)
+ {
+ int reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负闀挎暣鍨�(long)
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑闀挎暣鍨嬪�硷紝杞崲澶辫触鎴栦负null鏃惰繑鍥�0</returns>
+ /// <remarks>
+ /// 澶勭悊DBNull.Value鎯呭喌锛屽苟灏濊瘯灏嗗璞¤浆鎹负long绫诲瀷
+ /// </remarks>
+ public static long ObjToLong(this object thisValue)
+ {
+ long reval = 0;
+ if (thisValue == null) return 0;
+ if (thisValue != DBNull.Value && long.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负閲戦(double绫诲瀷)銆傝嫢杞崲澶辫触鍒欒繑鍥�0銆�
+ /// </summary>
+ /// <param name="thisValue">寰呰浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑閲戦鍊硷紝澶辫触杩斿洖0</returns>
+ public static double ObjToMoney(this object thisValue)
+ {
+ double reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负閲戦(double)绫诲瀷锛岃浆鎹㈠け璐ユ椂杩斿洖鎸囧畾鐨勯敊璇��
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
+ /// <returns>杞崲鎴愬姛鐨刣ouble鍊兼垨鎸囧畾鐨勯敊璇��</returns>
+ public static double ObjToMoney(this object thisValue, double errorValue)
+ {
+ double reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负瀛楃涓诧紝鑻ュ璞′负null鍒欒繑鍥炵┖瀛楃涓�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>鍘婚櫎鍓嶅悗绌烘牸鐨勫瓧绗︿覆缁撴灉</returns>
+ public static string ObjToString(this object thisValue)
+ {
+ if (thisValue != null) return thisValue.ToString().Trim();
+ return "";
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀵硅薄鏄惁涓嶄负绌烘垨null鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佸垽鏂殑瀵硅薄</param>
+ /// <returns>褰撳璞′笉涓虹┖涓斾笉绛変簬"undefined"鎴�"null"瀛楃涓叉椂杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool IsNotEmptyOrNull(this object thisValue)
+ {
+ return ObjToString(thisValue) != "" && ObjToString(thisValue) != "undefined" && ObjToString(thisValue) != "null";
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负瀛楃涓诧紝濡傛灉瀵硅薄涓簄ull鍒欒繑鍥炴寚瀹氱殑閿欒鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="errorValue">褰撳璞′负null鏃惰繑鍥炵殑鍊�</param>
+ /// <returns>瀵硅薄鐨勫瓧绗︿覆琛ㄧず鎴栨寚瀹氱殑閿欒鍊�</returns>
+ public static string ObjToString(this object thisValue, string errorValue)
+ {
+ if (thisValue != null) return thisValue.ToString().Trim();
+ return errorValue;
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀵硅薄鏄惁涓簄ull銆丏BNull鎴栫┖瀛楃涓�
+ /// </summary>
+ /// <param name="thisValue">瑕佹鏌ョ殑瀵硅薄</param>
+ /// <returns>濡傛灉瀵硅薄涓簄ull銆丏BNull鎴栫┖瀛楃涓插垯杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool IsNullOrEmpty(this object thisValue) => thisValue == null || thisValue == DBNull.Value || string.IsNullOrWhiteSpace(thisValue.ToString());
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负Decimal绫诲瀷
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑Decimal鍊硷紝杞崲澶辫触杩斿洖0</returns>
+ public static Decimal ObjToDecimal(this object thisValue)
+ {
+ Decimal reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负Decimal绫诲瀷锛岃嫢杞崲澶辫触鍒欒繑鍥炴寚瀹氱殑榛樿鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
+ /// <returns>杞崲鎴愬姛鐨凞ecimal鍊兼垨鎸囧畾鐨勯粯璁ゅ��</returns>
+ public static Decimal ObjToDecimal(this object thisValue, decimal errorValue)
+ {
+ Decimal reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负DateTime绫诲瀷
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑DateTime鍊硷紝杞崲澶辫触杩斿洖DateTime.MinValue</returns>
+ public static DateTime ObjToDate(this object thisValue)
+ {
+ DateTime reval = DateTime.MinValue;
+ if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
+ {
+ reval = Convert.ToDateTime(thisValue);
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负DateTime绫诲瀷锛岃浆鎹㈠け璐ユ椂杩斿洖鎸囧畾鐨勯粯璁ゅ��
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="errorValue">杞崲澶辫触鏃惰繑鍥炵殑榛樿鍊�</param>
+ /// <returns>杞崲鎴愬姛鐨凞ateTime鍊兼垨鎸囧畾鐨勯粯璁ゅ��</returns>
+ public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
+ {
+ DateTime reval = DateTime.MinValue;
+ if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负甯冨皵鍊�
+ /// </summary>
+ /// <param name="thisValue">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <returns>杞崲鍚庣殑甯冨皵鍊硷紝杞崲澶辫触鏃惰繑鍥瀎alse</returns>
+ public static bool ObjToBool(this object thisValue)
+ {
+ bool reval = false;
+ if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ /// 灏咲ateTime杞崲涓篣nix鏃堕棿鎴筹紙绉掔骇锛�
+ /// </summary>
+ /// <param name="thisValue">闇�瑕佽浆鎹㈢殑DateTime瀵硅薄</param>
+ /// <returns>杩斿洖琛ㄧずUnix鏃堕棿鎴崇殑瀛楃涓�</returns>
+ public static string DateToTimeStamp(this DateTime thisValue)
+ {
+ TimeSpan ts = thisValue - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(ts.TotalSeconds).ToString();
+ }
+
+ /// <summary>
+ /// 灏嗗璞¤浆鎹负鎸囧畾绫诲瀷
+ /// </summary>
+ /// <param name="value">瑕佽浆鎹㈢殑瀵硅薄</param>
+ /// <param name="type">鐩爣绫诲瀷</param>
+ /// <returns>杞崲鍚庣殑瀵硅薄</returns>
+ /// <remarks>
+ /// 鏀寔澶勭悊null鍊笺�佹灇涓剧被鍨嬨�佹硾鍨嬬被鍨嬨�丟uid銆乂ersion绛夌壒娈婄被鍨嬬殑杞崲銆�
+ /// 濡傛灉杞崲澶辫触鎴栫被鍨嬩笉鍖归厤锛屽皢杩斿洖鍘熷鍊兼垨鎶涘嚭寮傚父銆�
+ /// </remarks>
+ public static object ChangeType(this object value, Type type)
+ {
+ if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
+ if (value == null) return null;
+ if (type == value.GetType()) return value;
+ if (type.IsEnum)
+ {
+ if (value is string)
+ return Enum.Parse(type, value as string);
+ else
+ return Enum.ToObject(type, value);
+ }
+
+ if (!type.IsInterface && type.IsGenericType)
+ {
+ Type innerType = type.GetGenericArguments()[0];
+ object innerValue = ChangeType(value, innerType);
+ return Activator.CreateInstance(type, new object[] { innerValue });
+ }
+
+ if (value is string && type == typeof(Guid)) return new Guid(value as string);
+ if (value is string && type == typeof(Version)) return new Version(value as string);
+ if (!(value is IConvertible)) return value;
+ return Convert.ChangeType(value, type);
+ }
+
+ /// <summary>
+ /// 灏嗗璞″�艰浆鎹负鎸囧畾绫诲瀷鐨勬硾鍨嬪垪琛ㄣ��
+ /// </summary>
+ /// <param name="value">寰呰浆鎹㈢殑瀵硅薄鍊�</param>
+ /// <param name="type">鐩爣鍒楄〃鍏冪礌绫诲瀷</param>
+ /// <returns>杞崲鍚庣殑娉涘瀷鍒楄〃瀵硅薄锛岃嫢杈撳叆涓簄ull鍒欒繑鍥為粯璁ゅ��</returns>
+ /// <remarks>
+ /// 鏀寔澶勭悊浠ユ嫭鍙峰寘瑁圭殑瀛楃涓叉牸寮忥紙濡�"(1,2,3)"鎴�"("a","b")"锛夛紝
+ /// 鑷姩鍘婚櫎鍒嗛殧绗﹀苟灏嗗厓绱犺浆鎹负鐩爣绫诲瀷鍚庢坊鍔犲埌鍒楄〃銆�
+ /// </remarks>
+ public static object ChangeTypeList(this object value, Type type)
+ {
+ if (value == null) return default;
+
+ var gt = typeof(List<>).MakeGenericType(type);
+ dynamic lis = Activator.CreateInstance(gt);
+
+ var addMethod = gt.GetMethod("Add");
+ string values = value.ToString();
+ if (values != null && values.StartsWith("(") && values.EndsWith(")"))
+ {
+ string[] splits;
+ if (values.Contains("\",\""))
+ {
+ splits = values.Remove(values.Length - 2, 2)
+ .Remove(0, 2)
+ .Split("\",\"");
+ }
+ else
+ {
+ splits = values.Remove(0, 1)
+ .Remove(values.Length - 2, 1)
+ .Split(",");
+ }
+
+ foreach (var split in splits)
+ {
+ var str = split;
+ if (split.StartsWith("\"") && split.EndsWith("\""))
+ {
+ str = split.Remove(0, 1)
+ .Remove(split.Length - 2, 1);
+ }
+
+ addMethod.Invoke(lis, new object[] { ChangeType(str, type) });
+ }
+ }
+
+ return lis;
+ }
+
+ /// <summary>
+ /// 灏嗗璞″簭鍒楀寲涓篔SON瀛楃涓�
+ /// </summary>
+ /// <param name="value">瑕佸簭鍒楀寲鐨勫璞�</param>
+ /// <returns>瀵硅薄鐨凧SON瀛楃涓茶〃绀�</returns>
+ public static string ToJson(this object value)
+ {
+ return JsonConvert.SerializeObject(value);
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀵硅薄鏄惁鍙互杞崲涓烘暣鏁�
+ /// </summary>
+ /// <param name="obj">瑕佸垽鏂殑瀵硅薄</param>
+ /// <returns>濡傛灉鍙互杞崲涓烘暣鏁拌繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool IsInt(this object obj)
+ {
+ if (obj == null)
+ return false;
+ bool reslut = Int32.TryParse(obj.ToString(), out int _number);
+ return reslut;
+
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀵硅薄鏄惁涓烘湁鏁堟棩鏈熸牸寮�
+ /// </summary>
+ /// <param name="str">寰呮娴嬬殑瀵硅薄</param>
+ /// <returns>true琛ㄧず鏄湁鏁堟棩鏈燂紝false鍒欎笉鏄�</returns>
+ /// <remarks>姝ゆ柟娉曟槸鎵╁睍鏂规硶锛岄�氳繃璋冪敤IsDate(out _)瀹炵幇</remarks>
+ public static bool IsDate(this object str)
+ {
+ return str.IsDate(out _);
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀵硅薄鏄惁鍙互杞崲涓烘湁鏁堢殑鏃ユ湡鏃堕棿
+ /// </summary>
+ /// <param name="str">瑕佸垽鏂殑瀵硅薄</param>
+ /// <param name="dateTime">杈撳嚭杞崲鍚庣殑鏃ユ湡鏃堕棿鍊�</param>
+ /// <returns>濡傛灉杞崲鎴愬姛杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool IsDate(this object str, out DateTime dateTime)
+ {
+ dateTime = DateTime.Now;
+ if (str == null || str.ToString() == "")
+ {
+ return false;
+ }
+ return DateTime.TryParse(str.ToString(), out dateTime);
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀛楃涓叉槸鍚﹀彲浠ヨ浆鎹负鏁板瓧
+ /// </summary>
+ /// <param name="str">瑕佹鏌ョ殑瀛楃涓�</param>
+ /// <param name="formatString">鏍煎紡瀛楃涓诧紙鏈娇鐢級</param>
+ /// <returns>濡傛灉瀛楃涓插彲浠ヨ浆鎹负鏁板瓧鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
+ /// <remarks>
+ /// 浣跨敤姝e垯琛ㄨ揪寮忛獙璇佸瓧绗︿覆鏄惁涓烘暟瀛楁牸寮忥紝鏀寔姝h礋鍙峰拰灏忔暟鐐�
+ /// </remarks>
+ public static bool IsNumber(this string str, string formatString)
+ {
+ if (string.IsNullOrEmpty(str)) return false;
+
+ return Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$");
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇瀛楃涓叉槸鍚︿负鏈夋晥鐨凣uid鏍煎紡
+ /// </summary>
+ /// <param name="guid">瑕侀獙璇佺殑瀛楃涓�</param>
+ /// <returns>濡傛灉瀛楃涓叉槸鏈夋晥鐨凣uid鏍煎紡鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool IsGuid(this string guid)
+ {
+ Guid newId;
+ return guid.GetGuid(out newId);
+ }
+
+ /// <summary>
+ /// 灏嗗瓧绗︿覆杞崲涓篏uid绫诲瀷
+ /// </summary>
+ /// <param name="guid">瑕佽浆鎹㈢殑瀛楃涓�</param>
+ /// <param name="outId">杈撳嚭杞崲鍚庣殑Guid</param>
+ /// <returns>杞崲鎴愬姛杩斿洖true锛屽惁鍒欒繑鍥瀎alse</returns>
+ public static bool GetGuid(this string guid, out Guid outId)
+ {
+ Guid emptyId = Guid.Empty;
+ return Guid.TryParse(guid, out outId);
+ }
+
+ /// <summary>
+ /// 灏嗗瓧绗︿覆绫诲瀷鐨勬潯浠惰浆鎹负瀵瑰簲鐨凩inq琛ㄨ揪寮忕被鍨�
+ /// </summary>
+ /// <param name="stringType">琛ㄧず鏉′欢鐨勫瓧绗︿覆</param>
+ /// <returns>瀵瑰簲鐨凩inq琛ㄨ揪寮忕被鍨嬫灇涓惧��</returns>
+ /// <remarks>
+ /// 璇ユ柟娉曠敤浜庡皢鍓嶇浼犻�掔殑鏉′欢瀛楃涓叉槧灏勪负鍚庣Linq鏌ヨ浣跨敤鐨勮〃杈惧紡绫诲瀷锛�
+ /// 鏀寔鍖呭惈銆佸ぇ浜庣瓑浜庛�佸皬浜庣瓑浜庛�佸ぇ浜庛�佸皬浜庛�佹ā绯婂尮閰嶇瓑甯歌鏉′欢绫诲瀷锛�
+ /// 榛樿杩斿洖绛変簬(Equal)绫诲瀷
+ /// </remarks>
+ public static LinqExpressionType GetLinqCondition(this string stringType)
+ {
+ LinqExpressionType linqExpression;
+ switch (stringType)
+ {
+ case HtmlElementType.Contains:
+ case HtmlElementType.selectlist:
+ case nameof(HtmlElementType.Contains):
+ linqExpression = LinqExpressionType.In;
break;
- case HtmlElementType.notequal:
- linqExpression = LinqExpressionType.NotEqual;
- break;
- case HtmlElementType.notequal:
- linqExpression = LinqExpressionType.NotEqual;
- break;
- default:
- linqExpression = LinqExpressionType.Equal;
- break;
- }
- return linqExpression;
- }
- }
-}
+ case HtmlElementType.ThanOrEqual:
+ case nameof(HtmlElementType.ThanOrEqual):
+ case HtmlElementType.thanorequal:
+ linqExpression = LinqExpressionType.ThanOrEqual;
+ break;
+ case HtmlElementType.LessOrEqual:
+ case nameof(HtmlElementType.LessOrEqual):
+ case HtmlElementType.lessorequal:
+ linqExpression = LinqExpressionType.LessThanOrEqual;
+ break;
+ case HtmlElementType.GT:
+ case nameof(HtmlElementType.GT):
+ linqExpression = LinqExpressionType.GreaterThan;
+ break;
+ case HtmlElementType.lt:
+ linqExpression = LinqExpressionType.LessThan;
+ break;
+ case HtmlElementType.like:
+ linqExpression = LinqExpressionType.Contains;
+ break;
+ case HtmlElementType.notequal:
+ linqExpression = LinqExpressionType.NotEqual;
+ break;
+ default:
+ linqExpression = LinqExpressionType.Equal;
+ break;
+ }
+ return linqExpression;
+ }
+ }
+}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoRepository/IRobotTask_HtyRepository.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoRepository/IRobotTask_HtyRepository.cs
new file mode 100644
index 0000000..c80dc55
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoRepository/IRobotTask_HtyRepository.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_IRobotTaskInfoRepository
+{
+ public interface IRobotTask_HtyRepository : IRepository<Dt_RobotTask_Hty>
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
index 26cf6df..2e8cbdf 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
@@ -54,6 +54,7 @@
/// </summary>
public List<int> TaskRobotTypes { get; }
+ public bool DeleteRobotTask(int id);
public Dt_RobotTask? QueryRobotCraneTask(string deviceCode);
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTask_HtyService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTask_HtyService.cs
new file mode 100644
index 0000000..d2bd0e9
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTask_HtyService.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_ITaskInfoService
+{
+ public interface IRobotTask_HtyService : IService<Dt_RobotTask_Hty>
+ {
+ }
+}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs
index 8477545..615edea 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/RobotState/Dt_RobotState.cs
@@ -23,7 +23,7 @@
/// 鏈烘鎵� IP 鍦板潃锛屽敮涓�绱㈠紩
/// </summary>
[SugarColumn(Length = 50, ColumnDescription = "鏈烘鎵婭P鍦板潃")]
- public string IPAddress { get; set; } = string.Empty;
+ public string IpAddress { get; set; }
/// <summary>
/// 鐗堟湰鍙凤紝鐢ㄤ簬涔愯骞跺彂鎺у埗
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_RobotTask_Hty.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_RobotTask_Hty.cs
new file mode 100644
index 0000000..82618cb
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_RobotTask_Hty.cs
@@ -0,0 +1,42 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Magicodes.ExporterAndImporter.Core;
+using WIDESEAWCS_Core.DB.Models;
+
+namespace WIDESEAWCS_Model.Models
+{
+ /// <summary>
+ /// 鏈哄櫒浜哄巻鍙蹭换鍔¤〃瀹炰綋
+ /// </summary>
+ [SugarTable(nameof(Dt_RobotTask_Hty), "鏈哄櫒浜哄巻鍙蹭换鍔′俊鎭�")]
+ public class Dt_RobotTask_Hty : Dt_RobotTask, IBaseHistoryEntity
+ {
+ /// <summary>
+ /// 鍘熻〃涓婚敭
+ /// </summary>
+ [ImporterHeader(Name = "鍘熻〃涓婚敭")]
+ [ExporterHeader(DisplayName = "鍘熻〃涓婚敭")]
+ [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "鍘熻〃涓婚敭")]
+ public int SourceId { get; set; }
+
+ /// <summary>
+ /// 鎿嶄綔绫诲瀷
+ /// </summary>
+ [ImporterHeader(Name = "鎿嶄綔绫诲瀷")]
+ [ExporterHeader(DisplayName = "鎿嶄綔绫诲瀷")]
+ [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎿嶄綔绫诲瀷")]
+ public string OperateType { get; set; }
+
+ /// <summary>
+ /// 绉诲叆鍘嗗彶鏃堕棿
+ /// </summary>
+ [ImporterHeader(Name = "绉诲叆鍘嗗彶鏃堕棿")]
+ [ExporterHeader(DisplayName = "绉诲叆鍘嗗彶鏃堕棿")]
+ [SugarColumn(IsNullable = false, ColumnDescription = "绉诲叆鍘嗗彶鏃堕棿")]
+ public DateTime InsertTime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
index c35c454..fc22a70 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
@@ -1,17 +1,32 @@
-锘縰sing Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseController;
+using WIDESEAWCS_Core.Enums;
+using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
namespace WIDESEAWCS_Server.Controllers.Task
{
- [Route("api/robotTask")]
+ [Route("api/RobotTask")]
[ApiController]
public class RobotTaskController : ApiBaseController<IRobotTaskService, Dt_RobotTask>
{
public RobotTaskController(IRobotTaskService service) : base(service)
{
+
+ }
+ [HttpGet, HttpPost, Route("DeleteRobotTask"), AllowAnonymous]
+ public WebResponseContent DeleteRobotTask(int id)
+ {
+ if (Service.DeleteRobotTask(id)){
+ return WebResponseContent.Instance.OK();
+ }
+ return WebResponseContent.Instance.Error();
}
+
}
}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTask_HtyController.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTask_HtyController.cs
new file mode 100644
index 0000000..2dbb40f
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTask_HtyController.cs
@@ -0,0 +1,24 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using WIDESEAWCS_Core.BaseController;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_Server.Controllers.Task
+{
+ namespace WIDESEAWCS_WCSServer.Controllers.Task
+ {
+ [Route("api/RobotTask_Hty")]
+ [ApiController]
+ public class RobotTask_HtyController : ApiBaseController<IRobotTask_HtyService, Dt_RobotTask_Hty>
+ {
+ private readonly IHttpContextAccessor _httpContextAccessor;
+
+ public RobotTask_HtyController(
+ IRobotTask_HtyService service,
+ IHttpContextAccessor httpContextAccessor) : base(service)
+ {
+ _httpContextAccessor = httpContextAccessor;
+ }
+ }
+ }
+}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
index 66e8fe1..bd0ee02 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotStateRepository.cs
@@ -19,7 +19,7 @@
public Dt_RobotState? GetByIp(string ipAddress)
{
return Db.Queryable<Dt_RobotState>()
- .Where(x => x.IPAddress == ipAddress)
+ .Where(x => x.IpAddress == ipAddress)
.First();
}
@@ -33,7 +33,7 @@
var newState = new Dt_RobotState
{
- IPAddress = ipAddress,
+ IpAddress = ipAddress,
Version = DateTime.UtcNow.Ticks,
RobotCraneJson = JsonConvert.SerializeObject(robotCrane),
CreateDate = DateTime.Now,
@@ -50,7 +50,7 @@
// 涔愯閿侊細WHERE IPAddress = @ip AND Version = @expectedVersion锛岀増鏈尮閰嶆墠鏇存柊
var affectedRows = Db.Updateable<Dt_RobotState>(newState)
- .Where(x => x.IPAddress == ipAddress)
+ .Where(x => x.IpAddress == ipAddress)
.ExecuteCommand();
return affectedRows > 0;
@@ -60,7 +60,7 @@
{
var state = new RobotSocketState
{
- IPAddress = entity.IPAddress,
+ IPAddress = entity.IpAddress,
Version = entity.Version,
IsEventSubscribed = entity.IsEventSubscribed,
RobotRunMode = entity.RobotRunMode,
@@ -112,7 +112,7 @@
{
var entity = new Dt_RobotState
{
- IPAddress = state.IPAddress,
+ IpAddress = state.IPAddress,
IsEventSubscribed = state.IsEventSubscribed,
RobotRunMode = state.RobotRunMode,
RobotControlMode = state.RobotControlMode,
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotTaskInfoRepository.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotTaskInfoRepository.cs
new file mode 100644
index 0000000..fba11f5
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/RobotTaskInfoRepository.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_IRobotTaskInfoRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_RobotTaskInfoRepository
+{
+ public class RobotTask_HtyRepository : RepositoryBase<Dt_RobotTask_Hty>, IRobotTask_HtyRepository
+ {
+ public RobotTask_HtyRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
index ebaa465..b23d9ec 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
@@ -29,6 +29,7 @@
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Core.Utilities;
using WIDESEAWCS_DTO.Stock;
@@ -70,6 +71,23 @@
_httpClientHelper = httpClientHelper;
_taskExecuteDetailService = taskExecuteDetailService;
_logger = logger;
+ }
+ public override WebResponseContent DeleteData(object[] keys)
+ {
+ List<int> taskKeys = new List<int>();
+ for (int i = 0; i < keys.Length; i++)
+ {
+ taskKeys.Add(Convert.ToInt32(keys[i]));
+ }
+ List<Dt_RobotTask> tasks = BaseDal.QueryData(x => taskKeys.Contains(x.RobotTaskId));
+ BaseDal.DeleteAndMoveIntoHty(tasks, OperateTypeEnum.浜哄伐鍒犻櫎);
+ return WebResponseContent.Instance.OK($"鎴愬姛鍒犻櫎{tasks.Count}鏉℃暟鎹�");
+
+ }
+ public bool DeleteRobotTask(int id)
+ {
+ Dt_RobotTask task = BaseDal.QueryFirst(x => x.RobotTaskId == id);
+ return BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
}
public WebResponseContent ReceiveWMSTask([NotNull] WMSTaskDTO taskDTO, StockDTO stockDTO)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTask_HtyService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTask_HtyService.cs
new file mode 100644
index 0000000..3fef9b3
--- /dev/null
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTask_HtyService.cs
@@ -0,0 +1,29 @@
+锘縰sing MapsterMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_IRobotTaskInfoRepository;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob.Service;
+
+namespace WIDESEAWCS_TaskInfoService
+{
+ public class RobotTask_HtyService : ServiceBase<Dt_RobotTask_Hty, IRobotTask_HtyRepository>, IRobotTask_HtyService
+ {
+ private readonly IRouterService _routerService;
+ private readonly IMapper _mapper;
+
+ public RobotTask_HtyService(
+ IRobotTask_HtyRepository BaseDal,
+ IRouterService routerService,
+ IMapper mapper) : base(BaseDal)
+ {
+ _routerService = routerService;
+ _mapper = mapper;
+ }
+ }
+}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
index 84113a2..7ec1101 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
@@ -79,7 +79,7 @@
/// <summary>
/// 鏃ュ織璁板綍鍣�
/// </summary>
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
/// <summary>
/// 鏋勯�犲嚱鏁�
@@ -146,7 +146,7 @@
/// <returns>鍒犻櫎鏄惁鎴愬姛</returns>
public bool? DeleteTask(int ID)
{
- return _robotTaskService.Repository.DeleteDataById(ID);
+ return _robotTaskService.DeleteRobotTask(ID);
}
/// <summary>
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
index c81ec7d..a89ec4e 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
@@ -67,8 +67,8 @@
<div v-if="selectedLocation.details && selectedLocation.details.length > 0" class="detail-table">
<h4>搴撳瓨鏄庣粏</h4>
<el-table :data="selectedLocation.details" border size="small" max-height="400">
- <el-table-column prop="materielName" label="鐗╂枡鍚嶇О" min-width="140" show-overflow-tooltip />
- <el-table-column prop="serialNumber" label="鐢佃姱鏉$爜" min-width="160" show-overflow-tooltip />
+ <el-table-column prop="materielName" label="鐗╂枡鍚嶇О" min-width="90" show-overflow-tooltip />
+ <el-table-column prop="serialNumber" label="鐢佃姱鏉$爜" min-width="180" show-overflow-tooltip />
<el-table-column prop="inboundOrderRowNo" label="閫氶亾鍙�" min-width="100" show-overflow-tooltip />
</el-table>
</div>
@@ -777,9 +777,9 @@
selectedLocation.value = null
// 娓呯┖绛涢�夋潯浠�
- filterStockStatus.value = null
- filterMaterielCode.value = null
- filterBatchNo.value = null
+ filterStockStatus.value = null
+ filterMaterielCode.value = null
+ filterBatchNo.value = null
const res = await proxy.http.get(`/api/StockInfo/Get3DLayout?warehouseId=${warehouseId}`)
if (res.status && res.data) {
const data = res.data
@@ -1161,13 +1161,13 @@
selectedLocation.value = null
// 娓呯┖鎵�鏈夌瓫閫夋潯浠�
- filterStockStatus.value = null
- filterMaterielCode.value = null
- filterBatchNo.value = null
+ // filterStockStatus.value = null
+ // filterMaterielCode.value = null
+ // filterBatchNo.value = null
- // 娓呯┖绛涢�夐�夐」鍒楄〃
- materielCodeList.value = []
- batchNoList.value = []
+ // // 娓呯┖绛涢�夐�夐」鍒楄〃
+ // materielCodeList.value = []
+ // batchNoList.value = []
// 鍔犺浇鏂颁粨搴撴暟鎹�
await loadWarehouseData(warehouseId)
@@ -1375,7 +1375,7 @@
}
.detail-content {
- padding: 20px;
+ padding: 10px;
}
.detail-table {
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockInfo.vue b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockInfo.vue
index 6703a37..789e395 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockInfo.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockInfo.vue
@@ -1,16 +1,7 @@
<template>
- <view-grid
- ref="grid"
- :columns="columns"
- :detail="detail"
- :editFormFields="editFormFields"
- :editFormOptions="editFormOptions"
- :searchFormFields="searchFormFields"
- :searchFormOptions="searchFormOptions"
- :table="table"
- :tableExpand="tableExpand"
- :extend="extend"
- >
+ <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
+ :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
+ :table="table" :tableExpand="tableExpand" :extend="extend">
</view-grid>
</template>
@@ -30,6 +21,7 @@
palletCode: "鎵樼洏缂栧彿",
stockStatus: "搴撳瓨鐘舵��",
locationCode: "璐т綅缂栧彿",
+ outboundDate: "鍑哄簱鏃堕棿",
warehouse: "浠撳簱",
creator: "鍒涘缓浜�",
createDate: "鍒涘缓鏃堕棿",
@@ -64,7 +56,7 @@
sortName: "id",
});
- const editFormFields = ref({
+ const editFormFields = ref({
palletCode: "",
palletType: 0,
warehouseId: 0,
@@ -78,7 +70,7 @@
const editFormOptions = ref([
[
{ field: "palletCode", title: TEXT.palletCode, type: "string" },
- { field: "stockStatus", title: TEXT.stockStatus, type: "select", dataKey: "stockStatusEmun", data: []},
+ { field: "stockStatus", title: TEXT.stockStatus, type: "select", dataKey: "stockStatusEmun", data: [] },
{ field: "locationCode", title: TEXT.locationCode, type: "string" },
],
]);
@@ -112,7 +104,7 @@
field: "palletCode",
title: TEXT.palletCode,
type: "string",
- width: 120,
+ width: 150,
align: "left",
},
{
@@ -132,10 +124,17 @@
bind: { key: "mesUploadStatusEnum", data: [] },
},
{
+ field: "outboundDate",
+ title: TEXT.outboundDate,
+ type: "string",
+ width: 150,
+ align: "left",
+ },
+ {
field: "locationCode",
title: TEXT.locationCode,
type: "string",
- width: 150,
+ width: 120,
align: "left",
},
{
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/UtilConvert.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/UtilConvert.cs
index d71ebea..ebb357f 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/UtilConvert.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/UtilConvert.cs
@@ -1,998 +1,998 @@
-锘縰sing NetTaste;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using System.Web;
-using WIDESEA_Core.Const;
-using WIDESEA_Core.Enums;
-
-namespace WIDESEA_Core.Helper
-{
- public static class UtilConvert
- {
- private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
-
- private static long longTime = 621355968000000000;
-
- private static int samllTime = 10000000;
- /// <summary>
- /// 鏃堕棿鎴宠浆鎹㈡垚鏃ユ湡
- /// </summary>
- /// <param name="timeStamp"></param>
- /// <returns></returns>
- public static DateTime GetTimeSpmpToDate(this object timeStamp)
- {
- if (timeStamp == null) return dateStart;
- DateTime dateTime = new DateTime(longTime + Convert.ToInt64(timeStamp) * samllTime, DateTimeKind.Utc).ToLocalTime();
- return dateTime;
- }
-
- public static string Serialize(this object obj, JsonSerializerSettings formatDate = null)
- {
- if (obj == null) return null;
- formatDate = formatDate ?? new JsonSerializerSettings
- {
- DateFormatString = "yyyy-MM-dd HH:mm:ss"
- };
- return JsonConvert.SerializeObject(obj, formatDate);
- }
-
- public static T DeserializeObject<T>(this string json)
- {
- if (string.IsNullOrEmpty(json))
- {
- return default(T);
- }
- if (json == "{}")
- {
- json = "[]";
- }
- return JsonConvert.DeserializeObject<T>(json);
- }
-
- public static string FirstLetterToLower(this string thisValue)
- {
- if (string.IsNullOrEmpty(thisValue)) return string.Empty;
- string result = thisValue.Substring(0, 1).ToLower() + thisValue.Substring(1, thisValue.Length - 1);
- return result;
- }
-
- public static string FirstLetterToUpper(this string thisValue)
- {
- if (string.IsNullOrEmpty(thisValue)) return string.Empty;
- string result = thisValue.Substring(0, 1).ToUpper() + thisValue.Substring(1, thisValue.Length - 1);
- return result;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static int ObjToInt(this object thisValue)
- {
- int reval = 0;
- if (thisValue == null) return 0;
- if (thisValue is Enum && thisValue != DBNull.Value && Enum.TryParse(thisValue.GetType(), thisValue.ToString(), out var val))
- {
- return Convert.ToInt32(val.ChangeType(typeof(int)));
- }
- if (thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static int DoubleToInt(this double thisValue)
- {
- int reval = 0;
-
- return Convert.ToInt32(thisValue);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <param name="errorValue"></param>
- /// <returns></returns>
- public static int ObjToInt(this object thisValue, int errorValue)
- {
- int reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- public static long ObjToLong(this object thisValue)
- {
- long reval = 0;
- if (thisValue == null) return 0;
- if (thisValue != DBNull.Value && long.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static double ObjToMoney(this object thisValue)
- {
- double reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return 0;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <param name="errorValue"></param>
- /// <returns></returns>
- public static double ObjToMoney(this object thisValue, double errorValue)
- {
- double reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static string ObjToString(this object thisValue)
- {
- if (thisValue != null) return thisValue.ToString().Trim();
- return "";
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static bool IsNotEmptyOrNull(this object thisValue)
- {
- return ObjToString(thisValue) != "" && ObjToString(thisValue) != "undefined" && ObjToString(thisValue) != "null";
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <param name="errorValue"></param>
- /// <returns></returns>
- public static string ObjToString(this object thisValue, string errorValue)
- {
- if (thisValue != null) return thisValue.ToString().Trim();
- return errorValue;
- }
-
- public static bool IsNullOrEmpty(this object thisValue) => thisValue == null || thisValue == DBNull.Value || string.IsNullOrWhiteSpace(thisValue.ToString());
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static Decimal ObjToDecimal(this object thisValue)
- {
- Decimal reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return 0;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <param name="errorValue"></param>
- /// <returns></returns>
- public static Decimal ObjToDecimal(this object thisValue, decimal errorValue)
- {
- Decimal reval = 0;
- if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static DateTime ObjToDate(this object thisValue)
- {
- DateTime reval = DateTime.MinValue;
- if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
- {
- reval = Convert.ToDateTime(thisValue);
- }
-
- return reval;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <param name="errorValue"></param>
- /// <returns></returns>
- public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
- {
- DateTime reval = DateTime.MinValue;
- if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return errorValue;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static bool ObjToBool(this object thisValue)
- {
- bool reval = false;
- if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval))
- {
- return reval;
- }
-
- return reval;
- }
-
-
- /// <summary>
- /// 鑾峰彇褰撳墠鏃堕棿鐨勬椂闂存埑
- /// </summary>
- /// <param name="thisValue"></param>
- /// <returns></returns>
- public static string DateToTimeStamp(this DateTime thisValue)
- {
- TimeSpan ts = thisValue - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- return Convert.ToInt64(ts.TotalSeconds).ToString();
- }
-
- public static object ChangeType(this object value, Type type)
- {
- if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
- if (value == null) return null;
- if (type == value.GetType()) return value;
- if (type.IsEnum)
- {
- if (value is string)
- return Enum.Parse(type, value as string);
- else
- return Enum.ToObject(type, value);
- }
-
- if (!type.IsInterface && type.IsGenericType)
- {
- Type innerType = type.GetGenericArguments()[0];
- object innerValue = ChangeType(value, innerType);
- return Activator.CreateInstance(type, new object[] { innerValue });
- }
-
- if (value is string && type == typeof(Guid)) return new Guid(value as string);
- if (value is string && type == typeof(Version)) return new Version(value as string);
- if (!(value is IConvertible)) return value;
- return Convert.ChangeType(value, type);
- }
-
- public static object ChangeTypeList(this object value, Type type)
- {
- if (value == null) return default;
-
- var gt = typeof(List<>).MakeGenericType(type);
- dynamic lis = Activator.CreateInstance(gt);
-
- var addMethod = gt.GetMethod("Add");
- string values = value.ToString();
- if (values != null && values.StartsWith("(") && values.EndsWith(")"))
- {
- string[] splits;
- if (values.Contains("\",\""))
- {
- splits = values.Remove(values.Length - 2, 2)
- .Remove(0, 2)
- .Split("\",\"");
- }
- else
- {
- splits = values.Remove(0, 1)
- .Remove(values.Length - 2, 1)
- .Split(",");
- }
-
- foreach (var split in splits)
- {
- var str = split;
- if (split.StartsWith("\"") && split.EndsWith("\""))
- {
- str = split.Remove(0, 1)
- .Remove(split.Length - 2, 1);
- }
-
- addMethod.Invoke(lis, new object[] { ChangeType(str, type) });
- }
- }
-
- return lis;
- }
-
- public static string ToJson(this object value)
- {
- return JsonConvert.SerializeObject(value);
- }
-
- public static bool IsNumeric(this object value)
- {
- if (value == null)
- return false;
- bool reslut = decimal.TryParse(value.ToString(), out decimal _number);
- return reslut;
- }
-
- public static bool IsInt(this object obj)
- {
- if (obj == null)
- return false;
- bool reslut = Int32.TryParse(obj.ToString(), out int _number);
- return reslut;
-
- }
- public static bool IsDate(this object str)
- {
- return str.IsDate(out _);
- }
- public static bool IsDate(this object str, out DateTime dateTime)
- {
- dateTime = DateTime.Now;
- if (str == null || str.ToString() == "")
- {
- return false;
- }
- return DateTime.TryParse(str.ToString(), out dateTime);
- }
-
- /// <summary>
- /// 鏍规嵁浼犲叆鏍煎紡鍒ゆ柇鏄惁涓哄皬鏁�
- /// </summary>
- /// <param name="str"></param>
- /// <param name="formatString">18,5</param>
- /// <returns></returns>
- public static bool IsNumber(this string str, string formatString)
- {
- if (string.IsNullOrEmpty(str)) return false;
-
- return Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$");
- }
-
- public static bool IsGuid(this string guid)
- {
- Guid newId;
- return guid.GetGuid(out newId);
- }
-
- public static bool GetGuid(this string guid, out Guid outId)
- {
- Guid emptyId = Guid.Empty;
- return Guid.TryParse(guid, out outId);
- }
-
- /// <summary>
- /// 杞崲涓虹煭鏁村瀷 qy 2024-7-15
- /// </summary>
- /// <param name="data">鏁版嵁</param>
- public static short ToShort(this object data)
- {
- if (data == null)
- return 0;
- short result;
- var success = short.TryParse(data.ToString(), out result);
- if (success)
- return result;
- try
- {
- return Convert.ToInt16(data);
- }
- catch (Exception)
- {
- return 0;
- }
- }
-
- /// <summary>
- /// 杞崲涓洪珮绮惧害娴偣鏁�,骞舵寜鎸囧畾鐨勫皬鏁颁綅4鑸�5鍏� qy 2024-7-15
- /// </summary>
- /// <param name="data">鏁版嵁</param>
- /// <param name="digits">灏忔暟浣嶆暟</param>
- public static decimal ToDecimal(this object data, int digits)
- {
- return Math.Round(ObjToDecimal(data), digits);
- }
-
-
-
- /// <summary>
- /// 鏋氫妇杞琇ist qy 2024-7-15
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- public static List<object> GetEnumList<T>()
- {
- List<object> list = new List<object>();
- var t = typeof(T);
- foreach (var item in Enum.GetValues(typeof(T)))
- {
- FieldInfo f = t.GetField(Enum.GetName(typeof(T), item));
- var r = (System.ComponentModel.DescriptionAttribute[])f.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
- list.Add(new { ID = item, value = Enum.GetName(typeof(T), item), name = r[0].Description });
- }
- return list;
- }
-
- /// <summary>
- /// 楠岃瘉鍔ㄦ�佺被鍨嬪厓绱犳槸鍚︿负绌� qy 2024-7-15
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public static bool CheckDynamic(object obj)
- {
- return (obj != null && Convert.ToString(obj) != "") ? true : false;
- }
-
- /// <summary>
- /// 鍔ㄦ�佺被鍨嬪厓绱犺浆瀛楃涓插苟瑙g爜 qy 2024-7-15
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public static string DynamicToString(object obj)
- {
- return CheckDynamic(obj) ? HttpUtility.UrlDecode(Convert.ToString(obj).Trim()) : "";
- }
-
- /// <summary>
- /// DataTable杞负json qy 2024-7-15
- /// </summary>
- /// <param name="parObjRefDataTable">DataTable</param>
- /// <returns>json鏁版嵁</returns>
- public static string ToJson(this DataTable parObjRefDataTable)
- {
- List<object> objArrList = new List<object>();
-
- foreach (DataRow objDataRow in parObjRefDataTable.Rows)
- {
- Dictionary<string, object> objResult = new Dictionary<string, object>();
-
- foreach (DataColumn objDataColumn in parObjRefDataTable.Columns)
- objResult.Add(objDataColumn.ColumnName, objDataRow[objDataColumn].ToString());
-
- objArrList.Add(objResult);
- }
-
- return ToJson(objArrList);
- }
- /// <summary>
- /// Json杞琇ist qy 2024-7-15
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="parJson"></param>
- /// <returns></returns>
- public static List<T> JsonToList<T>(this string parJson)
- {
- if (string.IsNullOrWhiteSpace(parJson))
- {
- return new List<T>();
- }
- else
- {
- return JsonConvert.DeserializeObject<List<T>>(parJson);
- }
- }
-
- /// <summary>
- /// 鏃ユ湡杞负unix鍊�
- /// </summary>
- /// <param name="dt"></param>
- /// <param name="utc">T:鎸塙TC鏃堕棿璁$畻(榛樿);F:鎸夋湰鍦版椂闂磋绠�</param>
- /// <returns></returns>
- /// <summary>
- /// 鏃ユ湡杞负unix鍊�
- /// </summary>
- /// <param name="dt">鏃ユ湡鏃堕棿</param>
- /// <param name="utc">T:鎸塙TC鏃堕棿璁$畻(榛樿);F:鎸夋湰鍦版椂闂磋绠�</param>
- /// <returns></returns>
- public static double ToUnix(this DateTime dt, bool utc = true)
- {
- double intResult = 0;
- System.DateTime startTime = TimeZoneInfo.ConvertTime(new System.DateTime(1970, 1, 1), TimeZoneInfo.Utc, TimeZoneInfo.Local);
- intResult = (dt - startTime).TotalSeconds;
- intResult = Math.Round(intResult, 0);
- return intResult;
- }
-
- #region 鍒ゆ柇鏄惁涓哄瓧绗︿覆 qy 2024-7-15
- /// <summary>
- /// 鍒ゆ柇瀛楃涓叉槸鍚︿负鍚堟硶鐨刯son瀛楃涓� qy 2024-7-15
- /// </summary>
- /// <param name="json"></param>
- /// <returns></returns>
- public static bool IsJson(string json)
- {
- int errIndex;
- return IsJson(json, out errIndex);
- }
- public static bool IsJson(string json, out int errIndex)
- {
- errIndex = 0;
- if (IsJsonStart(ref json))
- {
- CharState cs = new CharState();
- char c;
- for (int i = 0; i < json.Length; i++)
- {
- c = json[i];
- if (SetCharState(c, ref cs) && cs.childrenStart)//璁剧疆鍏抽敭绗﹀彿鐘舵�併��
- {
- string item = json.Substring(i);
- int err;
- int length = GetValueLength(item, true, out err);
- cs.childrenStart = false;
- if (err > 0)
- {
- errIndex = i + err;
- return false;
- }
- i = i + length - 1;
- }
- if (cs.isError)
- {
- errIndex = i;
- return false;
- }
- }
-
- return !cs.arrayStart && !cs.jsonStart;
- }
- return false;
- }
-
- private static bool IsJsonStart(ref string json)
- {
- if (!string.IsNullOrEmpty(json))
- {
- json = json.Trim('\r', '\n', ' ');
- if (json.Length > 1)
- {
- char s = json[0];
- char e = json[json.Length - 1];
- return (s == '{' && e == '}') || (s == '[' && e == ']');
- }
- }
- return false;
- }
-
- /// <summary>
- /// 鑾峰彇鍊肩殑闀垮害锛堝綋Json鍊煎祵濂椾互"{"鎴�"["寮�澶存椂锛� qy 2024-7-15
- /// </summary>
- private static int GetValueLength(string json, bool breakOnErr, out int errIndex)
- {
- errIndex = 0;
- int len = 0;
- if (!string.IsNullOrEmpty(json))
- {
- CharState cs = new CharState();
- char c;
- for (int i = 0; i < json.Length; i++)
- {
- c = json[i];
- if (!SetCharState(c, ref cs))//璁剧疆鍏抽敭绗﹀彿鐘舵�併��
- {
- if (!cs.jsonStart && !cs.arrayStart)//json缁撴潫锛屽張涓嶆槸鏁扮粍锛屽垯閫�鍑恒��
- {
- break;
- }
- }
- else if (cs.childrenStart)//姝e父瀛楃锛屽�肩姸鎬佷笅銆�
- {
- int length = GetValueLength(json.Substring(i), breakOnErr, out errIndex);//閫掑綊瀛愬�硷紝杩斿洖涓�涓暱搴︺�傘�傘��
- cs.childrenStart = false;
- cs.valueStart = 0;
- //cs.state = 0;
- i = i + length - 1;
- }
- if (breakOnErr && cs.isError)
- {
- errIndex = i;
- return i;
- }
- if (!cs.jsonStart && !cs.arrayStart)//璁板綍褰撳墠缁撴潫浣嶇疆銆�
- {
- len = i + 1;//闀垮害姣旂储寮�+1
- break;
- }
- }
- }
- return len;
- }
-
- /// <summary>
- /// 瀛楃鐘舵�� qy 2024-7-15
- /// </summary>
- private class CharState
- {
- internal bool jsonStart = false;//浠� "{"寮�濮嬩簡...
- internal bool setDicValue = false;// 鍙互璁剧疆瀛楀吀鍊间簡銆�
- internal bool escapeChar = false;//浠�"\"杞箟绗﹀彿寮�濮嬩簡
- /// <summary>
- /// 鏁扮粍寮�濮嬨�愪粎绗竴寮�澶存墠绠椼�戯紝鍊煎祵濂楃殑浠ャ�恈hildrenStart銆戞潵鏍囪瘑銆�
- /// </summary>
- internal bool arrayStart = false;//浠�"[" 绗﹀彿寮�濮嬩簡
- internal bool childrenStart = false;//瀛愮骇宓屽寮�濮嬩簡銆�
- /// <summary>
- /// 銆�0 鍒濆鐘舵�侊紝鎴� 閬囧埌鈥�,鈥濋�楀彿銆戯紱銆�1 閬囧埌鈥滐細鈥濆啋鍙枫��
- /// </summary>
- internal int state = 0;
-
- /// <summary>
- /// 銆�-1 鍙栧�肩粨鏉熴�戙��0 鏈紑濮嬨�戙��1 鏃犲紩鍙峰紑濮嬨�戙��2 鍗曞紩鍙峰紑濮嬨�戙��3 鍙屽紩鍙峰紑濮嬨��
- /// </summary>
- internal int keyStart = 0;
- /// <summary>
- /// 銆�-1 鍙栧�肩粨鏉熴�戙��0 鏈紑濮嬨�戙��1 鏃犲紩鍙峰紑濮嬨�戙��2 鍗曞紩鍙峰紑濮嬨�戙��3 鍙屽紩鍙峰紑濮嬨��
- /// </summary>
- internal int valueStart = 0;
- internal bool isError = false;//鏄惁璇硶閿欒銆�
-
- internal void CheckIsError(char c)//鍙綋鎴愪竴绾у鐞嗭紙鍥犱负GetLength浼氶�掑綊鍒版瘡涓�涓瓙椤瑰鐞嗭級
- {
- if (keyStart > 1 || valueStart > 1)
- {
- return;
- }
- //绀轰緥 ["aa",{"bbbb":123,"fff","ddd"}]
- switch (c)
- {
- case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}]
- isError = jsonStart && state == 0;//閲嶅寮�濮嬮敊璇� 鍚屾椂涓嶆槸鍊煎鐞嗐��
- break;
- case '}':
- isError = !jsonStart || (keyStart != 0 && state == 0);//閲嶅缁撴潫閿欒 鎴栬�� 鎻愬墠缁撴潫{"aa"}銆傛甯哥殑鏈墈}
- break;
- case '[':
- isError = arrayStart && state == 0;//閲嶅寮�濮嬮敊璇�
- break;
- case ']':
- isError = !arrayStart || jsonStart;//閲嶅寮�濮嬮敊璇� 鎴栬�� Json 鏈粨鏉�
- break;
- case '"':
- case '\'':
- isError = !(jsonStart || arrayStart); //json 鎴栨暟缁勫紑濮嬨��
- if (!isError)
- {
- //閲嶅寮�濮� [""",{"" "}]
- isError = (state == 0 && keyStart == -1) || (state == 1 && valueStart == -1);
- }
- if (!isError && arrayStart && !jsonStart && c == '\'')//['aa',{}]
- {
- isError = true;
- }
- break;
- case ':':
- isError = !jsonStart || state == 1;//閲嶅鍑虹幇銆�
- break;
- case ',':
- isError = !(jsonStart || arrayStart); //json 鎴栨暟缁勫紑濮嬨��
- if (!isError)
- {
- if (jsonStart)
- {
- isError = state == 0 || (state == 1 && valueStart > 1);//閲嶅鍑虹幇銆�
- }
- else if (arrayStart)//["aa,] [,] [{},{}]
- {
- isError = keyStart == 0 && !setDicValue;
- }
- }
- break;
- case ' ':
- case '\r':
- case '\n'://[ "a",\r\n{} ]
- case '\0':
- case '\t':
- break;
- default: //鍊煎紑澶淬�傘��
- isError = (!jsonStart && !arrayStart) || (state == 0 && keyStart == -1) || (valueStart == -1 && state == 1);//
- break;
- }
- //if (isError)
- //{
-
- //}
- }
- }
- /// <summary>
- /// 璁剧疆瀛楃鐘舵��(杩斿洖true鍒欎负鍏抽敭璇嶏紝杩斿洖false鍒欏綋涓烘櫘閫氬瓧绗﹀鐞嗭級 qy 2024-7-15
- /// </summary>
- private static bool SetCharState(char c, ref CharState cs)
- {
- cs.CheckIsError(c);
- switch (c)
- {
- case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}]
- #region 澶ф嫭鍙�
- if (cs.keyStart <= 0 && cs.valueStart <= 0)
- {
- cs.keyStart = 0;
- cs.valueStart = 0;
- if (cs.jsonStart && cs.state == 1)
- {
- cs.childrenStart = true;
- }
- else
- {
- cs.state = 0;
- }
- cs.jsonStart = true;//寮�濮嬨��
- return true;
- }
- #endregion
- break;
- case '}':
- #region 澶ф嫭鍙风粨鏉�
- if (cs.keyStart <= 0 && cs.valueStart < 2 && cs.jsonStart)
- {
- cs.jsonStart = false;//姝e父缁撴潫銆�
- cs.state = 0;
- cs.keyStart = 0;
- cs.valueStart = 0;
- cs.setDicValue = true;
- return true;
- }
- // cs.isError = !cs.jsonStart && cs.state == 0;
- #endregion
- break;
- case '[':
- #region 涓嫭鍙峰紑濮�
- if (!cs.jsonStart)
- {
- cs.arrayStart = true;
- return true;
- }
- else if (cs.jsonStart && cs.state == 1)
- {
- cs.childrenStart = true;
- return true;
- }
- #endregion
- break;
- case ']':
- #region 涓嫭鍙风粨鏉�
- if (cs.arrayStart && !cs.jsonStart && cs.keyStart <= 2 && cs.valueStart <= 0)//[{},333]//杩欐牱缁撴潫銆�
- {
- cs.keyStart = 0;
- cs.valueStart = 0;
- cs.arrayStart = false;
- return true;
- }
- #endregion
- break;
- case '"':
- case '\'':
- #region 寮曞彿
- if (cs.jsonStart || cs.arrayStart)
- {
- if (cs.state == 0)//key闃舵,鏈夊彲鑳芥槸鏁扮粍["aa",{}]
- {
- if (cs.keyStart <= 0)
- {
- cs.keyStart = (c == '"' ? 3 : 2);
- return true;
- }
- else if ((cs.keyStart == 2 && c == '\'') || (cs.keyStart == 3 && c == '"'))
- {
- if (!cs.escapeChar)
- {
- cs.keyStart = -1;
- return true;
- }
- else
- {
- cs.escapeChar = false;
- }
- }
- }
- else if (cs.state == 1 && cs.jsonStart)//鍊奸樁娈靛繀椤绘槸Json寮�濮嬩簡銆�
- {
- if (cs.valueStart <= 0)
- {
- cs.valueStart = (c == '"' ? 3 : 2);
- return true;
- }
- else if ((cs.valueStart == 2 && c == '\'') || (cs.valueStart == 3 && c == '"'))
- {
- if (!cs.escapeChar)
- {
- cs.valueStart = -1;
- return true;
- }
- else
- {
- cs.escapeChar = false;
- }
- }
-
- }
- }
- #endregion
- break;
- case ':':
- #region 鍐掑彿
- if (cs.jsonStart && cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 0)
- {
- if (cs.keyStart == 1)
- {
- cs.keyStart = -1;
- }
- cs.state = 1;
- return true;
- }
- // cs.isError = !cs.jsonStart || (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1);
- #endregion
- break;
- case ',':
- #region 閫楀彿 //["aa",{aa:12,}]
-
- if (cs.jsonStart)
- {
- if (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1)
- {
- cs.state = 0;
- cs.keyStart = 0;
- cs.valueStart = 0;
- //if (cs.valueStart == 1)
- //{
- // cs.valueStart = 0;
- //}
- cs.setDicValue = true;
- return true;
- }
- }
- else if (cs.arrayStart && cs.keyStart <= 2)
- {
- cs.keyStart = 0;
- //if (cs.keyStart == 1)
- //{
- // cs.keyStart = -1;
- //}
- return true;
- }
- #endregion
- break;
- case ' ':
- case '\r':
- case '\n'://[ "a",\r\n{} ]
- case '\0':
- case '\t':
- if (cs.keyStart <= 0 && cs.valueStart <= 0) //cs.jsonStart &&
- {
- return true;//璺宠繃绌烘牸銆�
- }
- break;
- default: //鍊煎紑澶淬�傘��
- if (c == '\\') //杞箟绗﹀彿
- {
- if (cs.escapeChar)
- {
- cs.escapeChar = false;
- }
- else
- {
- cs.escapeChar = true;
- return true;
- }
- }
- else
- {
- cs.escapeChar = false;
- }
- if (cs.jsonStart || cs.arrayStart) // Json 鎴栨暟缁勫紑濮嬩簡銆�
- {
- if (cs.keyStart <= 0 && cs.state == 0)
- {
- cs.keyStart = 1;//鏃犲紩鍙风殑
- }
- else if (cs.valueStart <= 0 && cs.state == 1 && cs.jsonStart)//鍙湁Json寮�濮嬫墠鏈夊�笺��
- {
- cs.valueStart = 1;//鏃犲紩鍙风殑
- }
- }
- break;
- }
- return false;
- }
-
- #endregion
-
- public static LinqExpressionType GetLinqCondition(this string stringType)
- {
- LinqExpressionType linqExpression;
- switch (stringType)
- {
- case HtmlElementType.Contains:
- linqExpression = LinqExpressionType.In;
- break;
- case HtmlElementType.ThanOrEqual:
- linqExpression = LinqExpressionType.ThanOrEqual;
- break;
- case HtmlElementType.LessOrequal:
- linqExpression = LinqExpressionType.LessThanOrEqual;
- break;
- case HtmlElementType.GT:
- linqExpression = LinqExpressionType.GreaterThan;
- break;
- case HtmlElementType.lt:
- linqExpression = LinqExpressionType.LessThan;
- break;
- case HtmlElementType.like:
- linqExpression = LinqExpressionType.Contains;
+锘縰sing NetTaste;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Web;
+using WIDESEA_Core.Const;
+using WIDESEA_Core.Enums;
+
+namespace WIDESEA_Core.Helper
+{
+ public static class UtilConvert
+ {
+ private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
+
+ private static long longTime = 621355968000000000;
+
+ private static int samllTime = 10000000;
+ /// <summary>
+ /// 鏃堕棿鎴宠浆鎹㈡垚鏃ユ湡
+ /// </summary>
+ /// <param name="timeStamp"></param>
+ /// <returns></returns>
+ public static DateTime GetTimeSpmpToDate(this object timeStamp)
+ {
+ if (timeStamp == null) return dateStart;
+ DateTime dateTime = new DateTime(longTime + Convert.ToInt64(timeStamp) * samllTime, DateTimeKind.Utc).ToLocalTime();
+ return dateTime;
+ }
+
+ public static string Serialize(this object obj, JsonSerializerSettings formatDate = null)
+ {
+ if (obj == null) return null;
+ formatDate = formatDate ?? new JsonSerializerSettings
+ {
+ DateFormatString = "yyyy-MM-dd HH:mm:ss"
+ };
+ return JsonConvert.SerializeObject(obj, formatDate);
+ }
+
+ public static T DeserializeObject<T>(this string json)
+ {
+ if (string.IsNullOrEmpty(json))
+ {
+ return default(T);
+ }
+ if (json == "{}")
+ {
+ json = "[]";
+ }
+ return JsonConvert.DeserializeObject<T>(json);
+ }
+
+ public static string FirstLetterToLower(this string thisValue)
+ {
+ if (string.IsNullOrEmpty(thisValue)) return string.Empty;
+ string result = thisValue.Substring(0, 1).ToLower() + thisValue.Substring(1, thisValue.Length - 1);
+ return result;
+ }
+
+ public static string FirstLetterToUpper(this string thisValue)
+ {
+ if (string.IsNullOrEmpty(thisValue)) return string.Empty;
+ string result = thisValue.Substring(0, 1).ToUpper() + thisValue.Substring(1, thisValue.Length - 1);
+ return result;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static int ObjToInt(this object thisValue)
+ {
+ int reval = 0;
+ if (thisValue == null) return 0;
+ if (thisValue is Enum && thisValue != DBNull.Value && Enum.TryParse(thisValue.GetType(), thisValue.ToString(), out var val))
+ {
+ return Convert.ToInt32(val.ChangeType(typeof(int)));
+ }
+ if (thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static int DoubleToInt(this double thisValue)
+ {
+ int reval = 0;
+
+ return Convert.ToInt32(thisValue);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <param name="errorValue"></param>
+ /// <returns></returns>
+ public static int ObjToInt(this object thisValue, int errorValue)
+ {
+ int reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ public static long ObjToLong(this object thisValue)
+ {
+ long reval = 0;
+ if (thisValue == null) return 0;
+ if (thisValue != DBNull.Value && long.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static double ObjToMoney(this object thisValue)
+ {
+ double reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <param name="errorValue"></param>
+ /// <returns></returns>
+ public static double ObjToMoney(this object thisValue, double errorValue)
+ {
+ double reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && double.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static string ObjToString(this object thisValue)
+ {
+ if (thisValue != null) return thisValue.ToString().Trim();
+ return "";
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static bool IsNotEmptyOrNull(this object thisValue)
+ {
+ return ObjToString(thisValue) != "" && ObjToString(thisValue) != "undefined" && ObjToString(thisValue) != "null";
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <param name="errorValue"></param>
+ /// <returns></returns>
+ public static string ObjToString(this object thisValue, string errorValue)
+ {
+ if (thisValue != null) return thisValue.ToString().Trim();
+ return errorValue;
+ }
+
+ public static bool IsNullOrEmpty(this object thisValue) => thisValue == null || thisValue == DBNull.Value || string.IsNullOrWhiteSpace(thisValue.ToString());
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static Decimal ObjToDecimal(this object thisValue)
+ {
+ Decimal reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <param name="errorValue"></param>
+ /// <returns></returns>
+ public static Decimal ObjToDecimal(this object thisValue, decimal errorValue)
+ {
+ Decimal reval = 0;
+ if (thisValue != null && thisValue != DBNull.Value && decimal.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static DateTime ObjToDate(this object thisValue)
+ {
+ DateTime reval = DateTime.MinValue;
+ if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
+ {
+ reval = Convert.ToDateTime(thisValue);
+ }
+
+ return reval;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <param name="errorValue"></param>
+ /// <returns></returns>
+ public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
+ {
+ DateTime reval = DateTime.MinValue;
+ if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return errorValue;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static bool ObjToBool(this object thisValue)
+ {
+ bool reval = false;
+ if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval))
+ {
+ return reval;
+ }
+
+ return reval;
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠鏃堕棿鐨勬椂闂存埑
+ /// </summary>
+ /// <param name="thisValue"></param>
+ /// <returns></returns>
+ public static string DateToTimeStamp(this DateTime thisValue)
+ {
+ TimeSpan ts = thisValue - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(ts.TotalSeconds).ToString();
+ }
+
+ public static object ChangeType(this object value, Type type)
+ {
+ if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
+ if (value == null) return null;
+ if (type == value.GetType()) return value;
+ if (type.IsEnum)
+ {
+ if (value is string)
+ return Enum.Parse(type, value as string);
+ else
+ return Enum.ToObject(type, value);
+ }
+
+ if (!type.IsInterface && type.IsGenericType)
+ {
+ Type innerType = type.GetGenericArguments()[0];
+ object innerValue = ChangeType(value, innerType);
+ return Activator.CreateInstance(type, new object[] { innerValue });
+ }
+
+ if (value is string && type == typeof(Guid)) return new Guid(value as string);
+ if (value is string && type == typeof(Version)) return new Version(value as string);
+ if (!(value is IConvertible)) return value;
+ return Convert.ChangeType(value, type);
+ }
+
+ public static object ChangeTypeList(this object value, Type type)
+ {
+ if (value == null) return default;
+
+ var gt = typeof(List<>).MakeGenericType(type);
+ dynamic lis = Activator.CreateInstance(gt);
+
+ var addMethod = gt.GetMethod("Add");
+ string values = value.ToString();
+ if (values != null && values.StartsWith("(") && values.EndsWith(")"))
+ {
+ string[] splits;
+ if (values.Contains("\",\""))
+ {
+ splits = values.Remove(values.Length - 2, 2)
+ .Remove(0, 2)
+ .Split("\",\"");
+ }
+ else
+ {
+ splits = values.Remove(0, 1)
+ .Remove(values.Length - 2, 1)
+ .Split(",");
+ }
+
+ foreach (var split in splits)
+ {
+ var str = split;
+ if (split.StartsWith("\"") && split.EndsWith("\""))
+ {
+ str = split.Remove(0, 1)
+ .Remove(split.Length - 2, 1);
+ }
+
+ addMethod.Invoke(lis, new object[] { ChangeType(str, type) });
+ }
+ }
+
+ return lis;
+ }
+
+ public static string ToJson(this object value)
+ {
+ return JsonConvert.SerializeObject(value);
+ }
+
+ public static bool IsNumeric(this object value)
+ {
+ if (value == null)
+ return false;
+ bool reslut = decimal.TryParse(value.ToString(), out decimal _number);
+ return reslut;
+ }
+
+ public static bool IsInt(this object obj)
+ {
+ if (obj == null)
+ return false;
+ bool reslut = Int32.TryParse(obj.ToString(), out int _number);
+ return reslut;
+
+ }
+ public static bool IsDate(this object str)
+ {
+ return str.IsDate(out _);
+ }
+ public static bool IsDate(this object str, out DateTime dateTime)
+ {
+ dateTime = DateTime.Now;
+ if (str == null || str.ToString() == "")
+ {
+ return false;
+ }
+ return DateTime.TryParse(str.ToString(), out dateTime);
+ }
+
+ /// <summary>
+ /// 鏍规嵁浼犲叆鏍煎紡鍒ゆ柇鏄惁涓哄皬鏁�
+ /// </summary>
+ /// <param name="str"></param>
+ /// <param name="formatString">18,5</param>
+ /// <returns></returns>
+ public static bool IsNumber(this string str, string formatString)
+ {
+ if (string.IsNullOrEmpty(str)) return false;
+
+ return Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$");
+ }
+
+ public static bool IsGuid(this string guid)
+ {
+ Guid newId;
+ return guid.GetGuid(out newId);
+ }
+
+ public static bool GetGuid(this string guid, out Guid outId)
+ {
+ Guid emptyId = Guid.Empty;
+ return Guid.TryParse(guid, out outId);
+ }
+
+ /// <summary>
+ /// 杞崲涓虹煭鏁村瀷 qy 2024-7-15
+ /// </summary>
+ /// <param name="data">鏁版嵁</param>
+ public static short ToShort(this object data)
+ {
+ if (data == null)
+ return 0;
+ short result;
+ var success = short.TryParse(data.ToString(), out result);
+ if (success)
+ return result;
+ try
+ {
+ return Convert.ToInt16(data);
+ }
+ catch (Exception)
+ {
+ return 0;
+ }
+ }
+
+ /// <summary>
+ /// 杞崲涓洪珮绮惧害娴偣鏁�,骞舵寜鎸囧畾鐨勫皬鏁颁綅4鑸�5鍏� qy 2024-7-15
+ /// </summary>
+ /// <param name="data">鏁版嵁</param>
+ /// <param name="digits">灏忔暟浣嶆暟</param>
+ public static decimal ToDecimal(this object data, int digits)
+ {
+ return Math.Round(ObjToDecimal(data), digits);
+ }
+
+
+
+ /// <summary>
+ /// 鏋氫妇杞琇ist qy 2024-7-15
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ public static List<object> GetEnumList<T>()
+ {
+ List<object> list = new List<object>();
+ var t = typeof(T);
+ foreach (var item in Enum.GetValues(typeof(T)))
+ {
+ FieldInfo f = t.GetField(Enum.GetName(typeof(T), item));
+ var r = (System.ComponentModel.DescriptionAttribute[])f.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
+ list.Add(new { ID = item, value = Enum.GetName(typeof(T), item), name = r[0].Description });
+ }
+ return list;
+ }
+
+ /// <summary>
+ /// 楠岃瘉鍔ㄦ�佺被鍨嬪厓绱犳槸鍚︿负绌� qy 2024-7-15
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns></returns>
+ public static bool CheckDynamic(object obj)
+ {
+ return (obj != null && Convert.ToString(obj) != "") ? true : false;
+ }
+
+ /// <summary>
+ /// 鍔ㄦ�佺被鍨嬪厓绱犺浆瀛楃涓插苟瑙g爜 qy 2024-7-15
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns></returns>
+ public static string DynamicToString(object obj)
+ {
+ return CheckDynamic(obj) ? HttpUtility.UrlDecode(Convert.ToString(obj).Trim()) : "";
+ }
+
+ /// <summary>
+ /// DataTable杞负json qy 2024-7-15
+ /// </summary>
+ /// <param name="parObjRefDataTable">DataTable</param>
+ /// <returns>json鏁版嵁</returns>
+ public static string ToJson(this DataTable parObjRefDataTable)
+ {
+ List<object> objArrList = new List<object>();
+
+ foreach (DataRow objDataRow in parObjRefDataTable.Rows)
+ {
+ Dictionary<string, object> objResult = new Dictionary<string, object>();
+
+ foreach (DataColumn objDataColumn in parObjRefDataTable.Columns)
+ objResult.Add(objDataColumn.ColumnName, objDataRow[objDataColumn].ToString());
+
+ objArrList.Add(objResult);
+ }
+
+ return ToJson(objArrList);
+ }
+ /// <summary>
+ /// Json杞琇ist qy 2024-7-15
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="parJson"></param>
+ /// <returns></returns>
+ public static List<T> JsonToList<T>(this string parJson)
+ {
+ if (string.IsNullOrWhiteSpace(parJson))
+ {
+ return new List<T>();
+ }
+ else
+ {
+ return JsonConvert.DeserializeObject<List<T>>(parJson);
+ }
+ }
+
+ /// <summary>
+ /// 鏃ユ湡杞负unix鍊�
+ /// </summary>
+ /// <param name="dt"></param>
+ /// <param name="utc">T:鎸塙TC鏃堕棿璁$畻(榛樿);F:鎸夋湰鍦版椂闂磋绠�</param>
+ /// <returns></returns>
+ /// <summary>
+ /// 鏃ユ湡杞负unix鍊�
+ /// </summary>
+ /// <param name="dt">鏃ユ湡鏃堕棿</param>
+ /// <param name="utc">T:鎸塙TC鏃堕棿璁$畻(榛樿);F:鎸夋湰鍦版椂闂磋绠�</param>
+ /// <returns></returns>
+ public static double ToUnix(this DateTime dt, bool utc = true)
+ {
+ double intResult = 0;
+ System.DateTime startTime = TimeZoneInfo.ConvertTime(new System.DateTime(1970, 1, 1), TimeZoneInfo.Utc, TimeZoneInfo.Local);
+ intResult = (dt - startTime).TotalSeconds;
+ intResult = Math.Round(intResult, 0);
+ return intResult;
+ }
+
+ #region 鍒ゆ柇鏄惁涓哄瓧绗︿覆 qy 2024-7-15
+ /// <summary>
+ /// 鍒ゆ柇瀛楃涓叉槸鍚︿负鍚堟硶鐨刯son瀛楃涓� qy 2024-7-15
+ /// </summary>
+ /// <param name="json"></param>
+ /// <returns></returns>
+ public static bool IsJson(string json)
+ {
+ int errIndex;
+ return IsJson(json, out errIndex);
+ }
+ public static bool IsJson(string json, out int errIndex)
+ {
+ errIndex = 0;
+ if (IsJsonStart(ref json))
+ {
+ CharState cs = new CharState();
+ char c;
+ for (int i = 0; i < json.Length; i++)
+ {
+ c = json[i];
+ if (SetCharState(c, ref cs) && cs.childrenStart)//璁剧疆鍏抽敭绗﹀彿鐘舵�併��
+ {
+ string item = json.Substring(i);
+ int err;
+ int length = GetValueLength(item, true, out err);
+ cs.childrenStart = false;
+ if (err > 0)
+ {
+ errIndex = i + err;
+ return false;
+ }
+ i = i + length - 1;
+ }
+ if (cs.isError)
+ {
+ errIndex = i;
+ return false;
+ }
+ }
+
+ return !cs.arrayStart && !cs.jsonStart;
+ }
+ return false;
+ }
+
+ private static bool IsJsonStart(ref string json)
+ {
+ if (!string.IsNullOrEmpty(json))
+ {
+ json = json.Trim('\r', '\n', ' ');
+ if (json.Length > 1)
+ {
+ char s = json[0];
+ char e = json[json.Length - 1];
+ return (s == '{' && e == '}') || (s == '[' && e == ']');
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍊肩殑闀垮害锛堝綋Json鍊煎祵濂椾互"{"鎴�"["寮�澶存椂锛� qy 2024-7-15
+ /// </summary>
+ private static int GetValueLength(string json, bool breakOnErr, out int errIndex)
+ {
+ errIndex = 0;
+ int len = 0;
+ if (!string.IsNullOrEmpty(json))
+ {
+ CharState cs = new CharState();
+ char c;
+ for (int i = 0; i < json.Length; i++)
+ {
+ c = json[i];
+ if (!SetCharState(c, ref cs))//璁剧疆鍏抽敭绗﹀彿鐘舵�併��
+ {
+ if (!cs.jsonStart && !cs.arrayStart)//json缁撴潫锛屽張涓嶆槸鏁扮粍锛屽垯閫�鍑恒��
+ {
+ break;
+ }
+ }
+ else if (cs.childrenStart)//姝e父瀛楃锛屽�肩姸鎬佷笅銆�
+ {
+ int length = GetValueLength(json.Substring(i), breakOnErr, out errIndex);//閫掑綊瀛愬�硷紝杩斿洖涓�涓暱搴︺�傘�傘��
+ cs.childrenStart = false;
+ cs.valueStart = 0;
+ //cs.state = 0;
+ i = i + length - 1;
+ }
+ if (breakOnErr && cs.isError)
+ {
+ errIndex = i;
+ return i;
+ }
+ if (!cs.jsonStart && !cs.arrayStart)//璁板綍褰撳墠缁撴潫浣嶇疆銆�
+ {
+ len = i + 1;//闀垮害姣旂储寮�+1
+ break;
+ }
+ }
+ }
+ return len;
+ }
+
+ /// <summary>
+ /// 瀛楃鐘舵�� qy 2024-7-15
+ /// </summary>
+ private class CharState
+ {
+ internal bool jsonStart = false;//浠� "{"寮�濮嬩簡...
+ internal bool setDicValue = false;// 鍙互璁剧疆瀛楀吀鍊间簡銆�
+ internal bool escapeChar = false;//浠�"\"杞箟绗﹀彿寮�濮嬩簡
+ /// <summary>
+ /// 鏁扮粍寮�濮嬨�愪粎绗竴寮�澶存墠绠椼�戯紝鍊煎祵濂楃殑浠ャ�恈hildrenStart銆戞潵鏍囪瘑銆�
+ /// </summary>
+ internal bool arrayStart = false;//浠�"[" 绗﹀彿寮�濮嬩簡
+ internal bool childrenStart = false;//瀛愮骇宓屽寮�濮嬩簡銆�
+ /// <summary>
+ /// 銆�0 鍒濆鐘舵�侊紝鎴� 閬囧埌鈥�,鈥濋�楀彿銆戯紱銆�1 閬囧埌鈥滐細鈥濆啋鍙枫��
+ /// </summary>
+ internal int state = 0;
+
+ /// <summary>
+ /// 銆�-1 鍙栧�肩粨鏉熴�戙��0 鏈紑濮嬨�戙��1 鏃犲紩鍙峰紑濮嬨�戙��2 鍗曞紩鍙峰紑濮嬨�戙��3 鍙屽紩鍙峰紑濮嬨��
+ /// </summary>
+ internal int keyStart = 0;
+ /// <summary>
+ /// 銆�-1 鍙栧�肩粨鏉熴�戙��0 鏈紑濮嬨�戙��1 鏃犲紩鍙峰紑濮嬨�戙��2 鍗曞紩鍙峰紑濮嬨�戙��3 鍙屽紩鍙峰紑濮嬨��
+ /// </summary>
+ internal int valueStart = 0;
+ internal bool isError = false;//鏄惁璇硶閿欒銆�
+
+ internal void CheckIsError(char c)//鍙綋鎴愪竴绾у鐞嗭紙鍥犱负GetLength浼氶�掑綊鍒版瘡涓�涓瓙椤瑰鐞嗭級
+ {
+ if (keyStart > 1 || valueStart > 1)
+ {
+ return;
+ }
+ //绀轰緥 ["aa",{"bbbb":123,"fff","ddd"}]
+ switch (c)
+ {
+ case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}]
+ isError = jsonStart && state == 0;//閲嶅寮�濮嬮敊璇� 鍚屾椂涓嶆槸鍊煎鐞嗐��
+ break;
+ case '}':
+ isError = !jsonStart || (keyStart != 0 && state == 0);//閲嶅缁撴潫閿欒 鎴栬�� 鎻愬墠缁撴潫{"aa"}銆傛甯哥殑鏈墈}
+ break;
+ case '[':
+ isError = arrayStart && state == 0;//閲嶅寮�濮嬮敊璇�
+ break;
+ case ']':
+ isError = !arrayStart || jsonStart;//閲嶅寮�濮嬮敊璇� 鎴栬�� Json 鏈粨鏉�
+ break;
+ case '"':
+ case '\'':
+ isError = !(jsonStart || arrayStart); //json 鎴栨暟缁勫紑濮嬨��
+ if (!isError)
+ {
+ //閲嶅寮�濮� [""",{"" "}]
+ isError = (state == 0 && keyStart == -1) || (state == 1 && valueStart == -1);
+ }
+ if (!isError && arrayStart && !jsonStart && c == '\'')//['aa',{}]
+ {
+ isError = true;
+ }
+ break;
+ case ':':
+ isError = !jsonStart || state == 1;//閲嶅鍑虹幇銆�
+ break;
+ case ',':
+ isError = !(jsonStart || arrayStart); //json 鎴栨暟缁勫紑濮嬨��
+ if (!isError)
+ {
+ if (jsonStart)
+ {
+ isError = state == 0 || (state == 1 && valueStart > 1);//閲嶅鍑虹幇銆�
+ }
+ else if (arrayStart)//["aa,] [,] [{},{}]
+ {
+ isError = keyStart == 0 && !setDicValue;
+ }
+ }
+ break;
+ case ' ':
+ case '\r':
+ case '\n'://[ "a",\r\n{} ]
+ case '\0':
+ case '\t':
+ break;
+ default: //鍊煎紑澶淬�傘��
+ isError = (!jsonStart && !arrayStart) || (state == 0 && keyStart == -1) || (valueStart == -1 && state == 1);//
+ break;
+ }
+ //if (isError)
+ //{
+
+ //}
+ }
+ }
+ /// <summary>
+ /// 璁剧疆瀛楃鐘舵��(杩斿洖true鍒欎负鍏抽敭璇嶏紝杩斿洖false鍒欏綋涓烘櫘閫氬瓧绗﹀鐞嗭級 qy 2024-7-15
+ /// </summary>
+ private static bool SetCharState(char c, ref CharState cs)
+ {
+ cs.CheckIsError(c);
+ switch (c)
+ {
+ case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}]
+ #region 澶ф嫭鍙�
+ if (cs.keyStart <= 0 && cs.valueStart <= 0)
+ {
+ cs.keyStart = 0;
+ cs.valueStart = 0;
+ if (cs.jsonStart && cs.state == 1)
+ {
+ cs.childrenStart = true;
+ }
+ else
+ {
+ cs.state = 0;
+ }
+ cs.jsonStart = true;//寮�濮嬨��
+ return true;
+ }
+ #endregion
+ break;
+ case '}':
+ #region 澶ф嫭鍙风粨鏉�
+ if (cs.keyStart <= 0 && cs.valueStart < 2 && cs.jsonStart)
+ {
+ cs.jsonStart = false;//姝e父缁撴潫銆�
+ cs.state = 0;
+ cs.keyStart = 0;
+ cs.valueStart = 0;
+ cs.setDicValue = true;
+ return true;
+ }
+ // cs.isError = !cs.jsonStart && cs.state == 0;
+ #endregion
+ break;
+ case '[':
+ #region 涓嫭鍙峰紑濮�
+ if (!cs.jsonStart)
+ {
+ cs.arrayStart = true;
+ return true;
+ }
+ else if (cs.jsonStart && cs.state == 1)
+ {
+ cs.childrenStart = true;
+ return true;
+ }
+ #endregion
+ break;
+ case ']':
+ #region 涓嫭鍙风粨鏉�
+ if (cs.arrayStart && !cs.jsonStart && cs.keyStart <= 2 && cs.valueStart <= 0)//[{},333]//杩欐牱缁撴潫銆�
+ {
+ cs.keyStart = 0;
+ cs.valueStart = 0;
+ cs.arrayStart = false;
+ return true;
+ }
+ #endregion
+ break;
+ case '"':
+ case '\'':
+ #region 寮曞彿
+ if (cs.jsonStart || cs.arrayStart)
+ {
+ if (cs.state == 0)//key闃舵,鏈夊彲鑳芥槸鏁扮粍["aa",{}]
+ {
+ if (cs.keyStart <= 0)
+ {
+ cs.keyStart = (c == '"' ? 3 : 2);
+ return true;
+ }
+ else if ((cs.keyStart == 2 && c == '\'') || (cs.keyStart == 3 && c == '"'))
+ {
+ if (!cs.escapeChar)
+ {
+ cs.keyStart = -1;
+ return true;
+ }
+ else
+ {
+ cs.escapeChar = false;
+ }
+ }
+ }
+ else if (cs.state == 1 && cs.jsonStart)//鍊奸樁娈靛繀椤绘槸Json寮�濮嬩簡銆�
+ {
+ if (cs.valueStart <= 0)
+ {
+ cs.valueStart = (c == '"' ? 3 : 2);
+ return true;
+ }
+ else if ((cs.valueStart == 2 && c == '\'') || (cs.valueStart == 3 && c == '"'))
+ {
+ if (!cs.escapeChar)
+ {
+ cs.valueStart = -1;
+ return true;
+ }
+ else
+ {
+ cs.escapeChar = false;
+ }
+ }
+
+ }
+ }
+ #endregion
+ break;
+ case ':':
+ #region 鍐掑彿
+ if (cs.jsonStart && cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 0)
+ {
+ if (cs.keyStart == 1)
+ {
+ cs.keyStart = -1;
+ }
+ cs.state = 1;
+ return true;
+ }
+ // cs.isError = !cs.jsonStart || (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1);
+ #endregion
+ break;
+ case ',':
+ #region 閫楀彿 //["aa",{aa:12,}]
+
+ if (cs.jsonStart)
+ {
+ if (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1)
+ {
+ cs.state = 0;
+ cs.keyStart = 0;
+ cs.valueStart = 0;
+ //if (cs.valueStart == 1)
+ //{
+ // cs.valueStart = 0;
+ //}
+ cs.setDicValue = true;
+ return true;
+ }
+ }
+ else if (cs.arrayStart && cs.keyStart <= 2)
+ {
+ cs.keyStart = 0;
+ //if (cs.keyStart == 1)
+ //{
+ // cs.keyStart = -1;
+ //}
+ return true;
+ }
+ #endregion
+ break;
+ case ' ':
+ case '\r':
+ case '\n'://[ "a",\r\n{} ]
+ case '\0':
+ case '\t':
+ if (cs.keyStart <= 0 && cs.valueStart <= 0) //cs.jsonStart &&
+ {
+ return true;//璺宠繃绌烘牸銆�
+ }
+ break;
+ default: //鍊煎紑澶淬�傘��
+ if (c == '\\') //杞箟绗﹀彿
+ {
+ if (cs.escapeChar)
+ {
+ cs.escapeChar = false;
+ }
+ else
+ {
+ cs.escapeChar = true;
+ return true;
+ }
+ }
+ else
+ {
+ cs.escapeChar = false;
+ }
+ if (cs.jsonStart || cs.arrayStart) // Json 鎴栨暟缁勫紑濮嬩簡銆�
+ {
+ if (cs.keyStart <= 0 && cs.state == 0)
+ {
+ cs.keyStart = 1;//鏃犲紩鍙风殑
+ }
+ else if (cs.valueStart <= 0 && cs.state == 1 && cs.jsonStart)//鍙湁Json寮�濮嬫墠鏈夊�笺��
+ {
+ cs.valueStart = 1;//鏃犲紩鍙风殑
+ }
+ }
+ break;
+ }
+ return false;
+ }
+
+ #endregion
+
+ public static LinqExpressionType GetLinqCondition(this string stringType)
+ {
+ LinqExpressionType linqExpression;
+ switch (stringType)
+ {
+ case HtmlElementType.Contains:
+ linqExpression = LinqExpressionType.In;
+ break;
+ case HtmlElementType.ThanOrEqual:
+ linqExpression = LinqExpressionType.ThanOrEqual;
+ break;
+ case HtmlElementType.LessOrequal:
+ linqExpression = LinqExpressionType.LessThanOrEqual;
+ break;
+ case HtmlElementType.GT:
+ linqExpression = LinqExpressionType.GreaterThan;
+ break;
+ case HtmlElementType.lt:
+ linqExpression = LinqExpressionType.LessThan;
+ break;
+ case HtmlElementType.like:
+ linqExpression = LinqExpressionType.Contains;
break;
case HtmlElementType.thanorequal:
linqExpression = LinqExpressionType.ThanOrEqual;
break;
case HtmlElementType.lessorequal:
linqExpression = LinqExpressionType.LessThanOrEqual;
- break;
+ break;
case HtmlElementType.notequal:
linqExpression = LinqExpressionType.NotEqual;
- break;
- default:
- linqExpression = LinqExpressionType.Equal;
- break;
- }
- return linqExpression;
- }
- }
-}
+ break;
+ default:
+ linqExpression = LinqExpressionType.Equal;
+ break;
+ }
+ return linqExpression;
+ }
+ }
+}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
index 10f0047..227c7cf 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -257,12 +257,12 @@
// 绌烘墭鐩樹篃鏈夊簱瀛樿褰曪紝鍙槸涓嶅寘鍚槑缁�
item.PalletCode = stockInfo.PalletCode;
item.StockStatus = stockInfo.StockStatus; // 鐩存帴浣跨敤鍚庣搴撳瓨鐘舵��
-
+
// 鍙湁褰揇etails涓嶄负null涓旀湁鏁版嵁鏃舵墠澶勭悊搴撳瓨鏄庣粏
if (stockInfo.Details != null && stockInfo.Details.Any())
{
item.StockQuantity = stockInfo.Details.Sum(d => d.StockQuantity);
-
+ item.OutboundDate = stockInfo.OutboundDate;
// 鑾峰彇绗竴涓槑缁嗙殑鐗╂枡淇℃伅锛堝鏋滃瓨鍦級
var firstDetail = stockInfo.Details.FirstOrDefault();
if (firstDetail != null)
@@ -278,6 +278,7 @@
Id = d.Id,
MaterielCode = d.MaterielCode,
MaterielName = d.MaterielName,
+ SerialNumber = d.SerialNumber,
BatchNo = d.BatchNo,
StockQuantity = d.StockQuantity,
Unit = d.Unit,
--
Gitblit v1.9.3