From 65b5b0ced6d04f773002908cb8c0720540f34907 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 10 四月 2025 09:20:17 +0800
Subject: [PATCH] 1
---
代码管理/NEWCode/WIDESEAWCS_PDA/pages/叫料/负极叫料.vue | 45 +++--
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 15 +
代码管理/NEWCode/WIDESEAWCS_PDA/pages.json | 7
代码管理/NEWCode/WIDESEAWCS_PDA/pages/叫料/正极叫料.vue | 1
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 15 +
代码管理/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js | 13 +
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 6
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs | 61 ++++++
代码管理/NEWCode/WIDESEAWCS_PDA/pages/SetAddress/SetAddress.vue | 133 ++++++++++++++++
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/CZTaskDto.cs | 30 +++
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/PDA/PDAController.cs | 4
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskCZService.cs | 8 +
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 109 ++++++++----
代码管理/NEWCode/WIDESEAWCS_PDA/pages/home/home.vue | 8
14 files changed, 388 insertions(+), 67 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
index e3caf08..9b5c711 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/common/http.interceptor.js"
@@ -16,7 +16,18 @@
if (config.url.includes('http://') || config.url.includes('https://')) {
config.baseURL = '';
} else {
- config.baseURL = baseUrl;
+ uni.getStorage({
+ key: 'storage_key_ipAddress',
+ success: (res) => {
+ debugger;
+ console.log(res.data.WCSIP);
+ config.baseURL = res.data.WCSIP;
+ },
+ fail: (err) => {
+ console.log("娌℃湁鎵惧埌瀛樺偍鐨処P鍦板潃,浣跨敤榛樿BaseURL")
+ config.baseURL = baseUrl;
+ },
+ });
}
config.header.Token = 'xxxxxx';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages.json"
index 99ce8a4..67c6ebc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages.json"
@@ -39,6 +39,13 @@
"enablePullDownRefresh": false
}
+ },
+ {
+ "path" : "pages/SetAddress/SetAddress",
+ "style" :
+ {
+ "navigationBarTitleText" : "璁剧疆鍦板潃"
+ }
}
],
"globalStyle": {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/SetAddress/SetAddress.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/SetAddress/SetAddress.vue"
new file mode 100644
index 0000000..15ca763
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/SetAddress/SetAddress.vue"
@@ -0,0 +1,133 @@
+<template>
+ <view class="example">
+ <u-form :model="valiFormData" ref="uForm" label-width="180" label-align="right">
+ <u-form-item label="WCSIP:" prop="WCSIP">
+ <u-input v-model="valiFormData.WCSIP" />
+ </u-form-item>
+ <u-form-item label="鍒涙櫤姝f瀬IP:" prop="CZZJip">
+ <u-input v-model="valiFormData.CZZJip" />
+ </u-form-item>
+ <u-form-item label="鍒涙櫤璐熸瀬IP:" prop="CZFJiP">
+ <u-input v-model="valiFormData.CZFJiP" />
+ </u-form-item>
+ </u-form>
+ <u-button @click="submit" type="success">鎻愪氦</u-button>
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ // 鏍¢獙琛ㄥ崟鏁版嵁
+ valiFormData: {},
+ rules: {
+ WCSIP: [{
+ required: true,
+ message: '璇疯緭鍏CSIP',
+ // 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+ trigger: ['change', 'blur'],
+ }, {
+ // 鑷畾涔塙RL鏍¢獙鍑芥暟
+ validator: (rule, value, callback) => {
+ // 绠�鍗曠殑URL姝e垯琛ㄨ揪寮忥紝鍙牴鎹渶姹傝皟鏁�
+ const urlPattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
+ if (value && !urlPattern.test(value)) {
+ callback(new Error('璇疯緭鍏ユ湁鏁堢殑URL鍦板潃'));
+ } else {
+ callback();
+ }
+ },
+ trigger: ['change', 'blur']
+ }],
+ CZZJip: [{
+ required: true,
+ message: '璇疯緭鍏ュ垱鏅烘鏋両P',
+ // 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+ trigger: ['change', 'blur'],
+ }, {
+ // 鑷畾涔塙RL鏍¢獙鍑芥暟
+ validator: (rule, value, callback) => {
+ // 绠�鍗曠殑URL姝e垯琛ㄨ揪寮忥紝鍙牴鎹渶姹傝皟鏁�
+ const urlPattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
+ if (value && !urlPattern.test(value)) {
+ callback(new Error('璇疯緭鍏ユ湁鏁堢殑URL鍦板潃'));
+ } else {
+ callback();
+ }
+ },
+ trigger: ['change', 'blur']
+ }],
+ CZFJiP: [{
+ required: true,
+ message: '璇疯緭鍏ュ垱鏅鸿礋鏋両P',
+ // 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+ trigger: ['change', 'blur'],
+ }, {
+ // 鑷畾涔塙RL鏍¢獙鍑芥暟
+ validator: (rule, value, callback) => {
+ // 绠�鍗曠殑URL姝e垯琛ㄨ揪寮忥紝鍙牴鎹渶姹傝皟鏁�
+ const urlPattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
+ if (value && !urlPattern.test(value)) {
+ callback(new Error('璇疯緭鍏ユ湁鏁堢殑URL鍦板潃'));
+ } else {
+ callback();
+ }
+ },
+ trigger: ['change', 'blur']
+ }]
+ }
+ };
+ },
+ methods: {
+ submit() {
+ this.$refs.uForm.validate().then(res => {
+ const ipAddress = {
+ WCSIP: this.valiFormData.WCSIP,
+ CZZJip: this.valiFormData.CZZJip,
+ CZFJiP: this.valiFormData.CZFJiP,
+ }
+ uni.setStorage({
+ key: 'storage_key_ipAddress',
+ data: ipAddress,
+ success: (res) => {
+ this.$t.message.toast('淇濆瓨鎴愬姛');
+ uni.switchTab({
+ url: '/pages/index/index'
+ })
+ }
+ });
+ }).catch(errors => {
+ console.log('鏍¢獙澶辫触', errors)
+ })
+ },
+ setModel() {
+ uni.getStorage({
+ key: 'storage_key_ipAddress',
+ success: (res) => {
+ console.log(res.data.WCSIP);
+ this.valiFormData.WCSIP = res.data.WCSIP
+ this.valiFormData.CZZJip = res.data.CZZJip
+ this.valiFormData.CZFJiP = res.data.CZFJiP
+ this.valiFormData = res.data
+ },
+ fail: (err) => {
+ console.log("娌℃湁鎵惧埌瀛樺偍鐨処P鍦板潃,璇烽噸鏂拌緭鍏�")
+ },
+ });
+ }
+ },
+ // 蹇呴』瑕佸湪onReady鐢熷懡鍛ㄦ湡锛屽洜涓簅nLoad鐢熷懡鍛ㄦ湡缁勪欢鍙兘灏氭湭鍒涘缓瀹屾瘯
+ onReady() {
+ this.$refs.uForm.setRules(this.rules);
+ this.setModel();
+ },
+ }
+</script>
+
+<style lang="scss">
+ .example {
+ padding: 15px;
+ background-color: #fff;
+ }
+</style>
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/home/home.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/home/home.vue"
index e8d69f3..de25e87 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/home/home.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/home/home.vue"
@@ -2,7 +2,7 @@
<view class="mine">
<view class="tools">
<uni-icons type="scan" size="48rpx" color="#292C39" @click="doScan"></uni-icons>
- <uni-icons type="gear-filled" size="48rpx" color="#292C39"></uni-icons>
+ <uni-icons type="gear-filled" size="48rpx" color="#292C39" @click="goSetAddress"></uni-icons>
</view>
<view class="header">
<view class="header-user">
@@ -189,6 +189,12 @@
}
})
}
+
+ //璺宠浆鍒癝etAddress椤甸潰
+ ,
+ goSetAddress() {
+ this.$u.route('/pages/SetAddress/SetAddress');
+ },
},
};
</script>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\346\255\243\346\236\201\345\217\253\346\226\231.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\346\255\243\346\236\201\345\217\253\346\226\231.vue"
index 1c7fc0a..837fd36 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\346\255\243\346\236\201\345\217\253\346\226\231.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\346\255\243\346\236\201\345\217\253\346\226\231.vue"
@@ -146,6 +146,7 @@
OrderNo: orderNo,
Number: availableQuantity > 4 ? 4 : availableQuantity,
InputValue: inputValue,
+ TaskType: "姝f瀬"
// ...鍏朵粬闇�瑕佷紶閫掔殑鍙傛暟
};
this.$u.post('/api/PDA/AddCZTask', formDataParam).then(res => {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\350\264\237\346\236\201\345\217\253\346\226\231.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\350\264\237\346\236\201\345\217\253\346\226\231.vue"
index aa553e5..afe0010 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\350\264\237\346\236\201\345\217\253\346\226\231.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_PDA/pages/\345\217\253\346\226\231/\350\264\237\346\236\201\345\217\253\346\226\231.vue"
@@ -92,22 +92,34 @@
}
},
submit(cb) {
- this.$t.message.loading();
- let formDataParam = {
- current: this.current,
- size: this.size
- };
- // 浣跨敤鍒涙櫤瀹屾暣鎺ュ彛
- this.$u.post('/api/PDA/AGVPage', null).then(res => {
- console.log(res);
- this.$t.message.closeLoading();
- cb && cb();
- if (cb != null) this.listData = [];
- this.listData = [...this.listData, ...res.data];
- console.log(this.listData);
- }).catch((err) => {
- this.$t.message.toast(err.message);
+ uni.getStorage({
+ key: 'storage_key_ipAddress',
+ success: (res) => {
+ this.$t.message.loading();
+ let formDataParam = {
+ current: this.current,
+ size: this.size
+ };
+ // 浣跨敤鍒涙櫤瀹屾暣鎺ュ彛
+ this.$u.post(res.data.CZFJiP, null).then(res => {
+ console.log(res);
+ this.$t.message.closeLoading();
+ cb && cb();
+ if (cb != null) this.listData = [];
+ this.listData = [...this.listData, ...res.data];
+ console.log(this.listData);
+ }).catch((err) => {
+ this.$t.message.toast(err.message);
+ });
+ },
+ fail: (err) => {
+ this.$t.message.toast('璇峰厛璁剧疆IP鍦板潃');
+ uni.navigateTo({
+ url: '/pages/SetAddress/SetAddress',
+ });
+ },
});
+
},
clickLoadMore(e) {
this.status = 'loading';
@@ -146,9 +158,10 @@
OrderNo: orderNo,
Number: availableQuantity > 4 ? 4 : availableQuantity,
InputValue: inputValue,
+ TaskType: "璐熸瀬"
// ...鍏朵粬闇�瑕佷紶閫掔殑鍙傛暟
};
-
+
// 浣跨敤鍒涙櫤瀹屾暣鎺ュ彛
this.$u.post('/api/PDA/insertTask', formDataParam).then(res => {
if (res.status) {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/CZTaskDto.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/CZTaskDto.cs"
index ba6e21e..a256fb1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/CZTaskDto.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/CZTaskDto.cs"
@@ -38,4 +38,32 @@
/// </summary>
public string TaskType { get; set; }
}
-}
+
+ public class CZTaskFinshDto
+ {
+ /// <summary>
+ /// 浠诲姟ID
+ /// </summary>
+ public string TaskId { get; set; }
+
+ /// <summary>
+ /// 浜у搧鍨嬪彿
+ /// </summary>
+ public string ProductCode { get; set; }
+
+ /// <summary>
+ /// 宸ュ崟鍙�
+ /// </summary>
+ public string OrderNo { get; set; }
+
+ /// <summary>
+ /// 鏁伴噺
+ /// </summary>
+ public int FinishNum { get; set; }
+
+ /// <summary>
+ /// 鍙枡鏈哄彴
+ /// </summary>
+ public string Tags { get; set; }
+ }
+}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskCZService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskCZService.cs"
index dd629f6..50558a3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskCZService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskCZService.cs"
@@ -34,5 +34,13 @@
public interface ITaskCZService : IService<DtCZTask>
{
public Task<WebResponseContent> AddTaskCZAsync(CZTaskDto dto);
+
+
+ /// <summary>
+ /// 瀹屾垚浠诲姟
+ /// </summary>
+ /// <param name="dto"></param>
+ /// <returns></returns>
+ public Task<WebResponseContent> FinishTask(CZTaskFinshDto dto);
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index a6002ad..ad7d5ec 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -182,5 +182,11 @@
/// <param name="taskNum">浠诲姟鍙�</param>
/// <returns>杩斿洖澶勭悊缁撴灉</returns>
WebResponseContent RollbackTaskStatusToLast(int taskNum);
+
+ /// <summary>
+ /// 鑾峰彇浠诲姟鍙�
+ /// </summary>
+ /// <returns></returns>
+ public int GetTaskNum();
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/PDA/PDAController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/PDA/PDAController.cs"
index b8dc811..1e2307b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/PDA/PDAController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/PDA/PDAController.cs"
@@ -39,9 +39,9 @@
}
[HttpPost, Route("AddCZTask"), AllowAnonymous]
- public WebResponseContent AddCZTask([FromBody] CZTaskDto czTaskDto)
+ public Task<WebResponseContent> AddCZTask([FromBody] CZTaskDto czTaskDto)
{
- return WebResponseContent.Instance.OK();
+ return _taskCZService.AddTaskCZAsync(czTaskDto);
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index 7515054..fa26d39 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -6,6 +6,7 @@
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_TaskInfoService;
namespace WIDESEAWCS_WCSServer.Controllers.Task
{
@@ -14,11 +15,18 @@
public class TaskController : ApiBaseController<ITaskService, Dt_Task>
{
private readonly IHttpContextAccessor _httpContextAccessor;
- public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor) : base(service)
+ private readonly ITaskCZService _taskInfoService;
+ public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, ITaskCZService taskInfoService) : base(service)
{
_httpContextAccessor = httpContextAccessor;
+ _taskInfoService = taskInfoService;
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="taskDTOs"></param>
+ /// <returns></returns>
[HttpPost, Route("ReceiveTask"), AllowAnonymous]
public WebResponseContent ReceiveWMSTask([FromBody] List<WMSTaskDTO> taskDTOs)
{
@@ -48,5 +56,10 @@
{
return Service.RollbackTaskStatusToLast(taskNum);
}
+
+ public Task<WebResponseContent> FinishTask(CZTaskFinshDto taskFinshDto)
+ {
+ return _taskInfoService.FinishTask(taskFinshDto);
+ }
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
index 9a62871..edd5122 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
@@ -1,4 +1,5 @@
锘�#region << 鐗� 鏈� 娉� 閲� >>
+
/*----------------------------------------------------------------
* 鍛藉悕绌洪棿锛歐IDESEAWCS_TaskInfoService
* 鍒涘缓鑰咃細鑳$搴�
@@ -11,13 +12,11 @@
* 淇敼鏃堕棿锛�
* 鐗堟湰锛歏1.0.1
* 淇敼璇存槑锛�
- *
+ *
*----------------------------------------------------------------*/
+
#endregion << 鐗� 鏈� 娉� 閲� >>
-using AutoMapper;
-using SqlSugar;
-using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
@@ -25,8 +24,6 @@
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_QuartzJob.Models;
-using WIDESEAWCS_QuartzJob.Service;
namespace WIDESEAWCS_TaskInfoService
{
@@ -75,5 +72,55 @@
}
return Task.FromResult(response);
}
+
+ /// <summary>
+ /// 瀹屾垚浠诲姟
+ /// </summary>
+ /// <param name="dto"></param>
+ /// <returns></returns>
+ public Task<WebResponseContent> FinishTask(CZTaskFinshDto dto)
+ {
+ WebResponseContent response = new WebResponseContent();
+ try
+ {
+ var czTask = BaseDal.QueryFirst(x => x.TaskTaskID == dto.TaskId);
+ if (czTask == null)
+ {
+ response.Error("浠诲姟涓嶅瓨鍦紒");
+ return Task.FromResult(response);
+ }
+ if (dto.Tags.Contains("姝f瀬"))
+ {
+ czTask.TaskZJFinishNumber += 1;
+ }
+ else
+ {
+ czTask.TaskFJFinishNumber += 1;
+ }
+ if (czTask.TaskZJFinishNumber == czTask.TaskNumber || czTask.TaskFJFinishNumber == czTask.TaskNumber)
+ {
+ czTask.TaskStatus = TaskInStatusEnum.InFinish.ToString();
+ czTask.TaskEndDate = DateTime.Now;
+ }
+ else
+ {
+ czTask.TaskStatus = TaskInStatusEnum.Line_InExecuting.ToString();
+ }
+ var isTrue = BaseDal.UpdateData(czTask);
+ if (isTrue)
+ {
+ response.OK("浠诲姟瀹屾垚鎴愬姛锛�");
+ }
+ else
+ {
+ response.Error("浠诲姟瀹屾垚澶辫触锛�");
+ }
+ }
+ catch (Exception ex)
+ {
+ response.Error(ex.Message);
+ }
+ return Task.FromResult(response);
+ }
}
-}
+}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 911d6f0..a62b9fa 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -585,5 +585,20 @@
}
return content;
}
+
+ private readonly object _lockObj = new object();
+ /// <summary>
+ /// 鑾峰彇浠诲姟鍙�
+ /// </summary>
+ /// <returns></returns>
+ public int GetTaskNum()
+ {
+ int taskNum = 0;
+ lock (_lockObj)
+ {
+ taskNum = Db.Ado.SqlQuerySingle<int>("select next value for dbo.GetTaskNum");
+ }
+ return taskNum;
+ }
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index f82ab1f..7ee7a24 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -24,8 +24,10 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -39,74 +41,105 @@
public class CommonConveyorLineJob : JobBase, IJob, IDisposable
{
private readonly ITaskService _taskService;
+ private readonly ITaskRepository _taskRepository;
+ private readonly ITaskCZRepository _taskCZRepository;
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly IRouterService _routerService;
private readonly IMapper _mapper;
- public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper)
+ public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, ITaskCZRepository taskCZRepository)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
_routerService = routerService;
_mapper = mapper;
+ _taskRepository = taskRepository;
+ _taskCZRepository = taskCZRepository;
}
public Task Execute(IJobExecutionContext context)
{
- //Console.Out.WriteLine(DateTime.Now);
try
{
+ // 浠庝笂涓嬫枃涓幏鍙� JobParams 骞惰浆鎹负 CommonConveyorLine 绫诲瀷
CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
- if (conveyorLine != null)
+ if (conveyorLine == null)
{
- short[] values = conveyorLine.Communicator.Read<short>("DB2.0", 20);
-
- //bool result = conveyorLine.Communicator.Write("DB1.0", "AAABBB");
- //string testVal = conveyorLine.Communicator.Read<string>("DB1.0");
-
- List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
- List<Task> tasks = new List<Task>();
- foreach (string childDeviceCode in childDeviceCodes)
- {
- //Task task = Task.Run(() =>
- //{
- ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
- if (command != null)
- {
- DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal));
- if (deviceProtocolDetail != null)
- {
- MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType);
- if (method != null)
- {
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
- }
- else
- {
- //todo 鏈壘鍒版柟娉曟椂
- }
- }
- }
- //});
- //tasks.Add(task);
- }
-
- Task.WaitAll(tasks.ToArray());
+ throw new Exception("JobParams 涓嶅寘鍚� CommonConveyorLine 绫诲瀷鍙傛暟");
}
+ // 瀹氫箟绾夸綋瀹炵洏鍏ュ簱璇锋眰鐨勫湴鍧�鍜屼换鍔$被鍨�
+ var requests = new Dictionary<string, string>
+ {
+ { "DB1002.293.0", "ZJXL-WLX002" },
+ { "DB1002.1493.0", "FJXL-WLX002" }
+ };
+
+ foreach (var request in requests)
+ {
+ var isDownRequest = conveyorLine.Communicator.Read<bool>(request.Key);
+ if (!isDownRequest)
+ {
+ continue;
+ }
+
+ string fromAdd = request.Value;
+ string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
+
+ // 鏌ヨ鏄惁瀛樺湪宸茬敓鎴愮殑鏂颁换鍔�
+ var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd && x.TaskState == (int)TaskInStatusEnum.InNew);
+ if (task != null)
+ {
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,浠诲姟宸茬敓鎴愬瓨鍦紝绋嶅悗閲嶈瘯......");
+ continue;
+ }
+
+ // 鏌ヨ浠诲姟绫诲瀷瀵瑰簲鐨刢zTask
+ DtCZTask czTask = _taskCZRepository.QueryFirst(x => x.TaskType == taskType);
+ if (czTask == null)
+ {
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,{taskType}浠诲姟涓嶅瓨鍦紝绋嶅悗閲嶈瘯......");
+ continue;
+ }
+
+ // 鍒涘缓鏂扮殑浠诲姟骞舵坊鍔犲埌浠诲姟浠撳簱
+ task = new Dt_Task()
+ {
+ TaskNum = _taskService.GetTaskNum(),
+ CreateDate = DateTime.Now,
+ Creater = "system",
+ CurrentAddress = fromAdd,
+ SourceAddress = fromAdd,
+ TaskState = (int)TaskInStatusEnum.InNew,
+ TaskType = (int)TaskInboundTypeEnum.Inbound,
+ Grade = 1,
+ PalletCode = czTask.TaskProductCode,
+ TargetAddress = czTask.TaskEndAddress,
+ Roadway = $"{taskType}AGV",
+ WMSId = czTask.Id,
+ Remark = czTask.TaskOrderNo
+ };
+ _taskRepository.AddData(task);
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,浠诲姟宸茬敓鎴愶紝绛夊緟鎵ц......");
+ }
}
catch (Exception ex)
{
- //Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+ // 璁板綍寮傚父淇℃伅
+ // Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+ ConsoleHelper.WriteErrorLine($"{nameof(CommonConveyorLineJob)}: 鍙戠敓寮傚父 - {ex.Message}");
}
finally
{
+ // 鍐欒皟璇曚俊鎭�
WriteDebug("CommonConveyorLineJob", "test");
- //Console.Out.WriteLine(DateTime.Now);
+ // Console.Out.WriteLine(DateTime.Now);
}
+
return Task.CompletedTask;
}
+
/// <summary>
/// 杈撻�佺嚎璇锋眰鍏ュ簱
/// </summary>
--
Gitblit v1.9.3