<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 訂單錄入SKU發貨數量的編輯 **位置:** Common\Lib\FlowLib.class.php **參數:** * @param $data array 訂單信息(如:訂單類型,訂單ID) * @return array 訂單審批返回提示信息 **調用:** * $flow = new FlowLib(); * $order_arr = $flow->skuEdit($data); **完整代碼:** ~~~ /** * 訂單錄入SKU發貨數量的編輯 * @param $data array 訂單信息 * @return int 編輯是否成功返回 * whz 2018-01-26 * */ public function skuEdit($data) { //1、檢查發貨數量不能小于0 if ((int)$data['num'] <= 0) { return array('success'=>false, 'code'=>202, 'msg'=>'填寫SKU數量必須大于0!'); } //2、查詢SKU庫存信息 if ($data['order_type'] == 1 || $data['order_type'] == 4) { //查詢倉庫名 $delivery = get_warehouse($data['shipper_id']); $where['warehouse'] = $data['shipper_id']; //配貨、移庫的商品必須在倉庫(物流狀態:1、已入庫) $where['delivery_status'] = 1; } //訂單類型:調撥單、退倉單,發貨位置是門店 if ($data['order_type'] == 2 || $data['order_type'] == 3) { //查詢門店名 $delivery = get_shops_name($data['shipper_id']); $where['max_shops_id'] = $data['shipper_id']; //調撥、退倉的商品必須在門店(2、已入店) $where['delivery_status'] = 2; } //相同SKU的商品sku_id相同 $where['sku_id'] = $data['sku_id']; //可銷售 $where['inventory_status'] = array('in',array(1,2,3,5,6)); //SKU在唯一碼表找到商品的個數 $goodcount = M('goods_no') ->where($where) ->count(); if ($goodcount == 0) { return array('success'=>false, 'code'=>203, 'msg'=>$delivery . '可填數量為:0'); } //3、判斷編輯的發貨數量是否正確 $num_sku = M('wms_flow as r') ->field('u.num') ->join('coscia_wms_sku as u on r.id=u.order_id','left') ->where(array('u.type'=>$data['order_type'], 'u.sku_id'=>$data['sku_id'], 'u.is_delete'=>0, 'r.status'=>array('in',array(0,1,2)), 'r.id'=>array('neq',$data['id']))) ->select(); $num_skus = 0; foreach ($num_sku as $key => $value) { $num_skus += $value['num']; } $nums = $goodcount-$num_skus; if ((int)$data['num'] > (int)$nums) { return array('success'=>false, 'code'=>204, 'msg'=>'SKU:' . $data['sku'] . '庫存不足,可發庫存:' . $goodcount . ',減去已錄入SKU訂單的發貨數量:' . $num_skus . '后,庫存量為:' . $nums); } M()->startTrans(); //6、更新配貨數量 $save_num = M("wms_sku") ->where(array('id' => $data['save_id'])) ->save(array('num' => $data['num'])); if ($save_num === false) { M()->rollback(); return array('success'=>false, 'code'=>205, 'msg'=>'SKU數量更新失敗!'); } //7、生成日志記錄 $add_log['description'] = $data['sku'].'修改SKU數量為:'.$data['num'].'成功!'; $add_log['order_id'] = $data['id']; $add_log['type'] = $data['order_type']; $ress = $this->addLog($add_log); if (!$ress) { M()->rollback(); return array('success'=>false, 'code'=>208, 'msg'=>'修改SKU數量日志記錄失敗!'); } M()->commit(); return array('success'=>true, 'code'=>200, 'msg'=>'修改成功!'); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看