From 00f88de97d7ff3bdca5a445f17fa25c3fd28a1db Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周六, 23 11月 2024 14:07:23 +0800
Subject: [PATCH] 222

---
 SDA/iWareSda/Devices/4-Station/StationService/StationService.cs                      |   33 ++++++++
 SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs                     |   11 ++
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/DataProcess_RobotBuffer_ModeChange.cs |   28 +++---
 CC/iWareCC_ASRS/Connected Services/StationService/item3.xsd                          |    5 
 CC/iWareCC_ASRS/Connected Services/StationService/Reference.cs                       |   38 ++++++++-
 SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs                         |   35 ++++++++
 SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs                            |    6 +
 CC/iWareCC_ASRS/Connected Services/StationService/StationService.wsdl                |   19 ++++
 CC/iWareCC_ASRS/Connected Services/StationService/item2.xsd                          |   26 +++++-
 9 files changed, 176 insertions(+), 25 deletions(-)

diff --git a/CC/iWareCC_ASRS/Connected Services/StationService/Reference.cs b/CC/iWareCC_ASRS/Connected Services/StationService/Reference.cs
index 5a6b0be..2e97070 100644
--- a/CC/iWareCC_ASRS/Connected Services/StationService/Reference.cs
+++ b/CC/iWareCC_ASRS/Connected Services/StationService/Reference.cs
@@ -507,7 +507,7 @@
         private bool W_InboundFinishConfirmField;
         
         [System.Runtime.Serialization.OptionalFieldAttribute()]
-        private int W_Inbound_TaskIDField;
+        private short W_Inbound_TaskIDField;
         
         [System.Runtime.Serialization.OptionalFieldAttribute()]
         private bool W_IsRotateField;
@@ -519,10 +519,13 @@
         private short W_LengthField;
         
         [System.Runtime.Serialization.OptionalFieldAttribute()]
+        private short W_ModeField;
+        
+        [System.Runtime.Serialization.OptionalFieldAttribute()]
         private bool W_OutboundFinishConfirmField;
         
         [System.Runtime.Serialization.OptionalFieldAttribute()]
-        private int W_Outbound_TaskIDField;
+        private short W_Outbound_TaskIDField;
         
         [System.Runtime.Serialization.OptionalFieldAttribute()]
         private string W_PackageLengthField;
@@ -657,7 +660,7 @@
         }
         
         [System.Runtime.Serialization.DataMemberAttribute()]
