Procházet zdrojové kódy

提示信息,客户管理-特征增加

Zhouzhendong před 5 roky
rodič
revize
69c400133c

+ 4 - 1
app/Feature.php

@@ -17,10 +17,13 @@ class Feature extends Model
     ];
 
     const type = [
-        0 => "商品名称",
+        0 => "商品名称",  //二级
         1 => "订单类型",
         2 => "承运商",
         3 => "店铺类型",
         4 => "波次类型",
+        5 => "商品备注",
+        6 => "长",       //二级
+        7 => "订单备注",
     ];
 }

+ 12 - 0
app/Http/Controllers/PriceModelController.php

@@ -1806,6 +1806,18 @@ class PriceModelController extends Controller
                         $query->orderByRaw("CASE strategy  WHEN '起步' THEN 1 WHEN '默认' THEN 2 WHEN '特征' THEN 3 END");
                     }]);
                 }]);
+                $features = app("FeatureService")->getMapArray();
+                OwnerPriceOperation::$features = $features;
+                OwnerPriceOperationItem::$features = $features;
+                foreach ($owner->ownerPriceOperations as &$operation){
+                    $operation["featureFormat"] = $operation->featureFormat;
+                    foreach ($operation->items as &$item){
+                        $item["featureFormat"] = $item->featureFormat;
+                        if ($operation["operation_type"]==='出库' && $item["strategy"] == "起步"){
+                            $item["type"] = $item["amount"] ? 0 : 1;
+                        }
+                    }
+                }
                 $this->success($owner->ownerPriceOperations);
                 break;
             case "express":

+ 11 - 6
app/Http/Controllers/TestController.php

@@ -155,14 +155,19 @@ class TestController extends Controller
             if ($order)$model->update(["order_id"=>$order->id]);
         }
     }
+
     public function tt1()
     {
-        $nextTime = DeliveryAppointment::PERIOD[1];
-        $nextTime = explode("-",$nextTime)[1];
-        $timestamp = strtotime(date("Y-m-d")." ".$nextTime.":00:00");
-        $result["refresh"] = ($timestamp-time())*1000;
-        dd($result);
-        return view("store.deliveryAppointment.delivery",["k"=>"15661461456"]);
+        $a = "";
+        $b = "1";
+
+        //dump($a??$b);
+        dump([]?'c':[]);
+        dump('0'?'c':[]);
+        dump(0?'c':[]);
+        dump(''?'c':[]);
+        dump(false?'c':[]);
+        dump(null?'c':[]);
     }
     public function zzd(){
         ini_set('max_execution_time',2500);

+ 35 - 31
app/Imports/UpdatePickZone.php

@@ -36,13 +36,23 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
         $errors = [];
         $ids = [];
         foreach ($collection as $index=>$item){
+            if (!$item["订单编号"] && !$item["生产日期"] && !$item["失效日期"] && !$item["商品条码"] && !$item["数量"])continue;
+            if (!$item["订单编号"]){
+                $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
+                continue;
+            }
+            if (!$item["商品条码"]){
+                $errors[] = "“{$item['订单编号']}”商品条码为空";
+                continue;
+            }
+
             if ($item["生产日期"]){
                 if (is_numeric($item["生产日期"]))$item["生产日期"] = formatExcelDate($item["生产日期"]);
                 else{
                     try{
                         $item["生产日期"]=Carbon::parse($item["生产日期"])->format('Y-m-d');
                     }catch (\Exception $e){
-                        $errors[] = "第“" . ($index + 2) . "”生产日期无法识别";
+                        $errors[] = "“{$item["订单编号"]}”生产日期无法识别";
                         continue;
                     }
                 }
@@ -53,22 +63,14 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                     try{
                         $item["失效日期"]=Carbon::parse($item["失效日期"])->format('Y-m-d');
                     }catch (\Exception $e){
-                        $errors[] = "第“" . ($index + 2) . "”失效日期无法识别";
+                        $errors[] = "“{$item['订单编号']}”失效日期无法识别";
                         continue;
                     }
                 }
             }
 
-            if (!$item["订单编号"]){
-                $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
-                continue;
-            }
-            if (!$item["商品条码"]){
-                $errors[] = "第“" . ($index + 2) . "”行商品条码为空";
-                continue;
-            }
             if (!$item["生产日期"] && !$item["失效日期"]){
-                $errors[] = "第“" . ($index + 2) . "”行不存在日期";
+                $errors[] = "“{$item['订单编号']}”不存在日期";
                 continue;
             }
             $detail = OracleDOCOrderDetail::query()->select("DOC_ORDER_DETAILS.customerid","DOC_ORDER_DETAILS.sku","DOC_ORDER_DETAILS.orderno","DOC_ORDER_DETAILS.orderlineno","sostatus")
@@ -78,11 +80,11 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                     $query->where("alternate_sku1",$item["商品条码"]);
                 })->leftJoin("DOC_ORDER_HEADER","DOC_ORDER_DETAILS.ORDERNO","=","DOC_ORDER_HEADER.ORDERNO")->first();
             if (!$detail){
-                $errors[] = "第“" . ($index + 2) . "”行未知订单商品";
+                $errors[] = "“{$item['订单编号']}”未知订单商品";
                 continue;
             }
             if ($detail->sostatus != '00'){
-                $errors[] = "第“" . ($index + 2) . "”行订单状态不为创建订单";
+                $errors[] = "“{$item['订单编号']}”订单状态不为创建订单";
                 continue;
             }
             $sql = "select BAS_ZONE.DESCR,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,(INV_LOT_LOC_ID.QTY-INV_LOT_LOC_ID.QTYALLOCATED-QTYONHOLD-QTYRPOUT-QTYMVOUT) AS qty from INV_LOT_ATT LEFT JOIN
