浏览代码

样本状态

Kevin 6 年之前
父节点
当前提交
c1cbba81e0

+ 67 - 87
Gene_point_Service/.idea/workspace.xml

@@ -5,6 +5,7 @@
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go" beforeDir="false" afterPath="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go" beforeDir="false" afterPath="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go" beforeDir="false" afterPath="$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/dashoo.cn/api/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/src/dashoo.cn/api/main.go" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -18,41 +19,20 @@
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/main.go">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="184">
-              <caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" />
-            </state>
-          </provider>
-        </entry>
-      </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://E:/DASHOO/base_go/src/github.com/gorilla/websocket/conn.go">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="213">
-              <caret line="1023" column="15" selection-start-line="1023" selection-start-column="15" selection-end-line="1023" selection-end-column="15" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go">
+        <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/main.go">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="1932">
-              <caret line="93" column="34" selection-start-line="93" selection-start-column="34" selection-end-line="93" selection-end-column="34" />
+            <state relative-caret-position="212">
+              <caret line="139" column="22" selection-start-line="139" selection-start-column="22" selection-end-line="139" selection-end-column="22" />
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="false">
+      <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="169">
-              <caret line="148" column="39" selection-start-line="148" selection-start-column="39" selection-end-line="148" selection-end-column="39" />
-              <folding>
-                <element signature="e#18#199#0" expanded="true" />
-              </folding>
+            <state relative-caret-position="338">
+              <caret line="105" column="50" selection-start-line="105" selection-start-column="50" selection-end-line="105" selection-end-column="50" />
             </state>
           </provider>
         </entry>
@@ -60,11 +40,8 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="905">
-              <caret line="529" column="38" selection-start-line="529" selection-start-column="33" selection-end-line="529" selection-end-column="38" />
-              <folding>
-                <element signature="e#25#144#0" expanded="true" />
-              </folding>
+            <state relative-caret-position="177">
+              <caret line="427" column="28" selection-start-line="427" selection-start-column="28" selection-end-line="427" selection-end-column="28" />
             </state>
           </provider>
         </entry>
@@ -87,8 +64,10 @@
       <find>ScanNewTaskDetail</find>
       <find>ListenToSendMsg</find>
       <find>TransferPosition</find>
-      <find>Hierarchy</find>
       <find>sampleapply</find>
+      <find>Hierarchy</find>
+      <find>table_sample</find>
+      <find>SampleStatusModify</find>
     </findStrings>
   </component>
   <component name="GOROOT" path="D:\Development\GO" />
@@ -115,18 +94,18 @@
         <option value="$PROJECT_DIR$/src/dashoo.cn/api/controllers/base.go" />
         <option value="$PROJECT_DIR$/src/dashoo.cn/api/routers/router.go" />
         <option value="$PROJECT_DIR$/src/dashoo.cn/api/conf/app.conf" />
-        <option value="$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go" />
+        <option value="$PROJECT_DIR$/src/dashoo.cn/api/main.go" />
         <option value="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go" />
         <option value="$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go" />
-        <option value="$PROJECT_DIR$/src/dashoo.cn/api/main.go" />
+        <option value="$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go" />
       </list>
     </option>
   </component>
   <component name="ProjectFrameBounds" extendedState="6">
-    <option name="x" value="2869" />
-    <option name="y" value="133" />
-    <option name="width" value="864" />
-    <option name="height" value="328" />
+    <option name="x" value="1912" />
+    <option name="y" value="-8" />
+    <option name="width" value="2576" />
+    <option name="height" value="1056" />
   </component>
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
   <component name="ProjectView">
@@ -134,7 +113,6 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
@@ -210,6 +188,7 @@
           <select />
         </subPane>
       </pane>
+      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -222,6 +201,7 @@
     <property name="last_opened_file_path" value="$PROJECT_DIR$/../../dqm_nt/backend" />
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
+    <property name="nodejs_package_manager_path" value="npm" />
     <property name="settings.editor.selected.configurable" value="com.goide.configuration.GoLibrariesConfigurableProvider" />
   </component>
   <component name="RecentsManager">
@@ -294,13 +274,13 @@
     <frame x="1912" y="-8" width="2576" height="1056" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.49766356" visible="true" weight="0.12529834" />
+      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.49766356" visible="true" weight="0.07557677" />
       <window_info id="Structure" order="1" sideWeight="0.50233644" side_tool="true" weight="0.14701195" />
       <window_info id="Favorites" order="2" sideWeight="0.50233644" side_tool="true" weight="0.14701195" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" sideWeight="0.49960256" weight="0.0" />
       <window_info anchor="bottom" id="Run" order="2" weight="0.61915886" />