-        public int W_Inbound_TaskID {
+        public short W_Inbound_TaskID {
             get {
                 return this.W_Inbound_TaskIDField;
             }
@@ -709,6 +712,19 @@
         }
         
         [System.Runtime.Serialization.DataMemberAttribute()]
+        public short W_Mode {
+            get {
+                return this.W_ModeField;
+            }
+            set {
+                if ((this.W_ModeField.Equals(value) != true)) {
+                    this.W_ModeField = value;
+                    this.RaisePropertyChanged("W_Mode");
+                }
+            }
+        }
+        
+        [System.Runtime.Serialization.DataMemberAttribute()]
         public bool W_OutboundFinishConfirm {
             get {
                 return this.W_OutboundFinishConfirmField;
@@ -722,7 +738,7 @@
         }
         
         [System.Runtime.Serialization.DataMemberAttribute()]
-        public int W_Outbound_TaskID {
+        public short W_Outbound_TaskID {
             get {
                 return this.W_Outbound_TaskIDField;
             }
@@ -1511,6 +1527,12 @@
         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IStationService/OutboundFinishConfirm", ReplyAction="http://tempuri.org/IStationService/OutboundFinishConfirmResponse")]
         System.Threading.Tasks.Task<iWareCC.StationService.SdaResEntity> OutboundFinishConfirmAsync(int deviceId, bool value, string stationCode);
         
+        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IStationService/ChangeMode", ReplyAction="http://tempuri.org/IStationService/ChangeModeResponse")]
+        iWareCC.StationService.SdaResEntity ChangeMode(int deviceId, int value, string stationCode);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IStationService/ChangeMode", ReplyAction="http://tempuri.org/IStationService/ChangeModeResponse")]
+        System.Threading.Tasks.Task<iWareCC.StationService.SdaResEntity> ChangeModeAsync(int deviceId, int value, string stationCode);
+        
         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IStationService/WriteInStoreTaskInfo", ReplyAction="http://tempuri.org/IStationService/WriteInStoreTaskInfoResponse")]
         iWareCC.StationService.SdaResEntity WriteInStoreTaskInfo(int deviceId, string stationCode, string toPlaceNo, short length, short width, short height, int inbound_TaskID);
         
@@ -1665,6 +1687,14 @@
             return base.Channel.OutboundFinishConfirmAsync(deviceId, value, stationCode);
         }
         
+        public iWareCC.StationService.SdaResEntity ChangeMode(int deviceId, int value, string stationCode) {
+            return base.Channel.ChangeMode(deviceId, value, stationCode);
+        }
+        
+        public System.Threading.Tasks.Task<iWareCC.StationService.SdaResEntity> ChangeModeAsync(int deviceId, int value, string stationCode) {
+            return base.Channel.ChangeModeAsync(deviceId, value, stationCode);
+        }
+        
         public iWareCC.StationService.SdaResEntity WriteInStoreTaskInfo(int deviceId, string stationCode, string toPlaceNo, short length, short width, short height, int inbound_TaskID) {
             return base.Channel.WriteInStoreTaskInfo(deviceId, stationCode, toPlaceNo, length, width, height, inbound_TaskID);
         }
diff --git a/CC/iWareCC_ASRS/Connected Services/StationService/StationService.wsdl b/CC/iWareCC_ASRS/Connected Services/StationService/StationService.wsdl
index b205f97..d4f511e 100644
--- a/CC/iWareCC_ASRS/Connected Services/StationService/StationService.wsdl
+++ b/CC/iWareCC_ASRS/Connected Services/StationService/StationService.wsdl
@@ -81,6 +81,12 @@
   <wsdl:message name="IStationService_OutboundFinishConfirm_OutputMessage">
     <wsdl:part name="parameters" element="tns:OutboundFinishConfirmResponse" />
   </wsdl:message>
+  <wsdl:message name="IStationService_ChangeMode_InputMessage">
+    <wsdl:part name="parameters" element="tns:ChangeMode" />
+  </wsdl:message>
+  <wsdl:message name="IStationService_ChangeMode_OutputMessage">
+    <wsdl:part name="parameters" element="tns:ChangeModeResponse" />
+  </wsdl:message>
   <wsdl:message name="IStationService_WriteInStoreTaskInfo_InputMessage">
     <wsdl:part name="parameters" element="tns:WriteInStoreTaskInfo" />
   </wsdl:message>
@@ -159,6 +165,10 @@
     <wsdl:operation name="OutboundFinishConfirm">
       <wsdl:input wsaw:Action="http://tempuri.org/IStationService/OutboundFinishConfirm" message="tns:IStationService_OutboundFinishConfirm_InputMessage" />
       <wsdl:output wsaw:Action="http://tempuri.org/IStationService/OutboundFinishConfirmResponse" message="tns:IStationService_OutboundFinishConfirm_OutputMessage" />
+    </wsdl:operation>
+    <wsdl:operation name="ChangeMode">
+      <wsdl:input wsaw:Action="http://tempuri.org/IStationService/ChangeMode" message="tns:IStationService_ChangeMode_InputMessage" />
+      <wsdl:output wsaw:Action="http://tempuri.org/IStationService/ChangeModeResponse" message="tns:IStationService_ChangeMode_OutputMessage" />
     </wsdl:operation>
     <wsdl:operation name="WriteInStoreTaskInfo">
       <wsdl:input wsaw:Action="http://tempuri.org/IStationService/WriteInStoreTaskInfo" message="tns:IStationService_WriteInStoreTaskInfo_InputMessage" />
@@ -291,6 +301,15 @@
         <soap:body use="literal" />
       </wsdl:output>
     </wsdl:operation>
+    <wsdl:operation name="ChangeMode">
+      <soap:operation soapAction="http://tempuri.org/IStationService/ChangeMode" style="document" />
+      <wsdl:input>
+        <soap:body use="literal" />
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal" />
+      </wsdl:output>
+    </wsdl:operation>
     <wsdl:operation name="WriteInStoreTaskInfo">
       <soap:operation soapAction="http://tempuri.org/IStationService/WriteInStoreTaskInfo" style="document" />
       <wsdl:input>
diff --git a/CC/iWareCC_ASRS/Connected Services/StationService/item2.xsd b/CC/iWareCC_ASRS/Connected Services/StationService/item2.xsd
index 8da0c43..22273e5 100644
--- a/CC/iWareCC_ASRS/Connected Services/StationService/item2.xsd
+++ b/CC/iWareCC_ASRS/Connected Services/StationService/item2.xsd
@@ -187,6 +187,22 @@
       </xs:sequence>
     </xs:complexType>
   </xs:element>
+  <xs:element name="ChangeMode">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" name="deviceId" type="xs:int" />
+        <xs:element minOccurs="0" name="value" type="xs:int" />
+        <xs:element minOccurs="0" name="stationCode" nillable="true" type="xs:string" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="ChangeModeResponse">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="ChangeModeResult" nillable="true" type="q13:SdaResEntity" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
   <xs:element name="WriteInStoreTaskInfo">
     <xs:complexType>
       <xs:sequence>
@@ -203,7 +219,7 @@
   <xs:element name="WriteInStoreTaskInfoResponse">
     <xs:complexType>
       <xs:sequence>
-        <xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteInStoreTaskInfoResult" nillable="true" type="q13:SdaResEntity" />
+        <xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteInStoreTaskInfoResult" nillable="true" type="q14:SdaResEntity" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
@@ -220,7 +236,7 @@
   <xs:element name="WriteOutStoreTaskInfoResponse">
     <xs:complexType>
       <xs:sequence>
-        <xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteOutStoreTaskInfoResult" nillable="true" type="q14:SdaResEntity" />
+        <xs:element xmlns:q15="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteOutStoreTaskInfoResult" nillable="true" type="q15:SdaResEntity" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
@@ -236,7 +252,7 @@
   <xs:element name="WriteStation_FinishACKResponse">
     <xs:complexType>
       <xs:sequence>
-        <xs:element xmlns:q15="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteStation_FinishACKResult" nillable="true" type="q15:SdaResEntity" />
+        <xs:element xmlns:q16="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteStation_FinishACKResult" nillable="true" type="q16:SdaResEntity" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
@@ -254,7 +270,7 @@
   <xs:element name="WriteScanValidateACKResponse">
     <xs:complexType>
       <xs:sequence>
-        <xs:element xmlns:q16="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteScanValidateACKResult" nillable="true" type="q16:SdaResEntity" />
+        <xs:element xmlns:q17="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteScanValidateACKResult" nillable="true" type="q17:SdaResEntity" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
@@ -272,7 +288,7 @@
   <xs:element name="WriteStation_XigangGetDataForOutResponse">
     <xs:complexType>
       <xs:sequence>
-        <xs:element xmlns:q17="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteStation_XigangGetDataForOutResult" nillable="true" type="q17:SdaResEntity" />
+        <xs:element xmlns:q18="http://schemas.datacontract.org/2004/07/iWareSda" minOccurs="0" name="WriteStation_XigangGetDataForOutResult" nillable="true" type="q18:SdaResEntity" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
diff --git a/CC/iWareCC_ASRS/Connected Services/StationService/item3.xsd b/CC/iWareCC_ASRS/Connected Services/StationService/item3.xsd
index 6a02b02..db171e8 100644
--- a/CC/iWareCC_ASRS/Connected Services/StationService/item3.xsd
+++ b/CC/iWareCC_ASRS/Connected Services/StationService/item3.xsd
@@ -44,12 +44,13 @@
       <xs:element minOccurs="0" name="W_Destination_Out" nillable="true" type="xs:string" />
       <xs:element minOccurs="0" name="W_Height" type="xs:short" />
       <xs:element minOccurs="0" name="W_InboundFinishConfirm" type="xs:boolean" />
-      <xs:element minOccurs="0" name="W_Inbound_TaskID" type="xs:int" />
+      <xs:element minOccurs="0" name="W_Inbound_TaskID" type="xs:short" />
       <xs:element minOccurs="0" name="W_IsRotate" type="xs:boolean" />
       <xs:element minOccurs="0" name="W_KittingInfo" type="xs:short" />
       <xs:element minOccurs="0" name="W_Length" type="xs:short" />
+      <xs:element minOccurs="0" name="W_Mode" type="xs:short" />
       <xs:element minOccurs="0" name="W_OutboundFinishConfirm" type="xs:boolean" />
-      <xs:element minOccurs="0" name="W_Outbound_TaskID" type="xs:int" />
+      <xs:element minOccurs="0" name="W_Outbound_TaskID" type="xs:short" />
       <xs:element minOccurs="0" name="W_PackageLength" nillable="true" type="xs:string" />
       <xs:element minOccurs="0" name="W_PackageWidth" nillable="true" type="xs:string" />
       <xs:element minOccurs="0" name="W_ReqOut" type="xs:boolean" />
diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_RobotBuffer_ModeChange.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_RobotBuffer_ModeChange.cs"
index d148dc0..082f504 100644
--- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_RobotBuffer_ModeChange.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_RobotBuffer_ModeChange.cs"
@@ -36,7 +36,7 @@
                 {
                     if (SystemValue.isAllowRuning_DataProcess_RobotBuffer_ModeChange && SystemValue.isStartedModel)
                     {
-
+                        var rgvLocation = StationLocationEnum.BZ39.ToString();
                         if (FormCC.IsAllowRunOutMode)
                         {
                             using (WmsDBModel wmsDB = new WmsDBModel())
@@ -52,19 +52,19 @@
                                 rbRunMode.UpdateTime = DateTime.Now;
 
                                 //鎺ㄩ�佺粰PLC鍒囨崲妯″紡
-                                //using (StationServiceClient client = new StationServiceClient())
-                                //{
-                                //    var res = await client.WriteOutStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
-                                //    if (!res.result)
-                                //    {
-                                //        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
-                                //        continue;
-                                //    }
-                                //    else
-                                //    {
-                                //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                //    }
-                                //}
+                                using (StationServiceClient client = new StationServiceClient())
+                                {
+                                    var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.鍑哄簱妯″紡, rgvLocation);
+                                    if (!res.result)
+                                    {
+                                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange = $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 澶辫触,ChangeModeAsync 杩斿洖:{res.resMsg}";
+                                        continue;
+                                    }
+                                    else
+                                    {
+                                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 鎴愬姛,ChangeModeAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                                    }
+                                }
 
 
                                 wmsDB.SaveChanges();
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs
index 4bc889b..3018e1a 100644
--- a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs
@@ -137,6 +137,12 @@
         [Description("鍑哄簱瀹屾垚宸茬‘璁�")]
         public bool W_OutboundFinishConfirm { get; set; }
 
+        /// <summary>
+        /// 妯″紡锛�1锛氬叆搴擄紝 2锛氬嚭搴�   3锛氬己鍒跺嚭搴擄級
+        /// </summary>
+        [Description("妯″紡锛�1锛氬叆搴擄紝 2锛氬嚭搴�   3锛氬己鍒跺嚭搴擄級")]
+        public short W_Mode { get; set; }
+
     }
 
     /// <summary>
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
index 368ac29..9eaee7b 100644
--- a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
@@ -290,6 +290,41 @@
             }
         }
 
+        /// <summary>
+        /// 鍒囨崲妯″紡
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool ChangeMode(string stationCode, int value, out string msg)
+        {
+            try
+            {
+                msg = "";
+                var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+
+                var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_Mode, value, view_stationObj.W_Mode);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation 鍒囨崲妯″紡 鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        stationObj.W_Mode);
+                    return false;
+                }
+
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("鍚慡tatio 鍒囨崲妯″紡 鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        "");
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
         public bool WriteInStoreTaskInfo(string stationCode, string toPlaceNo, short length, short width, short height, out string msg, int inbound_TaskID)
         {
             try
diff --git a/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs b/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs
index ab94395..67113d8 100644
--- a/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs
@@ -110,6 +110,17 @@
         [OperationContract]
         SdaResEntity OutboundFinishConfirm(int deviceId, bool value, string stationCode);
 
+
+        /// <summary>
+        /// 鍒囨崲妯″紡
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="stationCode"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity ChangeMode(int deviceId, int value, string stationCode);
+
         /// <summary>
         /// 鍐欏叆鍏ュ簱浠诲姟淇℃伅
         /// </summary>
diff --git a/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs
index 90b9047..8fc043f 100644
--- a/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs
@@ -503,6 +503,39 @@
         }
 
         /// <summary>
+        /// 鍒囨崲妯″紡
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="stationCode"></param>
+        /// <returns></returns>
+        public SdaResEntity ChangeMode(int deviceId, int value, string stationCode)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.ChangeMode(stationCode, value, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+        /// <summary>
         /// 鍐欏叆鍏ュ簱浠诲姟淇℃伅
         /// </summary>
         /// <param name="deviceId"></param>

--
Gitblit v1.9.3