@@ -101,7 +103,7 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
 
             $lots = DB::connection("oracle")->select(DB::raw($sql),$bindings);
             if (!$lots){
-                $errors[] = "第“" . ($index + 2) . "”行未找到库位";
+                $errors[] = "“{$item['订单编号']}”未找到库位";
                 continue;
             }
             $result = null;
@@ -135,12 +137,12 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                     LogService::log(__METHOD__,"SUCCESS-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
                     $order = app("OrderService")->first(["code"=>$item["订单编号"]]);
                     if (!$order){
-                        $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到订单";
+                        $errors[] = "“{$item['订单编号']}”已成功修改FLUX库位但在本地未找到订单";
                         continue;
                     }
                     $barcode = app("CommodityBarcodeService")->first(["code"=>$item["商品条码"]]);
                     if (!$barcode){
-                        $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到条码";
+                        $errors[] = "“{$item['订单编号']}”已成功修改FLUX库位但在本地未找到条码";
                         continue;
                     }
                     $model = app("OrderCommodityAssignService")->create([
@@ -159,23 +161,25 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                 }catch (\Exception $e){
                     LogService::log(__METHOD__,"ERROR-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
                 }
-            }else $errors[] = "第“" . ($index + 2) . "”行未找到可分配库位";
+            }else $errors[] = "“{$item['订单编号']}”未找到可分配库位";
         }
-        $assigns = app("OrderCommodityAssignService")->get(["id"=>$ids]);
         $models = [];
-        foreach ($assigns as $assign){
-            $models[] = [
-                "orderNumber"   => $assign->order ? $assign->order->code : '',
-                "barcode"       => $assign->commodity ? $assign->commodity->barcode : '',
-                "amount"        => $assign->amount,
-                "producedAt"    => $assign->produced_at,
-                "validAt"       => $assign->valid_at,
-                "batchNumber"   => $assign->batch_number,
-                "location"      => $assign->location,
-                "region"        => $assign->region,
-                "createdAt"     => $assign->created_at,
-                "userName"      => $assign->user ? $assign->user->name : 'system',
-            ];
+        if ($ids){
+            $assigns = app("OrderCommodityAssignService")->get(["id"=>$ids]);
+            foreach ($assigns as $assign){
+                $models[] = [
+                    "orderNumber"   => $assign->order ? $assign->order->code : '',
+                    "barcode"       => $assign->commodity ? $assign->commodity->barcode : '',
+                    "amount"        => $assign->amount,
+                    "producedAt"    => $assign->produced_at,
+                    "validAt"       => $assign->valid_at,
+                    "batchNumber"   => $assign->batch_number,
+                    "location"      => $assign->location,
+                    "region"        => $assign->region,
+                    "createdAt"     => $assign->created_at,
+                    "userName"      => $assign->user ? $assign->user->name : 'system',
+                ];
+            }
         }
         Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>$errors]);
     }

+ 37 - 1
app/Services/FeatureService.php

@@ -180,6 +180,18 @@ class FeatureService
                         case "等于":
                             $logic = " = ";
                             break;
+                        case "小于":
+                            $logic = " < ";
+                            break;
+                        case "大于":
+                            $logic = " > ";
+                            break;
+                        case "小于等于":
+                            $logic = " <= ";
+                            break;
+                        case "大于等于":
+                            $logic = " >= ";
+                            break;
                     }
                     $str = $column.$logic."'".$describe."'";
                 }else $str = $column.' '.$logic.' '.$describe;
@@ -233,7 +245,7 @@ class FeatureService
                 $column = Feature::type[$features[$str]["type"]];
                 $logic = $features[$str]["logic"];
                 $describe = $features[$str]["describe"];