-      <window_info active="true" anchor="bottom" id="Debug" order="3" sideWeight="0.89467406" visible="true" weight="0.21965317" />
+      <window_info active="true" anchor="bottom" id="Debug" order="3" sideWeight="0.89467406" visible="true" weight="0.30867052" />
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="6" weight="0.32943925" />
@@ -375,24 +355,9 @@
     </option>
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService_test.go" />
-    <entry file="file://E:/DASHOO/base_go/src/github.com/go-xorm/xorm/session_insert.go">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-4357">
-          <caret line="58" column="6" selection-start-line="58" selection-start-column="6" selection-end-line="58" selection-end-column="6" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/mydb/logsinfostruct.go" />
     <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/mydb/mySessionBase.go" />
     <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/mydb/myServiceBase.go" />
-    <entry file="file://D:/Development/GO/src/builtin/builtin.go">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="134">
-          <caret line="70" column="5" selection-start-line="70" selection-start-column="5" selection-end-line="70" selection-end-column="5" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://E:/DASHOO/base_go/src/github.com/go-xorm/core/dialect.go">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="249">
@@ -400,13 +365,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://E:/DASHOO/base_go/src/github.com/go-xorm/xorm/engine.go">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="249">
-          <caret line="29" column="19" selection-start-line="29" selection-start-column="19" selection-end-line="29" selection-end-column="19" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://E:/DASHOO/base_go/src/github.com/astaxie/beego/controller.go">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="686">
@@ -650,10 +608,10 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://E:/DASHOO/common/base_dashoo_common/src/dashoo.cn/utils/db/serviceBase.go">
+    <entry file="file://E:/DASHOO/base_go/src/github.com/gorilla/websocket/conn.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="248">
-          <caret line="85" column="50" selection-start-line="85" selection-start-column="50" selection-end-line="85" selection-end-column="50" />
+        <state relative-caret-position="209">
+          <caret line="1023" column="15" selection-start-line="1023" selection-start-column="15" selection-end-line="1023" selection-end-column="15" />
         </state>
       </provider>
     </entry>
@@ -664,44 +622,66 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go">
+    <entry file="file://D:/Development/GO/src/builtin/builtin.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="905">
-          <caret line="529" column="38" selection-start-line="529" selection-start-column="33" selection-end-line="529" selection-end-column="38" />
-          <folding>
-            <element signature="e#25#144#0" expanded="true" />
-          </folding>
+        <state relative-caret-position="220">
+          <caret line="100" column="4" selection-start-line="100" selection-start-column="4" selection-end-line="100" selection-end-column="4" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go">
+    <entry file="file://E:/DASHOO/common/base_dashoo_common/src/dashoo.cn/utils/db/serviceBase.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="169">
-          <caret line="148" column="39" selection-start-line="148" selection-start-column="39" selection-end-line="148" selection-end-column="39" />
-          <folding>
-            <element signature="e#18#199#0" expanded="true" />
-          </folding>
+        <state relative-caret-position="275">
+          <caret line="614" column="22" selection-start-line="614" selection-start-column="22" selection-end-line="614" selection-end-column="22" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go">
+    <entry file="file://D:/Development/GO/src/strings/strings.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1932">
-          <caret line="93" column="34" selection-start-line="93" selection-start-column="34" selection-end-line="93" selection-end-column="34" />
+        <state relative-caret-position="168">
+          <caret line="97" column="5" selection-start-line="97" selection-start-column="5" selection-end-line="97" selection-end-column="5" />
         </state>
       </provider>
     </entry>
-    <entry file="file://E:/DASHOO/base_go/src/github.com/gorilla/websocket/conn.go">
+    <entry file="file://E:/DASHOO/base_go/src/github.com/go-xorm/xorm/engine.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="213">
-          <caret line="1023" column="15" selection-start-line="1023" selection-start-column="15" selection-end-line="1023" selection-end-column="15" />
+        <state relative-caret-position="230">
+          <caret line="1348" column="22" selection-start-line="1348" selection-start-column="22" selection-end-line="1348" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://E:/DASHOO/base_go/src/github.com/go-xorm/xorm/session_find.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="239">
+          <caret line="24" column="24" selection-start-line="24" selection-start-column="24" selection-end-line="24" selection-end-column="24" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converse.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="786">
+          <caret line="216" column="46" selection-start-line="216" selection-start-column="46" selection-end-line="216" selection-end-column="46" />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/main.go">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="184">
-          <caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" />
+        <state relative-caret-position="212">
+          <caret line="139" column="22" selection-start-line="139" selection-start-column="22" selection-end-line="139" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/business/converseService/converseService.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="177">
+          <caret line="427" column="28" selection-start-line="427" selection-start-column="28" selection-end-line="427" selection-end-column="28" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/dashoo.cn/api/controllers/converse/converse.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="338">
+          <caret line="105" column="50" selection-start-line="105" selection-start-column="50" selection-end-line="105" selection-end-column="50" />
         </state>
       </provider>
     </entry>

+ 123 - 17
Gene_point_Service/src/dashoo.cn/api/business/converseService/converse.go

@@ -1,5 +1,16 @@
 package converseService
 
