Zhouzhendong 5 лет назад
Родитель
Сommit
879b0122e9

+ 1 - 2
app/Http/Controllers/ProcessStatisticController.php

@@ -17,7 +17,7 @@ class ProcessStatisticController extends Controller
         $processStatistics=app("processStatisticService")->paginate($request->input());
         $owners=app("ownerService")->getSelection();
         $processMethods=app("processMethodService")->getSelection();
-        return view('process.statistic',['processStatistics'=>$processStatistics,'owners'=>$owners,'processMethods'=>$processMethods]);
+        return view('process.statistic',['processStatistics'=>$processStatistics,'params'=>$request->input(),'owners'=>$owners,'processMethods'=>$processMethods]);
     }
 
     public function export(Request $request){
@@ -37,7 +37,6 @@ class ProcessStatisticController extends Controller
         $rule = ["gross_profit_rate"=> "percent", "started_at"=>"mysqlDate", "ended_at"=>"mysqlDate", "process_created_at"=>"mysqlDate"];
         $post = Http::post(config('go.export.url'),['type'=>'unify','sql'=>$sql, 'connection'=>'mysql',
             'row'=>json_encode($row,JSON_UNESCAPED_UNICODE), 'column'=>json_encode($column), 'rule'=>json_encode($rule)]);
-
         if ($post->status() == 500){
             throw new Exception($post->header("Msg"));
         }

+ 13 - 2
app/Http/Controllers/api/thirdPart/flux/StoreController.php

@@ -505,10 +505,21 @@ class StoreController extends Controller
                         $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT COUNT(*) FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.locationid = b.LocationID WHERE b.WarehouseID = '".
                         $IN_Warehouse."' AND TraceID = '".$In_New_TraceID."' AND sku <> '".$In_SKU."' AND qty>0"));
                         if ($TABLE_INV_LOT_LOC_ID) return '273';
-                    }elseif ($r_RCV_MIX_GR1 == 'N'){}//TODO 1065行
+                    }elseif ($r_RCV_MIX_GR1 == 'N'){
+                        $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT count(1) FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.locationid = b.LocationID INNER JOIN Bas_Sku C ON A.CUSTOMERID = C.CUSTOMERID AND A.SKU = C.SKU WHERE b.WarehouseID = '".
+                            $IN_Warehouse."' AND TraceID='".$In_New_TraceID."' AND C.SKU_GROUP1 <> '".$r_SKU_Group1."' AND qty>0"));
+                        if ($TABLE_INV_LOT_LOC_ID)return '273';
+                    }
+                    //ID是否重复
+                    $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT COUNT(*) FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b on a.locationid = b.LocationID where b.WarehouseID ='".
+                        $IN_Warehouse."' AND a.LocationID<>'".$In_TOLocation."' AND a.TraceID='".$In_New_TraceID."' AND a.QTY>0"));
+                    if ($TABLE_INV_LOT_LOC_ID)return '218'.$In_New_TraceID;
                 }
-            }
+            }else $In_New_TraceID = '*';
         }
+
+        //r_QtyOnHold:=0
+        if (!trim($In_HoldRejectCode)) $In_HoldRejectCode = 'OK'; //TODO 1098行
         return $OUT_Return_Code;
     }
 

+ 1 - 0
resources/views/process/statistic.blade.php

@@ -74,6 +74,7 @@
                 <td><span v-if="processStatistic.process">@{{ processStatistic.process.balance_remark }}</span></td>
             </tr>
         </table>
+        {{$processStatistics->appends($params)->links()}}
     </div>
 @endsection
 

+ 35 - 10
serves/excelExportGo/api/controller/controller.go

@@ -1,12 +1,12 @@
 package controller
 
 import (
-	"bswas/excel"
-	"bswas/orm"
-	"bswas/utilities"
-	"encoding/json"
-	"net/http"
-	"strconv"
+    "bswas/excel"
+    "bswas/orm"
+    "bswas/utilities"
+    "encoding/json"
+    "net/http"
+    "strconv"
 )
 
 func Export(w http.ResponseWriter,req *http.Request)  {
@@ -204,18 +204,24 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
 		if err != nil {
 			utilities.WriteLog("/api/controller/controller.go:205   参数传递错误!","ERROR")
 		}
+		if params["mergeColumn"] != ""{
+		    err = json.Unmarshal([]byte(params["mergeColumn"]), &mergeColumn)
+            if err != nil {
+                utilities.WriteLog("/api/controller/controller.go:210   参数传递错误!","ERROR")
+            }
+        }
 		err = json.Unmarshal([]byte(params["rule"]), &rule)
 		if params["connection"] == "oracle" {
 			data = orm.GetOracleData(params["sql"])
 		}else{
 			data = orm.GetMysqlData(params["sql"])
 		}
-		list = unifyFormat(data, column, rule)
+		list, mergeRow = unifyFormat(data, column, rule, params["datum"])
 	}
 	return row,list,mergeRow,mergeColumn
 }
 
-func unifyFormat(data []map[string]string, row []string, rule map[string]string) [][]interface{}{
+func unifyFormat(data []map[string]string, row []string, rule map[string]string, datum string) ([][]interface{}, map[string]string){
 	rowLen := len(row)
 	column :=  make(map[string]int,rowLen)
 	for i,c := range row {
@@ -223,7 +229,26 @@ func unifyFormat(data []map[string]string, row []string, rule map[string]string)
 	}
 
 	list := make([][]interface{},len(data))
+    mergeRow := make(map[string]string)
+    var columnName string
+    var startIndex int
+    rowAmount := 0
 	for k,v := range data{
+        if datum != "" {
+            if columnName == v[datum] {
+                rowAmount++
+            }else{
+                if rowAmount != 0 {
+                    mergeRow[strconv.Itoa(startIndex+2)] = strconv.Itoa(startIndex+2+rowAmount)
+                }
+                columnName = v[datum]
+                startIndex = k
+                rowAmount = 0
+            }
+            if rowAmount != 0 {
+                mergeRow[strconv.Itoa(startIndex+2)] = strconv.Itoa(startIndex+2+rowAmount)
+            }
+        }
 		line := make([]interface{},rowLen)
 		for key,value := range column {
 			if rule[key] != ""{
@@ -234,7 +259,7 @@ func unifyFormat(data []map[string]string, row []string, rule map[string]string)
 		}
 		list[k] = line
 	}
-	return list
+	return list, mergeRow
 }
 
 func dataFormat(ruleType string,value string)string{
@@ -250,4 +275,4 @@ func dataFormat(ruleType string,value string)string{
 			}
 	}
 	return value
-}
+}