Browse Source

Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new_order_out_child

wufeng 2 years ago
parent
commit
6dd9e2a6fc

+ 2 - 2
app/admin/controller/OrderOutChild.php

@@ -172,7 +172,7 @@ class OrderOutChild extends Base
 //        return json_show(0, '获取成功', $data);
     }
 
-    //
+    //
     public function add()
     {
         $param = $this->request->only(['outCode', 'list'], 'post', 'trim');
@@ -381,7 +381,7 @@ class OrderOutChild extends Base
 
             Db::rollback();
 
-            return json_show(1004, $exception->getMessage() . '|' . $exception->getFile() . '|' . $exception->getLine());
+            return json_show(1004, $exception->getMessage());
         }
 
     }

+ 5 - 1
app/admin/controller/Sale.php

@@ -3420,6 +3420,10 @@ class Sale extends Base
         if ($status !== "") {
             $where[] = ['a.status', "=", $status];
         }
+        $send_status = isset($this->post['send_status']) && $this->post['send_status'] !== "" ? trim($this->post['send_status']) : "";
+        if ($send_status !== "") {
+            $where[] = ['a.send_status', "=", $send_status];
+        }
         $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
         if ($start != "") {
             $where[] = ["a.addtime", '>=', $start . " 00:00:00"];
@@ -3542,7 +3546,7 @@ class Sale extends Base
         $all_createrid = array_column($list, 'apply_id');
         $item = get_company_name_by_uid($all_createrid);
         $user = new \app\admin\common\User();
-        $names = $user->handle("getCodeAndName", ["code" => array_merge( array_column($list, "customer_code"), array_column($list, "wsm_supplierNo"))]);
+        $names = $user->handle("getCodeAndName", ["code" => array_merge( array_column($list, "supplierNo"), array_column($list, "wsm_supplierNo"))]);
 
 //        $userCommon = new \app\admin\common\User();
 //        $names = $userCommon->handle('getCodeAndName',['code'=>array_column($list,'customer_code')]);

+ 1 - 1
app/admin/route/app.php

@@ -720,6 +720,6 @@ route::rule('supplierReorderList', 'admin/SupplierClient/reorderlist');//未发
 route::rule('child_wsm_list', 'admin/OrderOutChild/getWsmList');//可分单的仓库列表
 route::rule('child_list', 'admin/OrderOutChild/list');//发货工单列表
 route::rule('child_export', 'admin/OrderOutChild/export');//导出
-route::rule('child_add', 'admin/OrderOutChild/add');//
+route::rule('child_add', 'admin/OrderOutChild/add');//
 route::rule('child_info', 'admin/OrderOutChild/info');//详情
 route::rule('child_send', 'admin/OrderOutChild/send');//发货

+ 37 - 37
app/command/ImportOrderFromCHandleData.php

@@ -133,10 +133,10 @@ class ImportOrderFromCHandleData extends Command
 //			            ->leftJoin("good_stock_info c", "a.id=c.stockid and c.balance_num>0")
 //			            ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" =>$supplierNo])
 //			            ->sum('balance_num');
-			            if($ct['usable_stock'] < $good_num){
-			               throw new Exception('商品库存数量不足');
-			            }
-                        $origin_price = 0;
+                    if ($ct['usable_stock'] < $good_num) {
+                        throw new Exception('商品库存数量不足');
+                    }
+                    $origin_price = 0;
 
                 } else {
 
@@ -316,40 +316,40 @@ class ImportOrderFromCHandleData extends Command
                     }
                     else {
                         //库存品
-	                        $stockUp =[
-		                        "usable_stock"=>$ct['usable_stock']-$good_num,
-		                        "updatetime"=>date("Y-m-d H:i:s"),
-		                        ];
-	                        $update=Db::name("good")->where(["spuCode"=>$ct['spuCode'],"usable_stock"=>$ct['usable_stock']])->update($stockUp);
-                            if($update==false){
-	                             throw new Exception('商品更新可用库存失败');
-	                        }
-
+                        $stockUp = [
+                            "usable_stock" => $ct['usable_stock'] - $good_num,
+                            "updatetime" => date("Y-m-d H:i:s"),
+                        ];
+                        $update = Db::name("good")->where(["spuCode" => $ct['spuCode'], "usable_stock" => $ct['usable_stock']])->update($stockUp);
+                        if ($update == false) {
+                            throw new Exception('商品更新可用库存失败');
                         }
-                        if ($sendtype == 1) {
-                            $temp = [
-                                'orderCode' => $orderCode,
-                                'contactor' => $extend_data['contactor'],
-                                'mobile' => $extend_data['mobile'],
-                                'addr' => $extend_data['addr'],
-                                'addr_code' => $extend_data['addr_code'],
-                                'customer_code' => $customer_code,
-                                'receipt_quantity' => $extend_data['num'],//收货数量,
-                                'post_fee' => 0,
-                                'is_del' => 0,
-                                'addtime' => date("Y-m-d H:i:s"),
-                                'updatetime' => date("Y-m-d H:i:s"),
-                                'arrive_time' => $arrtime,
-                            ];
-                            $vmp = Db::name('order_addr')->insert($temp, true);
-                            if ($vmp > 0) {
-                            	 $num = $extend_data['num'];
-                                $outCode = makeNo("DF");
-                            	if($is_stock!=1){
-	                                    $order = Db::name("order_num")
-	                                    ->where(["orderCode" => $orderCode, "status" => 1])
-	                                    ->find();
-	                                if ($order == false) throw new Exception('未找到可以发货得采购单数据');
+
+                    }
+                    if ($sendtype == 1) {
+                        $temp = [
+                            'orderCode' => $orderCode,
+                            'contactor' => $extend_data['contactor'],
+                            'mobile' => $extend_data['mobile'],
+                            'addr' => $extend_data['addr'],
+                            'addr_code' => $extend_data['addr_code'],
+                            'customer_code' => $customer_code,
+                            'receipt_quantity' => $extend_data['num'],//收货数量,
+                            'post_fee' => 0,
+                            'is_del' => 0,
+                            'addtime' => date("Y-m-d H:i:s"),
+                            'updatetime' => date("Y-m-d H:i:s"),
+                            'arrive_time' => $arrtime,
+                        ];
+                        $vmp = Db::name('order_addr')->insert($temp, true);
+                        if ($vmp > 0) {
+                            $num = $extend_data['num'];
+                            $outCode = makeNo("DF");
+                            if ($is_stock != 1) {
+                                $order = Db::name("order_num")
+                                    ->where(["orderCode" => $orderCode, "status" => 1])
+                                    ->find();
+                                if ($order == false) throw new Exception('未找到可以发货得采购单数据');
 	                                $tep = [
 	                                    "cgdNo" => $order['cgdNo'],
 	                                    "outCode" => $outCode,