From 913f4af81e7ad477110bfe2ff430163b9225898c Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期二, 10 十二月 2024 16:51:16 +0800
Subject: [PATCH] 增加人工入库、人工出库、人工移库功能
---
代码管理/WCS/WIDESEAWCS_Client/src/extension/taskinfo/extend/taskManual.vue | 414 +++++++++++++++++++++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 71 +++-
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs | 2
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs | 2
代码管理/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js | 25 +
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 24 +
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 11
代码管理/WCS/WIDESEAWCS_Client/config/buttons.js | 27 +
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 364 +++++++++++++++++++++-
9 files changed, 893 insertions(+), 47 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
index 59da816..f9906cb 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
@@ -69,6 +69,33 @@
}
},
{
+ name: "浜哄伐鍏ュ簱",
+ icon: '',
+ class: '',
+ value: 'ManualInbound',
+ type: 'warning',
+ onClick: function () {
+ }
+},
+{
+ name: "浜哄伐鍑哄簱",
+ icon: '',
+ class: '',
+ value: 'ManualOutbound',
+ type: 'warning',
+ onClick: function () {
+ }
+},
+{
+ name: "浜哄伐绉诲簱",
+ icon: '',
+ class: '',
+ value: 'ManualTransfer',
+ type: 'warning',
+ onClick: function () {
+ }
+},
+{
name: "鏌ョ湅瀹屾暣璺敱",
icon: '',
class: '',
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/extend/taskManual.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/extend/taskManual.vue"
new file mode 100644
index 0000000..79a70b9
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/extend/taskManual.vue"
@@ -0,0 +1,414 @@
+<template>
+ <div>
+ <!-- 浜哄伐鍏ュ簱 -->
+ <vol-box
+ :lazy="true"
+ :width="400"
+ :height="300"
+ v-model="inbound.model"
+ title="浜哄伐鍏ュ簱"
+ :onModelClose="cancelIn"
+ >
+ <div style="padding: 10px 20px">
+ <vol-form
+ ref="sendInTask"
+ :formRules="inbound.data"
+ :formFields="inbound.fields"
+ ></vol-form>
+ </div>
+ <template #footer>
+ <div>
+ <el-button
+ type="danger"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="SendInTask"
+ >纭鍏ュ簱</el-button
+ >
+ <el-button
+ type="primary"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="cancelIn"
+ >鍙栨秷</el-button
+ >
+ </div>
+ </template>
+ </vol-box>
+ <!-- 浜哄伐鍑哄簱 -->
+ <vol-box
+ :lazy="true"
+ :width="400"
+ :height="300"
+ v-model="outbound.model"
+ title="浜哄伐鍑哄簱"
+ :onModelClose="cancelOut"
+ >
+ <div style="padding: 10px 20px">
+ <vol-form
+ ref="sendInTask"
+ :formRules="outbound.data"
+ :formFields="outbound.fields"
+ ></vol-form>
+ </div>
+ <template #footer>
+ <div>
+ <el-button
+ type="danger"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="SendOutTask"
+ >纭鍏ュ簱</el-button
+ >
+ <el-button
+ type="primary"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="cancelOut"
+ >鍙栨秷</el-button
+ >
+ </div>
+ </template>
+ </vol-box>
+ <!-- 浜哄伐绉诲簱 -->
+ <vol-box
+ :lazy="true"
+ :width="400"
+ :height="300"
+ v-model="transfer.model"
+ title="浜哄伐绉诲簱"
+ :onModelClose="cancelTransfer"
+ >
+ <div style="padding: 10px 20px">
+ <vol-form
+ ref="sendInTask"
+ :formRules="transfer.data"
+ :formFields="transfer.fields"
+ ></vol-form>
+ </div>
+ <template #footer>
+ <div>
+ <el-button
+ type="danger"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="SendTransfer"
+ >纭鍏ュ簱</el-button
+ >
+ <el-button
+ type="primary"
+ size="big"
+ icon="md-checkmark-circle"
+ long
+ @click="cancelTransfer"
+ >鍙栨秷</el-button
+ >
+ </div>
+ </template>
+ </vol-box>
+ </div>
+</template>
+<script>
+import VolBox from "@/components/basic/VolBox.vue";
+import VolForm from "@/components/basic/VolForm.vue";
+//杩欓噷浣跨敤鐨剉ue2璇硶锛屼篃鍙互鍐欐垚vue3璇硶
+export default {
+ components: { "vol-box": VolBox, "vol-form": VolForm },
+ methods: {},
+ data() {
+ return {
+ inbound: {
+ model: false,
+ fields: {
+ cmd: 3001,
+ src_station: 1001,
+ dest_station: null,
+ CarId: '',
+ },
+ data: [
+ [
+ {
+ type: "select",
+ required: true,
+ title: "鍏ュ簱绔欑偣",
+ field: "src_station",
+ data: [
+ { key: 1001, value: "鍏巶" },
+ { key: 1002, value: "涔濆巶" },
+ ],
+ },
+ ],
+ [
+ {
+ type: "number",
+ required: true,
+ title: "缁堢偣搴撲綅",
+ field: "dest_station"
+ },
+ ],
+ [
+ {
+ type: "text",
+ required: true,
+ title: "鏂欒溅缂栧彿",
+ field: "CarId",
+ },
+ ],
+ ],
+ },
+ outbound: {
+ model: false,
+ fields: {
+ cmd: 102,
+ src_station: null,
+ dest_station: 1001,
+ CarId: '',
+ },
+ data: [
+ [
+ {
+ type: "number",
+ required: true,
+ title: "鏉ユ簮搴撲綅",
+ field: "src_station"
+ },
+ ],
+ [
+ {
+ type: "select",
+ required: true,
+ title: "鍑哄簱绔欑偣",
+ field: "dest_station",
+ data: [
+ { key: 1001, value: "鍏巶" },
+ { key: 1002, value: "涔濆巶" },
+ ],
+ },
+ ],
+ [
+ {
+ type: "text",
+ required: true,
+ title: "鏂欒溅缂栧彿",
+ field: "CarId",
+ },
+ ],
+ ],
+ },
+ transfer: {
+ model: false,
+ fields: {
+ cmd: 103,
+ src_station: null,
+ dest_station: null,
+ CarId: '',
+ },
+ data: [
+ [
+ {
+ type: "number",
+ required: true,
+ title: "鏉ユ簮搴撲綅",
+ field: "src_station"
+ },
+ ],
+ [
+ {
+ type: "number",
+ required: true,
+ title: "缁堢偣搴撲綅",
+ field: "dest_station"
+ },
+ ],
+ [
+ {
+ type: "text",
+ required: true,
+ title: "鏂欒溅缂栧彿",
+ field: "CarId",
+ },
+ ],
+ ],
+ },
+ };
+ },
+ computed: {
+ isValidInDest() {
+ const regex = /^[0-9]{1,5}$/;
+ return regex.test(this.inbound.fields.dest_station);
+ },
+ isValidoutSrc() {
+ const regex = /^[0-9]{1,5}$/;
+ return regex.test(this.outbound.fields.src_station);
+ },
+ isValidTranSrc() {
+ const regex = /^[0-9]{1,5}$/;
+ return regex.test(this.transfer.fields.src_station);
+ },
+ isValidTranDest() {
+ const regex = /^[0-9]{1,5}$/;
+ return regex.test(this.transfer.fields.dest_station);
+ }
+ },
+ methods: {
+ //浜哄伐鍏ュ簱
+ open(type) {
+ switch (type) {
+ case "inbound":
+ this.inbound.model = true;
+ break;
+ case "outbound":
+ this.outbound.model = true;
+ break;
+ case "transfer":
+ this.transfer.model = true;
+ break;
+ default:
+ break;
+ }
+ },
+ cancelIn(){
+ this.$refs.sendInTask.reset()
+ this.inbound.model = false;
+ let param = {
+ cmd: this.inbound.fields.cmd,
+ src_station: this.inbound.fields.src_station,
+ dest_station: this.inbound.fields.dest_station,
+ carId: this.inbound.fields.CarId,
+ };
+ console.log(param);
+ },
+ cancelOut(){
+ this.$refs.sendInTask.reset()
+ this.outbound.model = false;
+ let param = {
+ cmd: this.outbound.fields.cmd,
+ src_station: this.outbound.fields.src_station,
+ dest_station: this.outbound.fields.dest_station,
+ carId: this.inbound.fields.CarId,
+ };
+ console.log(param);
+ },
+ cancelTransfer(){
+ this.$refs.sendInTask.reset()
+ this.transfer.model = false;
+ let param = {
+ cmd: this.transfer.fields.cmd,
+ src_station: this.transfer.fields.src_station,
+ dest_station: this.transfer.fields.dest_station,
+ carId: this.transfer.fields.CarId,
+ };
+ console.log(param);
+ },
+ //浜哄伐鍏ュ簱
+ SendInTask() {
+ if (this.inbound.fields.src_station==''||this.inbound.fields.dest_station==0||this.inbound.fields.CarId=='') {
+ return this.$Message.error(
+ "璇疯緭鍏ョ鍚堟潯浠剁殑鍙傛暟"
+ );
+ }
+ if (!this.isValidInDest) {
+ return this.$Message.error(
+ "缁堢偣搴撲綅鍙寘鍚暟瀛椾笖鏈�澶ч暱搴︿负5浣�"
+ );
+ }
+ let param = {
+ cmd: this.inbound.fields.cmd,
+ src_station: this.inbound.fields.src_station,
+ dest_station: this.inbound.fields.dest_station,
+ carId: this.inbound.fields.CarId,
+ };
+ this.http
+ .post("/api/Task/ReceiveWCSTask", param, "浠诲姟鍒涘缓涓�...")
+ .then((x) => {
+ if (x.status == true) {
+ this.$Message.success("鏂板缓鍏ュ簱浠诲姟鎴愬姛");
+ //鍏抽棴寮规
+ this.inbound.model = false;
+ //娓呯┖琛ㄥ崟
+ this.$refs.sendInTask.reset();
+ this.$parent.refresh();
+ } else {
+ this.$Message.error(x.message);
+ }
+ });
+ },
+ //浜哄伐鍑哄簱
+ SendOutTask() {
+ if (this.outbound.fields.src_station==0||this.outbound.fields.dest_station==''||this.outbound.fields.CarId=='') {
+ return this.$Message.error(
+ "璇疯緭鍏ョ鍚堟潯浠剁殑鍙傛暟"
+ );
+ }
+ if (!this.isValidoutSrc) {
+ return this.$Message.error(
+ "鏉ユ簮搴撲綅鍙寘鍚暟瀛椾笖鏈�澶ч暱搴︿负5浣�"
+ );
+ }
+ let param = {
+ cmd: this.outbound.fields.cmd,
+ src_station: this.outbound.fields.src_station,
+ dest_station: this.outbound.fields.dest_station,
+ carId: this.outbound.fields.CarId,
+ };
+ this.http
+ .post("/api/Task/ReceiveWCSTask", param, "浠诲姟鍒涘缓涓�...")
+ .then((x) => {
+ if (x.status == true) {
+ this.$Message.success("鏂板缓鍑哄簱浠诲姟鎴愬姛");
+ //鍏抽棴寮规
+ this.outbound.model = false;
+ //娓呯┖琛ㄥ崟
+ this.$refs.sendInTask.reset();
+ this.$parent.refresh();
+ } else {
+ this.$Message.error(x.message);
+ }
+ });
+ },
+ //浜哄伐绉诲簱搴�
+ SendTransfer() {
+ if (this.transfer.fields.src_station==0||this.transfer.fields.dest_station==0||this.transfer.fields.CarId=='') {
+ return this.$Message.error(
+ "璇疯緭鍏ョ鍚堟潯浠剁殑鍙傛暟"
+ );
+ }
+ if (!this.isValidTranSrc) {
+ return this.$Message.error(
+ "鏉ユ簮搴撲綅鍙寘鍚暟瀛椾笖鏈�澶ч暱搴︿负5浣�"
+ );
+ }
+ if (!this.isValidTranDest) {
+ return this.$Message.error(
+ "缁堢偣搴撲綅鍙寘鍚暟瀛椾笖鏈�澶ч暱搴︿负5浣�"
+ );
+ }
+ let param = {
+ cmd: this.transfer.fields.cmd,
+ src_station: this.transfer.fields.src_station,
+ dest_station: this.transfer.fields.dest_station,
+ carId: this.transfer.fields.CarId,
+ };
+ this.http
+ .post("/api/Task/ReceiveWCSTask", param, "浠诲姟鍒涘缓涓�...")
+ .then((x) => {
+ if (x.status == true) {
+ this.$Message.success("鏂板缓绉诲簱浠诲姟鎴愬姛");
+ //鍏抽棴寮规
+ this.transfer.model = false;
+ //娓呯┖琛ㄥ崟
+ this.$refs.sendInTask.reset();
+ this.$parent.refresh();
+ } else {
+ this.$Message.error(x.message);
+ }
+ });
+ },
+ },
+};
+</script>
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
index e330c74..f884b50 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
@@ -1,10 +1,11 @@
//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
import gridBody from './extend/taskExecuteDetail.vue'
+import gridHeader from './extend/taskManual.vue'
let extension = {
components: {
//鏌ヨ鐣岄潰鎵╁睍缁勪欢
- gridHeader: '',
+ gridHeader: gridHeader,
gridBody: gridBody,
gridFooter: '',
//鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
@@ -50,7 +51,27 @@
});
}
}
-
+ //浜哄伐鍏ュ簱鎸夐挳
+ var ManualButton = this.buttons.find((x) => x.value == "ManualInbound");
+ if (ManualButton) {
+ ManualButton.onClick = () => {
+ this.$refs.gridHeader.open("inbound");
+ }
+ }
+ //浜哄伐鍑哄簱鎸夐挳
+ var ManualOutButton = this.buttons.find((x) => x.value == "ManualOutbound");
+ if (ManualOutButton) {
+ ManualOutButton.onClick = () => {
+ this.$refs.gridHeader.open("outbound");
+ }
+ }
+ //浜哄伐绉诲簱鎸夐挳
+ var ManualTransferButton = this.buttons.find((x) => x.value == "ManualTransfer");
+ if (ManualTransferButton) {
+ ManualTransferButton.onClick = () => {
+ this.$refs.gridHeader.open("transfer");
+ }
+ }
var previousButton = this.buttons.find((x) => x.value == "Previous");
if (previousButton) previousButton.hidden = true;
var nextButton = this.buttons.find((x) => x.value == "Next");
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 6dcdfd6..4153fc5 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -63,6 +63,8 @@
/// <returns>杩斿洖澶勭悊缁撴灉</returns>
WebResponseContent ReceiveMESTask([NotNull] MESTaskDTO taskDTO);
+ WebResponseContent ReceiveWCSTask([NotNull] MESTaskDTO taskDTO);
+
/// <summary>
/// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟
/// </summary>
@@ -138,6 +140,13 @@
/// <returns></returns>
Dt_Task QueryStackerCraneTaskByAGVRequest(string deviceNo);
+ /// <summary>
+ /// 鏌ヨAGV杩涘叆涓殑鍏ュ簱浠诲姟鏁伴噺
+ /// </summary>
+ /// <param name="deviceNo"></param>
+ /// <returns></returns>
+ Dt_Task QueryStackerCraneTaskByAGVIning(string deviceNo);
+
/// <summary>
/// 瀵瑰簲WMS璇锋眰 3001-AGV鏀捐揣瀹屾垚
@@ -176,6 +185,21 @@
/// <param name="taskNum">浠诲姟鍙�</param>
/// <param name="message">寮傚父淇℃伅</param>
WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message);
+ /// <summary>
+ /// 鏇存柊鏄惁杩涘叆鍗囬檷鏈烘爣蹇楋紙0锛屾湭杩涘叆 1锛屽凡杩涘叆锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ WebResponseContent UpdateTaskAllowIn(int taskNum, int Inflag);
+
+ /// <summary>
+ /// 鏄惁宸插洖浼燤ES2001鏍囧織锛�0锛屾湭鍥炰紶 1锛屽凡鍥炰紶锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ WebResponseContent UpdateTaskIsBack(int taskNum, int Inflag);
/// <summary>
/// 鏇存柊浠诲姟鐘舵�佷俊鎭紝骞跺悓姝ヨ嚦WMS
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
index 7aaac2d..c4481b4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
@@ -144,7 +144,7 @@
public DateTime? Dispatchertime { get; set; }
/// <summary>
- /// 澶囨敞 涓婃枡浠诲姟鏃� 鐢ㄤ簬瀛樹笂鏂欐枡杞︾殑鎬诲眰鏁板拰褰撳墠灞傛暟 鏍煎紡锛氭�诲眰鏁�-褰撳墠灞傛暟 鍑哄簱浠诲姟鏃讹紝鍐欐�诲眰鏁�
+ /// 澶囨敞 涓婃枡浠诲姟鏃� 鐢ㄤ簬瀛樹笂鏂欐枡杞︾殑鎬诲眰鏁板拰褰撳墠灞傛暟 鏍煎紡锛氭�诲眰鏁�-褰撳墠灞傛暟; 鍑哄簱浠诲姟鏃�:鍐欐�诲眰鏁�; 鑷姩鍏ュ簱鏃跺啓锛氭槸鍚﹀洖浼犲厑璁℃椂杩涘叆
/// </summary>
[ImporterHeader(Name = "澶囨敞")]
[ExporterHeader(DisplayName = "澶囨敞")]
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index 05589ac..20f87ae 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -62,6 +62,17 @@
}
/// <summary>
+ /// 鎺ユ敹WCS浜哄伐浠诲姟淇℃伅
+ /// </summary>
+ /// <param name="taskDTO">WCS浠诲姟瀵硅薄</param>
+ /// <returns>杩斿洖澶勭悊缁撴灉</returns>
+ [HttpPost, Route("ReceiveWCSTask"), AllowAnonymous]
+ public WebResponseContent ReceiveWCSTask([FromBody] MESTaskDTO taskDTO)
+ {
+ return Service.ReceiveWCSTask(taskDTO);
+ }
+
+ /// <summary>
/// 浠诲姟鍙栨秷(鍫嗗灈鏈哄洖瑙e喅涓嶄簡鐨勬晠闅滈渶娓呴櫎浠诲姟锛屾竻闄や换鍔″悗锛岄渶鍦╓CS涓婂彇娑堜换鍔�)
/// </summary>
/// <param name="key"></param>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 6984990..e634901 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -24,6 +24,7 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
@@ -483,6 +484,253 @@
}
+
+ /// <summary>
+ /// wcs鎵嬪伐鐢熸垚浠诲姟
+ /// </summary>
+ /// <param name="taskDTO">WCS浠诲姟瀵硅薄</param>
+ /// <returns>杩斿洖澶勭悊缁撴灉</returns>
+ public WebResponseContent ReceiveWCSTask([NotNull] MESTaskDTO taskDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ taskDTO.task_id = GetTaskNo();
+ string inparam = JsonConvert.SerializeObject(taskDTO);
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"ReceiveWCSTask鏂规硶鍏ュ弬{inparam}");
+ Dt_Task task = new Dt_Task();
+ Dt_Task taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id);
+ if (taskDTO.cmd == 101)//濡傛灉鏄�101鎸夋棫鐨勪换鍔″彿鍘绘煡
+ {
+ taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.weight);
+ }
+
+ if (taskDTO.cmd != 3001 && taskDTO.cmd != 101 && taskinfo != null)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
+ return content = WebResponseContent.Instance.Error($"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
+ }
+ Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.src_station.ToString());
+ Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.dest_station.ToString());
+ switch (taskDTO.cmd)
+ {
+ case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃禬CS闇�鍦╦ob涓啓鎻愬崌淇″彿
+ if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id) == null)//鎵嬪姩鍏ュ簱鐩存帴鍙�3001锛岄渶瑕佺敓鎴愪换鍔★紝鍥犱负娌℃湁1001鐜妭
+ {
+ taskDTO.dest_rack =int.Parse(taskDTO.dest_station.ToString().Substring(0, 1));
+ taskDTO.dest_row = int.Parse(taskDTO.dest_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.dest_col = int.Parse(taskDTO.dest_station.ToString().Substring(3, 2).TrimStart('0'));
+ task.TaskType = (int)TaskInboundTypeEnum.Inbound;
+ task.TaskState = (int)TaskInStatusEnum.AGV_InExecuting;
+ task.Roadway = "SC01";
+ task.Grade = 2;
+
+ if (locationsrc != null)
+ {
+ task.SourceAddress = locationsrc.LocationCode;
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ }
+ }
+ break;
+ case 101://鎻愬崌鏈烘彁鍗囧畬鎴�
+ if (taskinfo != null)
+ {
+ //鏇存柊浠诲姟琛ㄤ腑NextAddress瀛楁涓烘柊鐨勪换鍔″彿 taskDTO.weight-鏃х殑浠诲姟鍙� taskDTO.task_id-鏂扮殑浠诲姟鍙�
+ UpdateTaskStatus(taskinfo.TaskId, taskDTO.task_id, (int)TaskInStatusEnum.AGV_InFinish);
+ _taskExecuteDetailService.AddTaskExecuteDetail(taskinfo.TaskId, $"AGV鎼繍瀹屾垚");
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
+ return content = WebResponseContent.Instance.OK($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
+ return content = WebResponseContent.Instance.Error($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
+ }
+ break;
+
+ case 103://浜у搧绉诲簱锛堢Щ搴擄紝鍑哄簱锛�
+ taskDTO.src_rack = int.Parse(taskDTO.src_station.ToString().Substring(0, 1));
+ taskDTO.src_row = int.Parse(taskDTO.src_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.src_col = int.Parse(taskDTO.src_station.ToString().Substring(3, 2).TrimStart('0'));
+
+ taskDTO.dest_rack = int.Parse(taskDTO.dest_station.ToString().Substring(0, 1));
+ taskDTO.dest_row = int.Parse(taskDTO.dest_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.dest_col = int.Parse(taskDTO.dest_station.ToString().Substring(3, 2).TrimStart('0'));
+
+ taskDTO.total = 9;
+ task.TaskType = (int)TaskRelocationTypeEnum.Relocation;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.Roadway = "SC01";
+
+ if (taskDTO.total > 0)
+ {
+ task.Remark = taskDTO.total.ToString();//鍙栧嚭搴撶殑鎬诲眰鏁�
+ }
+ task.Grade = 1;
+ break;
+ case 102:
+ if (taskDTO.dest_station == 1001 || taskDTO.dest_station == 1002)//寮傚父鍑哄簱
+ {
+ taskDTO.src_rack = int.Parse(taskDTO.src_station.ToString().Substring(0, 1));
+ taskDTO.src_row = int.Parse(taskDTO.src_station.ToString().Substring(1, 2).TrimStart('0'));
+ taskDTO.src_col = int.Parse(taskDTO.src_station.ToString().Substring(3, 2).TrimStart('0'));
+ task.TaskType = (int)TaskOutboundTypeEnum.OutInventory;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.Roadway = "SC01";
+ task.Grade = 1;
+ }
+ if (locationdsc != null)
+ {
+ task.TargetAddress = locationdsc.LocationCode;
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+ }
+ break;
+ default:
+ break;
+ }
+
+ task.TaskNum = taskDTO.task_id;
+ task.PalletCode = taskDTO.CarId;
+
+ if (string.IsNullOrEmpty(task.SourceAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
+ {
+ task.SourceAddress = $"SC01-{taskDTO.src_rack.ToString().PadLeft(3, '0')}-{taskDTO.src_col.ToString().PadLeft(3, '0')}-{taskDTO.src_row.ToString().PadLeft(3, '0')}";
+ }
+ if (string.IsNullOrEmpty(task.TargetAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
+ {
+ task.TargetAddress = $"SC01-{taskDTO.dest_rack.ToString().PadLeft(3, '0')}-{taskDTO.dest_col.ToString().PadLeft(3, '0')}-{taskDTO.dest_row.ToString().PadLeft(3, '0')}";
+ }
+ task.Creater = "WCS";
+ task.WMSId = 3;//WCS浜哄伐寤轰换鍔�
+
+ //鍒ゆ柇璐т綅鐘舵��
+ Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ Dt_LocationInfo tarLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (srcLocation != null && tarLocation != null)
+ {
+ if (srcLocation.EnableStatus == (int)EnableStatusEnum.Disable)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.EnableStatus == (int)EnableStatusEnum.Disable)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
+ }
+ if (taskDTO.cmd != 101)//鍏ュ簱鏃朵笉闇�瑕佸垽鏂槸鍚﹂攣瀹氾紝閿佸畾鐘舵�佹槸鍦ㄧ敓鎴愪换鍔℃椂閿佸畾
+ {
+
+ if (taskinfo != null && taskDTO.cmd == 3001 && taskinfo.WMSId == 3)//濡傛灉鏄墜鍔ㄥ叆搴擄紝鍙�3001锛屼細鐢熸垚浠诲姟锛岄渶瑕佸垽鏂簱浣嶆槸鍚﹂攣瀹�;鑷姩妯″紡鍙�1001鐨勬椂鍊欏氨鐢熸垚浜嗕换鍔★紝鍐嶅彂3001灏变笉闇�瑕佸垽鏂槸鍚﹂攣瀹氫簡
+ {
+ if (srcLocation.LocationStatus == (int)LocationStatusEnum.Lock)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.LocationStatus == (int)LocationStatusEnum.Lock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
+ }
+ }
+ }
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)//鍏ュ簱 璺緞锛氭彁鍗囨満搴撲綅-->搴撲綅
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滅┖闂测�濆苟涓旀湭绂佺敤锛岄攣瀹氬簱浣嶄慨鏀瑰簱浣嶇姸鎬佷负鈥滈攣瀹氣�濓紝鐢熸垚WCS浜у搧鍏ュ簱浠诲姟锛屽姞鍏CS浠诲姟闃熷垪涓��
+ if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
+ }
+ tarLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation) //浜у搧绉诲簱锛堢Щ搴擄紝鍑哄簱鍏辩敤锛� 璺緞锛氬簱浣�-->搴撲綅/鏆傚瓨搴撲綅
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р�濓紝搴撲綅/鏆傚瓨搴撲綅鏄惁鈥滅┖闂测��
+ if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
+ {
+
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ tarLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ else if (task.TaskType == (int)TaskOutboundTypeEnum.OutInventory) //寮傚父鍑哄簱锛堥��搴擄級 璺緞锛氬簱浣�-->鎻愬崌鏈哄簱浣�
+ {
+ //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р��
+ if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ return content = WebResponseContent.Instance.Error($"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
+ }
+ srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
+ }
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
+ return content = WebResponseContent.Instance.Error($"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
+ }
+
+ try
+ {
+ //寮�鍚簨鐗�
+ _unitOfWorkManage.BeginTran();
+ _locationInfoRepository.UpdateData(tarLocation);
+ _locationInfoRepository.UpdateData(srcLocation);
+ BaseDal.AddData(task);
+ Dt_Task tasktemp = BaseDal.QueryFirst(x => x.TaskNum == task.TaskNum);
+ _taskExecuteDetailService.AddTaskExecuteDetail(tasktemp.TaskId, "鎺ユ敹WCS浠诲姟");
+ //鎻愪氦浜嬪姟
+ _unitOfWorkManage.CommitTran();
+
+ }
+ catch (Exception)
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw;
+ }
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}");
+ content = WebResponseContent.Instance.OK($"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}", task);
+
+ }
+ catch (Exception ex)
+ {
+ ServiceLogger.WriteDebug("ReceiveWCSTask", $"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.StackTrace}");
+ content = WebResponseContent.Instance.Error($"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.Message}");
+ }
+ return content;
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇浠诲姟鍙�
+ /// </summary>
+ /// <returns></returns>
+ public int GetTaskNo()
+ {
+ DataTable dt = BaseDal.QueryTable("SELECT FORMAT(NEXT VALUE FOR dbo.seqTaskNum, '0000000');");
+ return int.Parse("9"+ dt.Rows[0][0].ToString());
+ }
+
/// <summary>
/// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟
/// </summary>
@@ -614,8 +862,19 @@
/// <param name="deviceNo"></param>
/// <returns></returns>
public Dt_Task QueryStackerCraneTaskByAGVRequest(string deviceNo)
- {
+ {
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew), TaskOrderBy);
+ }
+
+ /// <summary>
+ /// 鏌ヨAGV杩涘叆涓殑鍏ュ簱浠诲姟
+ /// </summary>
+ /// <param name="deviceNo"></param>
+ /// <returns></returns>
+ public Dt_Task QueryStackerCraneTaskByAGVIning(string deviceNo)
+ {
+
+ return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType)&&x.CurrentAddress=="1"), TaskOrderBy);
}
/// <summary>
/// 瀵瑰簲WMS璇锋眰 3001-AGV鏀捐揣瀹屾垚
@@ -702,6 +961,56 @@
content = WebResponseContent.Instance.Error(ex.Message);
}
return content;
+ }
+
+ /// <summary>
+ /// 鑷姩鍏ュ簱鏃舵洿鏂版槸鍚﹁繘鍏ュ崌闄嶆満鏍囧織锛�0锛屾湭杩涘叆 1锛屽凡杩涘叆锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ public WebResponseContent UpdateTaskAllowIn(int taskNum, int Inflag)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+ task.CurrentAddress = Inflag.ToString();
+ task.ModifyDate = DateTime.Now;
+ BaseDal.UpdateData(task);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+
+ }
+
+ /// <summary>
+ /// 鏄惁宸插洖浼燤ES2001鏍囧織锛�0锛屾湭鍥炰紶 1锛屽凡鍥炰紶锛�
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <param name="Inflag"></param>
+ /// <returns></returns>
+ public WebResponseContent UpdateTaskIsBack(int taskNum, int Inflag)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+ task.Remark = Inflag.ToString();
+ task.ModifyDate = DateTime.Now;
+ BaseDal.UpdateData(task);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+
}
/// <summary>
@@ -1141,12 +1450,15 @@
}
else
{
- MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ if (task.WMSId != 3)
{
- ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
}
}
@@ -1154,7 +1466,7 @@
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
- //浠诲姟鎵ц澶辫触锛岃揣浣嶇姸鎬佽繕鍘�
+
ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
}
@@ -1187,16 +1499,19 @@
MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = int.Parse(task.NextAddress), status = 6 };
string inparam = JsonConvert.SerializeObject(sendcmd);
ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ if (task.WMSId != 3)
{
-
- ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
- }
- else
- {
- ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
}
}
@@ -1230,14 +1545,17 @@
_unitOfWorkManage.CommitTran();
//绉诲簱瀹屾垚锛屽洖浼燤ES
//鍥炰紶鍒癢MS
- MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
- string inparam = JsonConvert.SerializeObject(sendcmd);
- ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- if (res != null && res.code != 0)
+ if (task.WMSId != 3)
{
- ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
- content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+ string inparam = JsonConvert.SerializeObject(sendcmd);
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ if (res != null && res.code != 0)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+ }
}
//if(task.TaskType== (int)TaskRelocationTypeEnum.Relocation&&!string.IsNullOrEmpty(task.Remark.Trim()))//鍑哄簱浠诲姟鍐欐�诲眰鏁版爣璇�
//{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index da7be29..eb3ac10 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -54,11 +54,12 @@
public Task Execute(IJobExecutionContext context)
{
- WriteDebug("绾跨▼缁熻鏃ュ織", "绾跨▼鏁�" + ThreadPool.ThreadCount);
+ //WriteDebug("绾跨▼缁熻鏃ュ織", "绾跨▼鏁�" + ThreadPool.ThreadCount);
+
//CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
CommonStackerCrane commonStackerCrane = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC01") as CommonStackerCrane;
try
- {
+ {
if (commonStackerCrane != null)
{
//WriteDebug("澶у爢鍨涙満杩愯鏃ュ織", $"澶у爢鍨涙満浠诲姟鎵ц涓�...");
@@ -75,8 +76,7 @@
{
Dt_Task? task = GetTask(commonStackerCrane);
if (task != null)
- {
-
+ {
WriteDebug(nameof(CommonStackerCraneJob), $"澶у爢鍨涙満浠诲姟鍙穥task.TaskNum}");
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
@@ -136,7 +136,7 @@
//璇诲彇澶у爢鍨涙満浠诲姟鍙峰拰浠诲姟瀹屾垚纭鐘舵�侊紙鍥犱负灏佽鐨勪簨浠剁粡甯镐笉瑙﹀彂锛屾墍浠ュ姞涓洿鎺ヨ鐨勯�昏緫锛屼互鍏嶅嚭鐜板爢鍨涙満涓�鐩存帴澶勪簬绛夊緟wcs纭锛�
byte IsOver = commonStackerCrane.Communicator.Read<byte>("DB106.22");
int tasknum = commonStackerCrane.Communicator.Read<int>("DB106.18");
- WriteDebug(nameof(CommonStackerCraneJob), $"澶у爢鍨涙満SC01浠诲姟鍙峰爢鍨涙満浠诲姟鍙凤細{tasknum}鐘舵�侊細{IsOver}");
+ //WriteDebug(nameof(CommonStackerCraneJob), $"澶у爢鍨涙満SC01浠诲姟鍙峰爢鍨涙満浠诲姟鍙凤細{tasknum}鐘舵�侊細{IsOver}");
if (IsOver == 6)
{
if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
@@ -191,10 +191,24 @@
{
IsAllow = commonStackerCrane.Communicator.Read<short>("DB2.8.0");
}
- if (IsAllow == 1)//濡傛灉涓�1锛屽垯鍏佽AGV杩涘叆锛屽洖浼燱MS
+ //鏌ヨ浠诲姟鏍囪涓�1鐨勪换鍔′负绌烘墠鍏佽鍥炰紶
+ WriteDebug(nameof(CommonStackerCraneJob), $"浠诲姟鍙�:{task1001.TaskNum}-鏄惁鍏佽:{IsAllow}");
+ Dt_Task? taskAgvIning = _taskService.QueryStackerCraneTaskByAGVIning("SC01");
+ if (IsAllow == 1&&taskAgvIning==null)//濡傛灉涓�1锛屽垯鍏佽AGV杩涘叆锛屽洖浼燱MS
{
+ _taskService.UpdateTaskAllowIn(task1001.TaskNum, 1);
+ WriteDebug(nameof(CommonStackerCraneJob), $"鏇存柊鏄惁杩涘叆鍗囬檷鏈烘爣蹇楀��1锛屼换鍔″彿{task1001.TaskNum}");
+ IsAllow = 0;//鏇存柊鎴愬姛锛岀疆0涓嶅厑璁�
MESSendCMD sendcmd = new MESSendCMD { cmd = 2001, task_id = task1001.TaskNum, status = 6 };
MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+
+ //if (res != null && res.code == 0)//鍥炰紶2001鎴愬姛
+ //{
+ //WCS璇诲埌鍏佽淇″彿鍚庝换鍔℃爣璁�1,琛ㄧずAGV宸茶繘鍏ユ彁鍗囨満,Dt_Task 涓殑CurrentAddress鍋氫负鏍囪瀛楁
+ //_taskService.UpdateTaskAllowIn(task1001.TaskNum, 1);
+ //WriteDebug(nameof(CommonStackerCraneJob), $"鏇存柊鏄惁杩涘叆鍗囬檷鏈烘爣蹇楀��1锛屼换鍔″彿{task1001.TaskNum}");
+ //}
+
}
}
Dt_Task? task3001 = _taskService.QueryStackerCraneTaskByAGVPutFinish("SC01");
@@ -206,26 +220,23 @@
if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001绔欑偣
{
//鎻愬崌鏈烘槸鍚﹀浜庡氨缁姸鎬�
-
int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
- WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈虹姸鎬侊細{IsReady}浠诲姟鍙凤細{task3001.TaskNum}");
+ WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘槸鍚﹀氨缁姸鎬侊細{IsReady}浠诲姟鍙凤細{task3001.TaskNum}");
//鍐欏叆鎻愬崌淇℃伅
IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0");
if (IsWriteOne == 0 && IsReady == 1)
{
commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1);
- }
-
+ }
//璇诲彇鎻愬崌鏈轰俊鍙凤紝纭畾鏄惁鎻愬崌瀹屾垚
-
IsFinish = commonStackerCrane.Communicator.Read<short>("DB2.2.0");
+
}
else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002绔欑偣
{
//鎻愬崌鏈烘槸鍚﹀浜庡氨缁姸鎬�
-
int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
- WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈虹姸鎬侊細{IsReady}浠诲姟鍙凤細{task3001.TaskNum}");
+ WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘槸鍚﹀氨缁姸鎬侊細{IsReady}浠诲姟鍙凤細{task3001.TaskNum}");
//鍐欏叆鎻愬崌淇℃伅
IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0");
if (IsWriteTwo == 0 && IsReady == 1)
@@ -235,17 +246,37 @@
//璇诲彇鎻愬崌鏈轰俊鍙凤紝纭畾鏄惁鎻愬崌瀹屾垚
IsFinish = commonStackerCrane.Communicator.Read<short>("DB2.10.0");
+
}
+
if (IsFinish == 1)//濡傛灉涓�1锛屽垯琛ㄧず鎻愬崌瀹屾垚锛屽洖浼燱MS
{
- MESSendCMD sendcmd = new MESSendCMD { cmd = 2002, task_id = task3001.TaskNum, status = 6 };
- MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
- string inparam = JsonConvert.SerializeObject(sendcmd);
- WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘彁鍗囧畬鎴愶紝鍥炰紶WMS,鍏ュ弬锛歿inparam}");
-
- if (res != null && res.code != 0)
+ if (task3001.WMSId == 3)// WCS浜哄伐鍏ュ簱
{
- WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘彁鍗囧畬鎴愶紝鍥炰紶WMS澶辫触锛佷换鍔″彿{task3001.TaskNum}");
+ MESTaskDTO taskDTO = new MESTaskDTO();
+ taskDTO.weight = task3001.TaskNum;//鏃т换鍔″彿
+ taskDTO.cmd = 101;
+ _taskService.ReceiveWCSTask(taskDTO);
+ }
+ else
+ {
+ MESSendCMD sendcmd = new MESSendCMD { cmd = 2002, task_id = task3001.TaskNum, status = 6 };
+ MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+ string inparam = JsonConvert.SerializeObject(sendcmd);
+ WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘彁鍗囧畬鎴愶紝鍥炰紶WMS,鍏ュ弬锛歿inparam}");
+
+
+ if (res != null && res.code == 0)
+ {
+
+ _taskService.UpdateTaskAllowIn(task3001.TaskNum, 0);
+ WriteDebug(nameof(CommonStackerCraneJob), $"鏇存柊鏄惁杩涘叆鍗囬檷鏈烘爣蹇楀��0锛屼换鍔″彿{task3001.TaskNum}");
+
+ }
+ else
+ {
+ WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘彁鍗囧畬鎴愶紝鍥炰紶WMS澶辫触锛佷换鍔″彿{task3001.TaskNum}");
+ }
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
index fde7977..a9eb49d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
@@ -66,7 +66,7 @@
CommonStackerCrane? StackerCrane = GetStrackerCrane(task, stackerCraneOne, stackerCraneTwo);
if (StackerCrane != null)
{
- WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満浠诲姟鍙穥task.TaskNum}");
+ WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満浠诲姟鍙穥task.TaskNum}--{StackerCrane.DeviceCode}");
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
{
--
Gitblit v1.9.3