|
@@ -415,6 +415,7 @@ class Order extends BaseController
|
|
|
public function add()
|
|
|
{
|
|
|
|
|
|
+
|
|
|
$param = $this->request->filter('trim')->only(['cgdNo'], 'post');
|
|
|
|
|
|
$val = Validate::rule(['cgdNo|订单编号' => 'require|array|max:100']);
|
|
@@ -427,7 +428,7 @@ class Order extends BaseController
|
|
|
$cgdinfo = Db::name("purchease_order")
|
|
|
->whereIn('cgdNo', $param['cgdNo'])
|
|
|
->where(['is_del' => 0, 'supplierNo' => $this->request->user['supplierNo']])
|
|
|
- ->where('status', '<>', 0)
|
|
|
+ ->where('status', '=', 1)
|
|
|
->column('id,wsm_code,good_num', 'cgdNo');
|
|
|
|
|
|
if (empty($cgdinfo)) return json_show(1005, "未找到采购单数据或采购单未发货");
|
|
@@ -557,8 +558,19 @@ class Order extends BaseController
|
|
|
} else throw new Exception('新建入库单失败');
|
|
|
}
|
|
|
|
|
|
+ //维护原有采购单信息
|
|
|
+ Db::name("purchease_order")
|
|
|
+ ->whereIn('id', array_column($cgdinfo, 'id'))
|
|
|
+ ->update([
|
|
|
+ 'wsend_num' => 0,
|
|
|
+ 'send_num' => Db::raw('good_num'),
|
|
|
+ 'send_status' => 3,
|
|
|
+ 'status' => 3,
|
|
|
+ 'updatetime' => date("Y-m-d H:i:s"),
|
|
|
+ ]);
|
|
|
+
|
|
|
Db::commit();
|
|
|
- return json_show(0, '新建入库单成功', ["wsm_in_code" => $wsm_in_code]);
|
|
|
+ return json_show(0, '新建入库单成功');
|
|
|
|
|
|
// $win = Db::name("purchease_in")->insert($orin, true);
|
|
|
// if ($win) {
|