+import "time"
+
+const UNEXECUTED = 0
+const SENT = 1
+const ACCEPT = 2
+const ACTIVE = 3
+const FAILED = 4
+const SUCCESS = 5
+const RUNNING = 6
+const REJECT = 7
+
 type RequestEntity struct {
 	Request string      `json:"request"`
 	Time    string      `json:"time"`
@@ -42,9 +53,46 @@ type ResponseData struct {
 	Is_end         bool          `json:"is_end,omitempty"`
 	Execution_time int           `json:"execution_time,omitempty"`
 	Exceptions     []Exception	 `json:"exceptions,omitempty"`
-	Actual_data    []interface{} `json:"actual_data,omitempty"`
-	Abnormal_data  []interface{} `json:"abnormal_data,omitempty"`
-	List           []interface{} `json:"list,omitempty"`
+	Actual_data    []Single      `json:"actual_data,omitempty"`
+	Abnormal_data  Abmormal_data      `json:"abnormal_data,omitempty"`
+	List           []List_Data 	 `json:"list,omitempty"`
+}
+
+type List_Data struct {
+
+	Index 			int 		`json:"index,omitempty"`
+	Rack 			int 		`json:"rack,omitempty"`
+
+	Tube 			int			`json:"tube,omitempty"`
+	Tube_number 	int			`json:"tube_number,omitempty"`
+
+	No			    int    		`json:"no,omitempty"`
+	Id 				string 		`json:"id,omitempty"`
+
+	Cu 				int			`json:"cu,omitempty"`
+	Addr 			string		`json:"addr,omitempty"`
+	Type 			string		`json:"type,omitempty"`
+	Value 			string		`json:"value,omitempty"`
+
+	Ltu  		    int 		`json:"ltu,omitempty"`
+	Group    	    int 		`json:"group,omitempty"`
+	Unit     	    int 		`json:"unit,omitempty"`
+	Pos  		    int 		`json:"pos,omitempty"`
+	Rack_id  	    string 		`json:"rack_id,omitempty"`
+
+}
+
+//type Result_data struct {
+//	Rack 			int 		`json:"rack,omitempty"`
+//	Rack_id  	    string 		`json:"rack_id,omitempty"`
+//	Tube 			int			`json:"tube,omitempty"`
+//	Target			Target		`json:"target,omitempty"`
+//	Tubes			[]Tube		`json:"tubes,omitempty"`
+//
+//}
+type Abmormal_data struct {
+	Racks		[]Single
+	Tubes 		[]Single
 }
 
 type Source struct {
@@ -64,29 +112,41 @@ type Target struct {
 	Rack_id string `json:"rack_id,omitempty"`
 }
 
-type Hierarchy struct {
-	Cu    int `json:"cu"`
-	Ee    int `json:"ee"`
-	Ltu   int `json:"ltu"`
-	Group int `json:"group"`
-	Unit  int `json:"unit"`
-	Pos   int `json:"pos"`
-}
+//type Hierarchy struct {
+//	//Cu    int `json:"cu"`
+//	Ltu   int `json:"ltu"`
+//	Group int `json:"group"`
+//	Unit  int `json:"unit"`
+//	Pos   int `json:"pos"`
+//	Rack_id string `json:"rack_id"`
+//}
+
+//type Rack struct {
+//	Index 			int
+//	Rack 			int
+//	Rack_id 		string
+//	Tube 			int
+//	Tube_number 	int
+//}
 
 type Tube struct {
 	No int    `json:"no,omitempty"`
 	Id string `json:"id,omitempty"`
 	T_no int	`json:"t_no,omitempty"`
 	S_no int	`json:"s_no,omitempty"`
+	Oper bool 	`json:"oper,omitempty"`
 }
 
 type Single struct {
-	Rack    int    `json:"rack,omitempty"`
-	Tube    int    `json:"tube,omitempty"`
-	Rack_id string `json:"rack_id,omitempty"`
-	Source  Source `json:"source,omitempty"`
-	Target  Target `json:"target,omitempty"`
-	Tubes   []Tube `json:"tubes"`
+	Rack   		int    `json:"rack,omitempty"`
+	Tube   	 	int    `json:"tube,omitempty"`
+	Id 			string `json:"id,omitempty"`
+	Rack_id 	string `json:"rack_id,omitempty"`
+	Source  	Source `json:"source,omitempty"`
+	Target  	Target `json:"target,omitempty"`
+	Tubes   	[]Tube `json:"tubes"`
+	Exceptions 	[]int  `json:"exceptions,omitempty"`
+
 }
 
 type Cause struct {
@@ -99,6 +159,15 @@ type Exception struct {
 	Codes 	[]int	`json:"codes,omitempty"`
 }
 
+
+type GenePoint_Device_Report_Data struct {
+	Cu 		int			`json:"cu,omitempty"`
+	Addr 	string		`json:"addr,omitempty"`
+	Type 	string		`json:"type,omitempty"`
+	Value 	string		`json:"value,omitempty"`
+	RecordTime    time.Time
+}
+
 type Sample_Storage_Task struct {
 	Id 			int
 	Task_id 	string
@@ -134,3 +203,40 @@ type Sample_Storage_Task struct {
 	Remark 		string
 
 }
+
+type Id struct {
+	Id	int
+}
+
+type Bank_Apply_Detail struct {
+	Id             int       `xorm:"not null pk autoincr INT(10)"`
+	ParentId       int       `xorm:"int(10)"` //父类id
+	BarCode        string    `xorm:"VARCHAR(50)"`
+	SampleCode     string    `xorm:"VARCHAR(50)"`
+	SampleType     int       `xorm:"INT(10)"`
+	SampleTypeName string    `xorm:"VARCHAR(50)"` //样本类型
+	InitCapacity   float32   `xorm:"FLOAT"`
+	Capacity       float32   `xorm:"FLOAT"`
+	TaskStatus	   int		 `xorm:"INT(4)"`
+	Unit           string    `xorm:"VARCHAR(50)"`
+	EquipmentId    int       `xorm:"INT(10)"`
+	ShelfId        int       `xorm:"INT(10)"`
+	BoxId          int       `xorm:"INT(10)"`
+	Position       string    `xorm:"VARCHAR(50)"` //位置 冻存盒的 X代表第几列 Y代表第几行  X;
+	PositionInfo      string    `xorm:"VARCHAR(100)"` //列表中显示的位置信息(容器+层+盒+position)
+	CHUserId       int       `xorm:"INT(10)"`
+	CHUserBy       string    `xorm:"VARCHAR(50)"`
+	CancelId       int       `xorm:"INT(10)"`
+	CancelBy       string    `xorm:"VARCHAR(50)"`
+	DetailStatus   int       `xorm:"int(10)"`
+	CreateOn       time.Time `xorm:"DATETIME created"` //创建时间
+	CreateUserId   int       `xorm:"INT(10)"`
+	CreateBy       string    `xorm:"VARCHAR(50)"` //创建人
+	ModifiedOn     time.Time `xorm:"DATETIME updated"`
+	ModifiedUserId int       `xorm:"INT(10)"`
+	ModifiedBy     string    `xorm:"VARCHAR(50)"`
+	RecoveryId     int       `xorm:INT(10)`
+	DetailId       int       `xorm:INT(10)`
+	IsLocked       int        `xorm:INT(10)`
+
+}

+ 158 - 7
Gene_point_Service/src/dashoo.cn/api/business/converseService/converseService.go

@@ -2,6 +2,7 @@ package converseService
 
 import (
 	"crypto/md5"
+	"dashoo.cn/utils"
 	. "dashoo.cn/utils/db"
 	"fmt"
 	"github.com/go-xorm/xorm"
@@ -17,11 +18,21 @@ const POS = 1
 const LTU = 1
 const GROUP = 1
 const TABLE_TAST = "sample_storage_task"
-const TABLE_SAMPLE = "bank_apply_main"
+const TABLE_SAMPLE_APPLY = "bank_apply_main"
 const TABLE_DETAIL = "bank_apply_detail"
 const TABLE_SHELF = "bank_shelf"
 const TABLE_BOX = "bank_box"
 const TABLE_EQUIPMENT = "bank_equipment"
+const TABLE_DEVICE_DATA = "GenePoint_Device_Report_Data"
+const TABLE_SAMPLE = "bank_sample"
+const TABLE_APPLY_DETAIL = "bank_apply_detail"
+const STATUS_LOCKED = "1"
+const STATUS_UNLOCK = "0"
+const RK_PASS = "2"
+const CK_PASS_ONHOLD = "3"
+const CK_PASS_DONE = "4"
+
+
 
 
 type ConverseService struct {
@@ -269,7 +280,7 @@ func handleRackRetrieve(entity *RequestEntity, detail *Sample_Storage_Task){
 		ones = entity.Data.Task_data.([]Single)
 	}
 	one.Rack_id = detail.BoxBarcode
-	one.Target.Cu = CU		//todo
+	one.Target.Cu = detail.Cu		//todo
 	one.Target.Ee = EE
 	one.Target.Pos = POS
 	ones = append(ones, one)
@@ -381,11 +392,134 @@ func (this *ConverseService) TaskStatusModify(statusCode int, task_id string)  e
 
 // 修改出入库单状态
 func (this *ConverseService) SampleApplyStatusModify(statusCode int, entryNo string) error{
-	sql := "UPDATE " + TABLE_SAMPLE + " SET taskstatus = '" + strconv.Itoa(statusCode) + "' WHERE entryno = '" + entryNo + "'"
+	sql := "UPDATE " + TABLE_SAMPLE_APPLY + " SET taskstatus = '" + strconv.Itoa(statusCode) + "' WHERE entryno = '" + entryNo + "'"
 	_,err := this.DBE.Exec(sql)
 	return err
 }
 
+////批量更新全部成功或失败的任务样本状态
+//func (this *ConverseService)SampleApplyDetailStatusBatchModify(statusCode int , entryNo string) error {
+//
+//	//获取出入库单Id
+//	getId := "SELECT id FROM " + TABLE_SAMPLE_APPLY + " WHERE entryno = '" + entryNo + "'"
+//	var idList []Id
+//	err := this.DBE.SQL(getId).Find(&idList)
+//	//批量更新全部成功或失败的任务样本状态
+//	sql:= "UPDATE " + TABLE_APPLY_DETAIL + " SET taskstatus = '" + strconv.Itoa(statusCode) + "' WHERE parentid = '" + strconv.Itoa(idList[0].Id) + "'"
+//	_,err = this.DBE.Exec(sql)
+//
+//	return  err
+//}
+
+//修改全部样本执行成功状态
+func (this *ConverseService)ModifySampleALLSuccessStatus(res ResponseEntity){
+	fmt.Printf("%res",res)
+	tubeIds := handleSingleList(res.Data.Actual_data)
+	this.handleSampleSuccess(tubeIds, res.Response)
+}
+
+//修改全部样本执行失败状态
+func (this *ConverseService)ModifySampleALLFailedStatus(res ResponseEntity){
+	tubeIds := handleSingleList(res.Data.Actual_data)
+	this.handleSampleFailed(tubeIds, res.Response)
+}
+
+//任务执行驳回, 修改全部样本失败状态
+func (this *ConverseService)ModifySampleAllRejectStatus(res ResponseEntity) error{
+		//获取出入库单Id
+		getId := "SELECT id FROM " + TABLE_SAMPLE_APPLY + " WHERE entryno = '" + res.Data.Task_id + "'"
+		var idList []Id
+		err := this.DBE.SQL(getId).Find(&idList)
+		//批量更新全部成功或失败的任务样本状态
+		sql:= "UPDATE " + TABLE_APPLY_DETAIL + " SET taskstatus = '" + strconv.Itoa(REJECT) + "' WHERE parentid = '" + strconv.Itoa(idList[0].Id) + "'"
+		_,err = this.DBE.Exec(sql)
+		return err
+}
+
+//修改部分样本执行成功部分样本执行失败状态
+func (this *ConverseService)SampleApplyDetailStatusPartsModify(res ResponseEntity){
+
+	tubeIds := handleSingleList(res.Data.Actual_data)
+	this.handleSampleSuccess(tubeIds, res.Response)
+	tubeIds = handleSingleList(res.Data.Abnormal_data.Tubes)
+	this.handleSampleFailed(tubeIds, res.Response)
+
+}
+
+//处理single切片
+func handleSingleList(singles []Single) string{
+	var tubeIds []string
+	for _, data := range singles {
+		for _, tube := range data.Tubes {
+			if tube.Oper == true {
+				tubeIds = append(tubeIds,tube.Id)
+			}
+		}
+	}
+	//id拼接成","隔开的字符串
+	idStr := strings.Replace(strings.Trim(fmt.Sprint(tubeIds), "[]"), " ", ",", -1)
+	return idStr
+}
+
+
+
+
+//修改样本失败状态
+func (this *ConverseService)handleSampleFailed(idsStr string, response string) {
+	updatesql := "UPDATE " + TABLE_APPLY_DETAIL + " SET taskstatus = '" + strconv.Itoa(FAILED) + "' WHERE barcode IN (" + idsStr + ")"
+	this.DBE.Exec(updatesql)
+}
+
+//处理样本执行成功状态
+func (this *ConverseService)handleSampleSuccess(idsStr string, response string) {
+	if strings.Contains(response,"_storing")  {
+		this.sampleRKSuccessDBModify(idsStr)
+	}else if strings.Contains(response,"_retrieving") {
+		this.sampleCKSuccessDBModify(idsStr)
+	}
+
+}
+
+//入库成功, 修改样本数据库状态信息
+func (this *ConverseService)sampleRKSuccessDBModify(idsStr string) error{
+	updatesql := "UPDATE " + TABLE_APPLY_DETAIL + " SET IsLocked = '" + STATUS_UNLOCK + "', taskstatus = '" + strconv.Itoa(SUCCESS) + "' WHERE barcode IN (" + idsStr + ")"
+	updatesql2 := "UPDATE " + TABLE_SAMPLE + " SET IsLocked = '" + STATUS_UNLOCK + "', IState = '" + RK_PASS + "' WHERE barcode IN (" + idsStr + ")"
+	_,err := this.DBE.Exec(updatesql)
+	_,err = this.DBE.Exec(updatesql2)
+	return err
+}
+
+//出库成功, 修改样本数据库状态信息
+func (this *ConverseService) sampleCKSuccessDBModify (idStr string) error{
+	var list []Bank_Apply_Detail
+	var onHold []string
+	var done []string
+	err := this.DBE.Where("barcode IN (" + idStr + ")").Find(&list)
+	for _, one := range list {
+		if strconv.Itoa(one.RecoveryId) == CK_PASS_ONHOLD {
+			onHold = append(onHold,one.BarCode)
+		} else if strconv.Itoa(one.RecoveryId) == CK_PASS_DONE {
+			done = append(done,one.BarCode)
+		}
+	}
+	sql := "UPDATE " + TABLE_SAMPLE + " SET istate = '" + CK_PASS_ONHOLD + "' WHERE barcode IN (" + strings.Join(onHold,",") + ")"
+	sql2 := "UPDATE " + TABLE_SAMPLE + " SET istate = '" + CK_PASS_DONE + "' WHERE barcode IN (" + strings.Join(done,",") + ")"
+	_,err = this.DBE.Exec(sql)
+	_,err = this.DBE.Exec(sql2)
+	return err
+}
+
+////样本状态修改
+//func (this *ConverseService)SampleStatusModify(statusCode int , res ResponseEntity){
+//	if statusCode == SUCCESS {
+//		this.SampleApplyDetailStatusBatchModify(statusCode, res.Data.Task_id)
+//	}else if statusCode == REJECT {
+//		this.SampleApplyDetailStatusBatchModify(FAILED, res.Data.Task_id)
+//	}else if statusCode == FAILED {
+//		this.SampleApplyDetailStatusPartsModify(res)
+//	}
+//}
+
 //获取任务原始信息
 //func (this *ConverseService) GetBasicTaskInfo(task_id string) ([]Sample_Storage_Task, error){
 //	sql := `SELECT
@@ -410,7 +544,7 @@ func (this *ConverseService) SampleApplyStatusModify(statusCode int, entryNo str
 //				JOIN ` + TABLE_EQUIPMENT + ` e ON d.EquipmentId = e.Id
 //				JOIN ` + TABLE_SHELF + ` s ON d.ShelfId = s.Id
 //				JOIN ` + TABLE_BOX + ` b ON d.BoxId = b.Id
-//				JOIN ` + TABLE_SAMPLE + ` a ON d.ParentId = a.Id
+//				JOIN ` + TABLE_SAMPLE_APPLY + ` a ON d.ParentId = a.Id
 //			WHERE
 //				a.EntryNo = '` + task_id + `' AND a.ApplyStatus = '2'`
 //	var list []Sample_Storage_Task
@@ -465,7 +599,7 @@ func (this *ConverseService) SaveTaskExcepMsg(msg,taskId string) error{
 
 //保存异常信息
 func (this *ConverseService) SaveSampleExcepMsg(msg,entryNo string) error{
-	sql := "UPDATE " + TABLE_SAMPLE+ " SET exception = '" + msg + "' WHERE entryno = '" + entryNo + "'"
+	sql := "UPDATE " + TABLE_SAMPLE_APPLY+ " SET exception = '" + msg + "' WHERE entryno = '" + entryNo + "'"
 	_,err := this.DBE.Exec(sql)
 	return err
 }
@@ -508,10 +642,10 @@ func GetReason(cause Cause) string{
 		reasonStr = "单次任务涉及的冻存盒数量超出限制;"
 		break
 	case 3:
-		reasonStr = "指定的位置已经被占用或者位置不正确,无法存入;"
+		reasonStr = "指定的位置已经被占用或者位置不正确,无法存入;"
 		break
 	case 4:
-		reasonStr = "表示没有权限对指定位置进行操作;"
+		reasonStr = "没有权限对指定位置进行操作;"
 		break
 	case 5:
 		reasonStr = "指定的编号不正确,无法完成操作;"
@@ -561,4 +695,21 @@ func HandleExceptions (excepts []Exception) string {
 		}
 	}
 	return exceptStr
+}
+
+//处理返回设备状态数据, 并存储到数据表里
+func RecordDeviceData(list []List_Data){
+	 t := time.Now()
+	var data []GenePoint_Device_Report_Data
+	for _, one := range list {
+		var piece GenePoint_Device_Report_Data
+		piece.Cu = one.Cu
+		piece.Addr = one.Addr
+		piece.Type = one.Type
+		piece.Value = one.Value
+		piece.RecordTime = t
+		data = append(data,piece)
+	}
+	svc := GetConverseService(utils.DBE)
+	svc.InsertEntity(data)
 }

+ 66 - 41
Gene_point_Service/src/dashoo.cn/api/controllers/converse/converse.go

@@ -1,7 +1,7 @@
 package converse
 
 import (
-	"dashoo.cn/api/business/converseService"
+	."dashoo.cn/api/business/converseService"
 	"dashoo.cn/utils"
 	"encoding/json"
 	"fmt"
@@ -16,20 +16,13 @@ type ConverseController struct {
 	beego.Controller
 }
 
-const UNEXECUTED = 0
-const SENT = 1
-const ACCEPT = 2
-const ACTIVE = 3
-const FAILED = 4
-const SUCCESS = 5
-const RUNNING = 6
-const REJECT = 7
 
 
-func (this *ConverseController) SearchDatabase() map[string]*converseService.RequestEntity{
-	svc := converseService.GetConverseService(utils.DBE)
+
+func (this *ConverseController) SearchDatabase() map[string]*RequestEntity{
+	svc := GetConverseService(utils.DBE)
 	tasks := svc.ScanNewTaskDetail()
-	var reqMap = make(map[string]*converseService.RequestEntity)
+	var reqMap = make(map[string]*RequestEntity)
 
 	//依次处理每一条新任务信息
 	for _, value := range tasks {
@@ -54,7 +47,7 @@ func (this *ConverseController) SearchDatabase() map[string]*converseService.Req
 func (this *ConverseController) GetConnection(c *websocket.Conn) {
 	// 建立会话
 	log.Println("建立会话")
-	svc := converseService.GetConverseService(utils.DBE)
+	svc := GetConverseService(utils.DBE)
 	utc := time.Now().UTC().Format(time.RFC3339)
 	req := svc.GetSessionSetupRequest(utc)
 
@@ -68,7 +61,7 @@ func (this *ConverseController) GetConnection(c *websocket.Conn) {
 	//}
 }
 
-func (this *ConverseController) SendMessage(req *converseService.RequestEntity, conn *websocket.Conn) {
+func (this *ConverseController) SendMessage(req *RequestEntity, conn *websocket.Conn) {
 	err := conn.WriteJSON(&req)
 	if err != nil {
 		log.Println("write err:", err)
@@ -77,7 +70,7 @@ func (this *ConverseController) SendMessage(req *converseService.RequestEntity,
 
 //修改任务状态码
 func (this *ConverseController) StatusModify(statusCode int , task_id string) error{
-	svc := converseService.GetConverseService(utils.DBE)
+	svc := GetConverseService(utils.DBE)
 	//修改任务表任务状态
 	err := svc.TaskStatusModify(statusCode,task_id)
 	if err != nil {
@@ -88,33 +81,69 @@ func (this *ConverseController) StatusModify(statusCode int , task_id string) er
 	if err != nil {
 		return err
 	}
+
+	//if statusCode == SUCCESS || statusCode == REJECT {
+	//	svc.SampleApplyDetailStatusBatchModify(statusCode,task_id)
+	//}
+
 	return nil
 }
 
+//修改部分执行成功样本状态
+func (this *ConverseController)SamplePartsStatusModify(res ResponseEntity){
+	svc :=  GetConverseService(utils.DBE)
+	svc.SampleApplyDetailStatusPartsModify(res)
+}
+
+//修改全部执行成功或失败样本状态
+func (this *ConverseController)SampleAllStatusModify(res ResponseEntity, statusCode int){
+	svc := GetConverseService(utils.DBE)
+	if statusCode == SUCCESS {
+		svc.ModifySampleALLSuccessStatus(res)
+	}else if statusCode == FAILED {
+		svc.ModifySampleALLFailedStatus(res)
+	}else if statusCode == REJECT {
+		err := svc.ModifySampleAllRejectStatus(res)
+		fmt.Printf("reject handle error: ",err)
+	}
+}
+
 //处理读到的信息
 func (this *ConverseController) HandleMessage(n int, message []byte){
-	var res converseService.ResponseEntity
+	var res ResponseEntity
 	json.Unmarshal(message,&res)
-	log.Println("res:",&res)
+	//调试临时用, 把设备信息打印忽略
+	if res.Response != "report_data" {
+		log.Println("res:",&res)
+	}
 	result := res.Result
 	taskId := res.Data.Task_id
 	isEnd := res.Data.Is_end
 	taskType := res.Data.Type
+	//response := res.Response
+
+	//处理设备状态数据
+	/*if response == "report_data" {
+		converseService.RecordDeviceData(res.Data.List)
+	}*/
+
 	var err error
 	//如果正常响应且任务执行成功则修改任务状态为成功
-	if result == 200 && res.Data.Abnormal_data == nil {
-		if isEnd && taskType == "end" {
+	if result == 200 {
+		if taskType == "end" {
 			log.Println(">>>>>>>>>>修改成功状态>>>>>>>>>>")
-			err = this.StatusModify(SUCCESS,taskId)
-		}else if taskType== "abnormal_end" {
-			log.Println("----------修改失败状态----------")
-			//保存异常信息
-			this.SaveExcepMsg(res,taskId)
-			err = this.StatusModify(FAILED,taskId)
-		}else if isEnd && taskType == "abnormal_end"{
-			log.Println("----------修改失败状态----------")
-			this.SaveExcepMsg(res,taskId)
-			err = this.StatusModify(FAILED,taskId)
+			if isEnd {
+				err = this.StatusModify(SUCCESS,taskId)
+			}
+			this.SampleAllStatusModify(res,SUCCESS)
+		}else if  taskType== "abnormal_end" {
+			if isEnd {
+				log.Println("----------修改失败状态----------")
+				//保存异常信息
+				this.SaveExcepMsg(res, taskId)
+				err = this.StatusModify(FAILED, taskId)
+			}
+			this.SamplePartsStatusModify(res)
 		}else if taskType == "task_activate" {
 			log.Println(">>>>>>>>>>修改激活状态>>>>>>>>>>")
 			err = this.StatusModify(ACTIVE,taskId)
@@ -130,25 +159,21 @@ func (this *ConverseController) HandleMessage(n int, message []byte){
 				//保存异常信息
 				this.SaveExcepMsg(res,taskId)
 				err = this.StatusModify(REJECT,taskId)
-	}else if result != 200 || (isEnd && res.Data.Abnormal_data != nil) {
-		log.Println("----------修改失败状态----------")
-		//保存异常信息
-		this.SaveExcepMsg(res,taskId)
-		//修改状态为失败
-		err = this.StatusModify(FAILED,taskId)
+				this.SampleAllStatusModify(res,REJECT)
 	}
+
 	if err != nil {
 		log.Println(err)
 	}
 }
 
 //保存异常信息
-func (this *ConverseController) SaveExcepMsg(res converseService.ResponseEntity,taskId string) {
+func (this *ConverseController) SaveExcepMsg(res ResponseEntity,taskId string) {
 	//causeByte,_ := json.Marshal(res.Data.Causes)
 	//causeMsg := string(causeByte)
-	causeMsg := converseService.HandleCauses(res.Data.Causes)
+	causeMsg := HandleCauses(res.Data.Causes)
 	fmt.Println("causeMsg: |",causeMsg,"|")
-	exceptMsg := converseService.HandleExceptions(res.Data.Exceptions)
+	exceptMsg := HandleExceptions(res.Data.Exceptions)
 	//abnormalByte,_ := json.Marshal(res.Data.Abnormal_data)
 	//abnormalMsg := string(abnormalByte)
 	fmt.Println("exceptMsg:  |",exceptMsg,"|")
@@ -163,7 +188,7 @@ func (this *ConverseController) SaveExcepMsg(res converseService.ResponseEntity,
 	}
 
 
-	svc := converseService.GetConverseService(utils.DBE)
+	svc := GetConverseService(utils.DBE)
 	if totalMsg != "" {
 		svc.SaveTaskExcepMsg(totalMsg,taskId)
 		svc.SaveSampleExcepMsg(totalMsg,taskId)
@@ -179,8 +204,8 @@ func (this *ConverseController) SaveExcepMsg(res converseService.ResponseEntity,
 //清理已完成任务信息
 func (this *ConverseController) DeleteAccomplishedTask() error{
 	where := "statuscode = '"+ strconv.Itoa(SUCCESS) +"'"
-	svc := converseService.GetConverseService(utils.DBE)
-	err := svc.DeleteEntityBytbl(converseService.TABLE_TAST, where)
+	svc := GetConverseService(utils.DBE)
+	err := svc.DeleteEntityBytbl(TABLE_TAST, where)
 	log.Println("===============清除任务信息===============")
 	if err != nil {
 		log.Println(err)

+ 5 - 3
Gene_point_Service/src/dashoo.cn/api/main.go

@@ -1,6 +1,7 @@
 package main
 
 import (
+	"dashoo.cn/api/business/converseService"
 	"dashoo.cn/api/controllers/converse"
 	"dashoo.cn/utils"
 	"fmt"
@@ -15,11 +16,11 @@ import (
 	"github.com/gorilla/websocket"
 )
 
-//const gpServiceUrl = "ws://39.105.83.226:22225/socket"
+const gpServiceUrl = "ws://39.105.83.226:22225/socket"
 //const gpServiceUrl = "ws://39.105.83.226:22368/socket"
 //const gpServiceUrl = "ws://fdgfghfg.oicp.net:48681/socket"
 //const gpServiceUrl = "ws://fdgfghfg.oicp.net:23248/socket"
-const gpServiceUrl = "ws://270100d53m.wicp.vip:46538/socket"
+//const gpServiceUrl = "ws://270100d53m.wicp.vip:46538/socket"
 
 //var conn *websocket.Conn
 var err error
@@ -147,6 +148,7 @@ func ListenToSendMsg(conn *websocket.Conn){
 	tick := "*/5 * * * * ?"
 	err = cron.AddFunc(tick, func() {
 		//如果已连接则发送任务
+
 		reqMap := ctrl.SearchDatabase()
 		if err != nil {
 			log.Println("read err:", err)
@@ -158,7 +160,7 @@ func ListenToSendMsg(conn *websocket.Conn){
 			if err != nil {
 				log.Println("write err:", err)
 			}else{
-				err = ctrl.StatusModify(converse.SENT, taskId)
+				err = ctrl.StatusModify(converseService.SENT, taskId)
 			}
 		}
 	})