-                if ($column == '商品名称' && $isMultiMatching){
+                if (($column == '商品名称' || $column == '商品备注' || $column == '长') && $isMultiMatching){
                     $packageColumn = $columnMapping["packages"] ?? "packages";
                     $packages = $matchObject[$packageColumn] ?? [];
                     $str = $this->multiMatching($packages,$logic,$describe,$columnMapping[$column] ?? '');
@@ -250,6 +262,18 @@ class FeatureService
                     case "等于":
                         $str = $value == $describe ? 'true' : 'false';
                         break;
+                    case "小于":
+                        $str = $value < $describe ? 'true' : 'false';
+                        break;
+                    case "大于":
+                        $str = $value > $describe ? 'true' : 'false';
+                        break;
+                    case "小于等于":
+                        $str = $value <= $describe ? 'true' : 'false';
+                        break;
+                    case "大于等于":
+                        $str = $value >= $describe ? 'true' : 'false';
+                        break;
                     default:
                         $str = 'false';
                 }
@@ -292,6 +316,18 @@ class FeatureService
                 case "等于":
                     if ($value == $describe)return 'true';
                     break;
+                case "小于":
+                    if ($value < $describe)return 'true';
+                    break;
+                case "大于":
+                    if ($value > $describe)return 'true';
+                    break;
+                case "小于等于":
+                    if ($value <= $describe)return 'true';
+                    break;
+                case "大于等于":
+                    if ($value >= $describe)return 'true';
+                    break;
             }
         }
         return "false";

+ 1 - 1
app/Services/OwnerPriceOperationService.php

@@ -100,7 +100,7 @@ class OwnerPriceOperationService
         }else{
             foreach ($items as $item){
                 $item["owner_price_operation_id"] = $copyModel->id;
-                $item["discount_price"] = implode(",",$item["discount_price"] ?? []) ?? null;
+                $item["discount_price"] = implode(",",($item["discount_price"] ? $item["discount_price"] : [])) ?? null;
                 $insert[] = $item;
             }
         }

+ 1 - 1
database/migrations/2020_10_28_110936_create_features_table.php

@@ -16,7 +16,7 @@ class CreateFeaturesTable extends Migration
         Schema::create('features', function (Blueprint $table) {
             $table->id();
             $table->enum("type",["商品名称","订单类型","承运商","店铺类型"])->index()->comment("特征类型");
-            $table->enum("logic",["包含","不包含","等于"])->index()->comment("逻辑");
+            $table->enum("logic",["包含","不包含","等于","小于","小于等于","大于","大于等于"])->index()->comment("逻辑");
             $table->string("describe")->comment("特征");
             $table->timestamps();
         });

+ 1 - 1
resources/views/customer/project/create.blade.php

@@ -173,7 +173,7 @@
                         "无减免","按单减免","固定减免"
                     ],
                     feature_type:{!! json_encode(\App\Feature::type,JSON_UNESCAPED_UNICODE) !!},
-                    logic : ['包含','不包含','等于'],
+                    logic : ['包含','不包含','等于',"大于","大于等于","小于","小于等于"],
                 },
                 poolMapping:{},//基础数据选择池的映射对象 供展示使用
                 selectedModel:{//已选定的计费模型

+ 2 - 2
resources/views/customer/project/part/_addFeature.blade.php

@@ -26,8 +26,8 @@
                         <label class="col-2">
                             <select class="form-control form-control-sm" v-model="feature.type">
                                 <option v-for="t in pool.feature_type" :value="t"
-                                        v-if="((thisOperationItemIndex===-1 && t !== '商品名称') || (thisOperationItemIndex!==-1 && t==='商品名称')) &&
-                                        ((model.operation.operation_type=='入库' && t!=='波次类型') || model.operation.operation_type=='出库')">
+                                        v-if="((thisOperationItemIndex===-1 && (t!=='商品名称' && t!=='长' && t!=='商品备注')) || (thisOperationItemIndex!==-1
+                                        && (t=='商品名称' || t=='长' || t=='商品备注'))) && ((model.operation.operation_type=='入库' && t!=='波次类型') || model.operation.operation_type=='出库')">
                                     @{{ t }}</option>
                             </select>
                         </label>

+ 3 - 3
resources/views/customer/project/part/_three.blade.php

@@ -70,7 +70,7 @@
                                 </div>
                                 <div class="col-1">
                                     <span class="cursor-pointer text-danger font-weight-bold"
-                                          v-if="operation.strategy == '特征'" @click.stop="delOperation(operation,i)">&times;</span>
+                                          @click.stop="delOperation(operation,i)">&times;</span>
                                 </div>
                             </div>
                             <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.strategy === '特征'">
