Просмотр исходного кода

Merge branch 'master' into Order_RejectedBill_version1.1

loustwo 4 лет назад
Родитель
Сommit
5598480478

+ 17 - 2
app/Http/Controllers/DeliveryAppointmentController.php

@@ -117,6 +117,19 @@ class DeliveryAppointmentController extends Controller
         $this->success($list);
     }
 
+    private function checkAndGetAsn($codes){
+        if ($codes){
+            $codes = array_filter(array_unique(preg_split('/[,, ]+/u', $codes)));
+            if (count($codes)>0){
+                $asnCount = Store::query()->where("asn_code",$codes)->count();
+                $codes = count($codes)===$asnCount ? implode(",",$codes) : null;
+            }else{
+                $codes = null;
+            }
+        }
+        return $codes;
+    }
+
     /**
      * 确定预约
      */
@@ -128,13 +141,15 @@ class DeliveryAppointmentController extends Controller
         $details = request("details");
         $errors = $this->appointmentValidator($model)->errors();
         if (count($errors)>0)$this->success(["errors"=>$errors]);
+        $asnCodes = $this->checkAndGetAsn($model["asn_number"] ?? null);
+        if (!$asnCodes)$this->error("ASN单据错误");
         $errors = Validator::make($selectDate,[
             "date" => ["required","date","after_or_equal:today"],
             "time" => ["required","integer"],
         ])->errors();
         if (count($errors)>0)$this->error("未选定预约日期");
 
-        DB::transaction(function ()use($model,$selectDate,$details,&$appointment){
+        DB::transaction(function ()use($model,$selectDate,$details,&$appointment,$asnCodes){
             $result = DeliveryAppointment::query()->selectRaw("appointment_date,date_period,SUM(capacity) AS capacity")
                 ->where("appointment_date",$selectDate["date"])
                 ->where("date_period",$selectDate["time"])
@@ -157,7 +172,7 @@ class DeliveryAppointmentController extends Controller
                 "user_id"               => Auth::id(),
                 "owner_id"              => $model["owner_id"],
                 "procurement_number"    => $model["procurement_number"] ?? null,
-                "asn_number"            => $model["asn_number"] ?? null,
+                "asn_number"            => $asnCodes,
                 "logistic_number"       => $model["logistic_number"] ?? null,
                 "logistic_id"           => $model["logistic_id"] ?? null,
                 "warehouse_id"          => $model["warehouse_id"],

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

@@ -16,6 +16,7 @@ use App\Services\common\BatchUpdateService;
 use App\Services\OrderRejectedBillRelationService;
 use App\Services\OrderRejectingStatusService;
 use App\Services\RejectedService;
+use App\Services\WaybillService;
 use App\User;
 use App\Waybill;
 use App\WorkOrder;
@@ -50,7 +51,7 @@ class TestController extends Controller
         }
     }
     public function test(Request $request){
-        dd(Cache::tags(User::ANDROID_SINGLE_TAG)->get(64));
+        dd(array_filter(array_unique(preg_split('/[,, ]+/u', "125,456,888, 6 ,  ,"))));
     }
 
     public function testOrder()

+ 1 - 1
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -105,7 +105,6 @@ class WaybillController extends Controller
                 $order = app("OrderService")->first(["code"=>$waybill->wms_bill_number]);
                 if ($order){
                     $waybill->order_id = $order->id;
-                    app("WaybillService")->autoGetDBBill($waybill);
                 }
             }
             WaybillAuditLog::query()->create([
@@ -131,6 +130,7 @@ class WaybillController extends Controller
             //回传FLUX
             if ($prefix != 'BSDB') $this->accomplishToWMS($waybill);
         }
+        app("WaybillService")->autoGetDBBill($waybill);
         return response()->json(['response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000','returnDesc'=>'正确接收','resultInfo'=>'']]])
             ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
     }

+ 5 - 2
app/Services/WaybillService.php

@@ -3,6 +3,7 @@
 namespace App\Services;
 
 use App\Http\Controllers\api\thirdPart\flux\WaybillController;
+use App\Logistic;
 use App\Order;
 use App\OwnerFeeDetail;
 use App\OwnerFeeLogistic;