@@ -89,7 +89,7 @@
                                         </div>
                                         <div class="col-1">
                                             <span class="cursor-pointer text-danger font-weight-bold"
-                                                  v-if="item.strategy == '特征'" @click.stop="deleteOperationItem(item,j,i)">&times;</span>
+                                                  @click.stop="deleteOperationItem(item,j,i)">&times;</span>
                                         </div>
                                     </div>
                                     <div class="row small mt-0 ml-1" style="background-color: RGB(248,248,248)" v-if="item.strategy == '特征'">
@@ -116,7 +116,7 @@
                                 </div>
                                 <div class="col-1">
                                     <span class="cursor-pointer text-danger font-weight-bold"
-                                          v-if="operation.strategy == '特征'" @click.stop="delOperation(operation,i)">&times;</span>
+                                          @click.stop="delOperation(operation,i)">&times;</span>
                                 </div>
                             </div>
                             <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.strategy === '特征'">

+ 3 - 3
resources/views/order/index/_importModal.blade.php

@@ -1,10 +1,10 @@
 <div class="modal fade" tabindex="-1" role="dialog" id="importModal">
-    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
+    <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
         <div class="modal-content">
             <div class="modal-body">
                 <div class="w-100 text-center mb-1" v-if="errors.length > 0">
-                    <button class="btn btn-sm btn-danger mb-1" @click="isShowError = true" v-if="!isShowError">@{{ errors.length }}条错误,点击展开</button>
-                    <button class="btn btn-sm btn-dark mb-1" @click="isShowError = false" v-else>收起错误展示</button>
+                    <button class="btn btn-sm btn-danger mb-1 w-50" @click="isShowError = true" v-if="!isShowError">@{{ errors.length }}条错误,点击展开</button>
+                    <button class="btn btn-sm btn-primary mb-1 w-50" @click="isShowError = false" v-else>收起错误展示</button>
                     <div v-if="isShowError" class="container-fluid text-danger font-weight-bolder">
                         <div class="row text-left">
                             <div class="col-6" v-for="error in errors">@{{ error }}</div>

+ 18 - 14
resources/views/order/index/index.blade.php

@@ -85,9 +85,9 @@
             importAssign(e){
                 let file=e.target.files[0];
                 if (!file){
-                    tempTip.setDuration(3000);
-                    tempTip.setIndex(1099);
-                    tempTip.show("未选择文件");
+                    window.tempTip.setDuration(3000);
+                    window.tempTip.setIndex(1099);
+                    window.tempTip.show("未选择文件");
                     return;
                 }
                 let formData = new FormData();
@@ -95,28 +95,32 @@
                 window.tempTip.setIndex(1099);
                 window.tempTip.setDuration(9999);
                 window.tempTip.waitingTip("执行中,请耐心等候......");
-                axios.post('{{url('order/index/commodityAssign/import')}}',formData,{
+                window.axios.post('{{url('order/index/commodityAssign/import')}}',formData,{
                     'Content-Type':'multipart/form-data'
                 })
                     .then(res=>{
                         if (res.data.success) {
+                            this.errors = res.data.errors;
+                            this.isShowError = true;
+                            window.tempTip.cancelWaitingTip();
+                            window.tempTip.setDuration(2000);
                             if (res.data.data.length>0) {
                                 this.models.unshift.apply(this.models,res.data.data);
                                 if (this.models.length>50) this.models = this.models.split(50);
+                                window.tempTip.showSuccess("导入成功!");
+                            }else {
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show("导入失败!");
                             }
-                            this.errors = res.data.errors;
-                            tempTip.cancelWaitingTip();
-                            tempTip.setDuration(2000);
-                            tempTip.showSuccess("导入成功!");
                             return;
                         }
-                        tempTip.cancelWaitingTip();
-                        tempTip.setDuration(3000);
-                        tempTip.show(res.data.data);
+                        window.tempTip.cancelWaitingTip();
+                        window.tempTip.setDuration(3000);
+                        window.tempTip.show(res.data.data);
                     }).catch(err=> {
-                    tempTip.cancelWaitingTip();
-                    tempTip.setDuration(3000);
-                    tempTip.show("网络错误:"+err);
+                    window.tempTip.cancelWaitingTip();
+                    window.tempTip.setDuration(3000);
+                    window.tempTip.show("网络错误:"+err);
                 })
             }
         },

+ 1 - 0
文档/WAS项目规范.md

@@ -1,5 +1,6 @@
 ## 全局
     PHP中长文本如无拼接必要性使用定界符(<<<)来声明
+    定义在模型或任意位置的常量都为业务逻辑服务,应该谨慎操作任何常量的变更
 ##命名
 	支持中文命名
 		取消IDE中的Non-ASCII验证