@@ -367,10 +368,10 @@ class WaybillService
         $controller = new WaybillController();
         if ($controller->accomplishToWMS($w)){
             $sql = <<<SQL
-UPDATE ACT_ALLOCATION_DETAILS SET PICKTOTRACEID = ?,DROPID = ? WHERE ORDERNO = ? AND  PICKTOTRACEID = ? AND DROPID = ?
+UPDATE ACT_ALLOCATION_DETAILS SET PICKTOTRACEID = ?,DROPID = ? WHERE ORDERNO = ?
 SQL;
             $updateRow = DB::connection("oracle")->update($sql,[
-                $waybill->carrier_bill,$waybill->carrier_bill,$waybill->wms_bill_number,$waybill->wms_bill_number,$waybill->wms_bill_number
+                $waybill->carrier_bill,$waybill->carrier_bill,$waybill->wms_bill_number
             ]);
             if ($updateRow!=1)Log::warning("德邦单号修改分配失败",["param"=>$w,"row"=>$updateRow]);
             return true;
@@ -414,6 +415,8 @@ SQL;
             $update["station_no"] = $bill['stationNo'];
             $update["arrived_org_simple_name"] = $bill['arrivedOrgSimpleName'];
             $update["much_higher_delivery"] = $bill['muchHigherDelivery'];
+            $logistic = Logistic::query()->where("code","DBWL")->first();
+            $update["logistic_id"] = $logistic->id ?? null;
             $waybill->update($update);
             if (!app("WaybillService")->notifyFlux($waybill)){
                 Log::error("德邦单号回传FLUX失败",["no"=>$waybill->waybill_number,"info"=>$bill]);

+ 165 - 0
resources/js/utilities/drawCheckbox.js

@@ -0,0 +1,165 @@
+$(function(){
+    let canvas = $("#bg_canvas");
+    if (canvas.length===0){
+        let canvas = $("<canvas id='bg_canvas' style='position: absolute;z-index: 500;left: 0;top: 0;width: 100%;height: 100%'></canvas>");
+        $("body").append(canvas);
+    }
+    var clientWidth = document.documentElement.clientWidth || document.body.clientWidth
+    var clientHeight = document.documentElement.clientHeight || document.body.clientHeight
+    // 更新canvas宽高
+    $("#bg_canvas").attr("width", clientWidth);
+    $("#bg_canvas").attr("height", clientHeight);
+    $("#bg_canvas").hide();
+});
+
+/**
+ * 默认画笔线宽
+ * @type {number}
+ */
+var defaultStrokeWidth = 1; //画矩形选取框的线宽
+
+var canvasExt = {
+    /**
+     *  画矩形
+     * @param canvasId canvasId
+     * @param penColor 画笔颜色
+     * @param strokeWidth 线宽
+     */
+    drawRect: function (canvasId, penColor, strokeWidth) {
+        var that = this;
+
+        that.penColor = penColor;
+        that.penWidth = strokeWidth;
+        var canvas = document.getElementById(canvasId);
+        //canvas 的矩形框
+        var canvasRect = canvas.getBoundingClientRect();
+        //canvas 矩形框的左上角坐标
+        var canvasLeft = canvasRect.left;
+        var canvasTop = canvasRect.top;
+
+        // 要画的矩形的起点 xy
+        var x = 0;
+        var y = 0;
+
+        //鼠标点击按下事件,画图准备
+        canvas.onmousedown = function(e) {
+
+            //设置画笔颜色和宽度
+            var color = that.penColor;
+            var penWidth = that.penWidth;
+            // 确定起点
+            x = e.clientX - canvasLeft;
+            y = e.clientY - canvasTop;
+            // 添加layer
+            $("#"+canvasId).addLayer({
+                type: 'rectangle',
+                strokeStyle: color,
+                strokeWidth: penWidth,
+                name:'areaLayer',
+                fromCenter: false,
+                x: x, y: y,
+                width: 1,
+                height: 1
+            });
+            // 绘制
+            $("#"+canvasId).drawLayers();
+            $("#"+canvasId).saveCanvas();
+
+            //鼠标移动事件,画图
+            canvas.onmousemove = function(e){
+
+                // 要画的矩形的宽高
+                var width = e.clientX-canvasLeft - x;
+                var height = e.clientY-canvasTop - y;
+
+                // 清除之前画的
+                $("#"+canvasId).removeLayer('areaLayer');
+
+                $("#"+canvasId).addLayer({
+                    type: 'rectangle',
+                    strokeStyle: color,
+                    strokeWidth: penWidth,
+                    name:'areaLayer',
+                    fromCenter: false,
+                    x: x, y: y,
+                    width: width,
+                    height: height
+                });
+
+                $("#"+canvasId).drawLayers();
+            }
+        };
+        //鼠标抬起
+        canvas.onmouseup=function(e){
+
+            var color = that.penColor;
+            var penWidth = that.penWidth;
+
+            canvas.onmousemove = null;
+
+            var width = e.clientX - canvasLeft - x;
+            var height = e.clientY- canvasTop - y;
+
+            $("#"+canvasId).removeLayer('areaLayer');
+
+            $("#"+canvasId).addLayer({
+                type: 'rectangle',
+                strokeStyle: color,
+                strokeWidth: penWidth,
+                name:'areaLayer',
+                fromCenter: false,
+                x: x, y: y,
+                width: width,
+                height: height
+            });
+
+            $("#"+canvasId).drawLayers();
+            $("#"+canvasId).saveCanvas();
+
+            // 把body转成canvas
+            html2canvas(document.body, {
+                scale: 1,
+                // allowTaint: true,
+                useCORS: true  //跨域使用
+            }).then(canvas => {
+                var capture_x, capture_y
+                if (width > 0) {
+                    //从左往右画
+                    capture_x = x + that.penWidth
+                }else {
+                    //从右往左画
+                    capture_x = x + width + that.penWidth
+                }
+                if (height > 0) {
+                    //从上往下画
+                    capture_y = y + that.penWidth
+                }else {
+                    //从下往上画
+                    capture_y = y + height + that.penWidth
+                }
+                clipInfo = {
+                    "x":capture_x,
+                    "y":capture_y,
+                    "w":Math.abs(width),
+                    "h":Math.abs(height),
+                };
+                afterExt();
+            });
+            // 移除画的选取框
+            $("#"+canvasId).removeLayer('areaLayer');
+            // 隐藏用于华画取框的canvas
+            $("#"+canvasId).hide()
+        }
+    }
+};
+
+var afterExt = function (){};
+var clipInfo = {};
+/**
+ * 选取截屏
+ * @param canvasId
+ */
+function clipScreenshots(){
+    $("#bg_canvas").show()
+    canvasExt.drawRect("bg_canvas", "red", defaultStrokeWidth);
+}

Разница между файлами не показана из-за своего большого размера
+ 19 - 0
resources/js/utilities/h2can.min.js


Разница между файлами не показана из-за своего большого размера
+ 5 - 0
resources/js/utilities/jcanvas.min.js


+ 38 - 1
resources/views/equipment/index.blade.php

@@ -57,6 +57,13 @@
         #loading{position:fixed;top:0;left:0;width:100%;height:100%;background:#f8f8f8;opacity:0.6;z-index:15000;}
         #loading i{position:absolute;top:50%;left:50%;font-size:33px;margin-top:-15px;margin-left:-40px;}
         #loading p{position:absolute;top:55%;left:48%;width:33px;height:33px;margin-top:-15px;margin-left:-15px;}
+
+        .equipment{
+            border-width:1px;
+            border-color: #0070C0;
+            border-style: dashed;
+            cursor: pointer
+        }
     </style>
 </head>
 <body>
@@ -221,8 +228,9 @@
                                      :x="element.x" :y="element.y" :z="element.index">
                         <div :class="coordsMapping[element.coords]">@{{ element.name }}</div>
                     </vue-drag-resize>
-                    <vue-drag-resize style="border-width:1px;border-color: #0070C0;border-style: dashed;cursor: pointer"
+                    <vue-drag-resize class="equipment"
                                      v-for="(element,index) in equipmentElements" @clicked="showDetail(element)"
+                                     :id="'eq-'+index"
                                      v-if="!element.removeSign"
                                      :is-resizable="false" :snap-to-grid="grid" :grid-x="40" :grid-y="30"
                                      :style="[{backgroundColor:element.color}]"
@@ -250,6 +258,9 @@
 </div>
 </body>
 <script src="{{ mix('js/app.js') }}"></script>
+<script src="{{ asset('js/utilities/drawCheckbox.js') }}"></script>
+<script src="{{ asset('js/utilities/h2can.min.js') }}"></script>
+<script src="{{ asset('js/utilities/jcanvas.min.js') }}"></script>
 <script src="{{ asset('js/utilities/toast.js') }}"></script>
 <script type="text/javascript">
     var vue = new Vue({
@@ -362,6 +373,32 @@
             };
         },
         methods:{
+            //检索所有元素,获取在指定范围内的元素
+            searchingSelectEq(){
+                afterExt = function (){
+                    new Promise(function(resolve, reject) {
+                        let result = [];
+                        let els = $(".equipment");
+                        for (let i=0;i<els.length;i++){
+                            let client = els[i].getBoundingClientRect();
+                            if (client.x<0 || client.y<0){
+                                continue;
+                            }
+                            //四个角全部包含在此区域内 将元素下标加入结果数组
+                            if (client.x>=clipInfo.x && client.y>=clipInfo.y && client.x<=(clipInfo.x+clipInfo.w) && client.y<=(clipInfo.y+clipInfo.h)
+                                && (client.x+client.width)<=(clipInfo.x+clipInfo.w) && (client.y+client.height)<=(clipInfo.y+clipInfo.h)){
+                                result.push(els[i].id.split('-')[1]);
+                            }
+                        }
+                        resolve(result);
+                    }).then(indexArr=>{
+                        indexArr.forEach(index=>{
+                            console.log(vue.equipmentElements[index].code);
+                        });
+                    });
+                }
+                clipScreenshots();
+            },
             buildComponent(eq){
                 let component = {
                     "x":eq.x,"y":eq.y,"width":eq.turn ? eq.w : eq.h,"height":eq.turn ? eq.h : eq.w,"name":"","color":eq.color,

Некоторые файлы не были показаны из-за большого количества измененных файлов