|
@@ -883,8 +883,10 @@ class Sale extends BaseController
|
|
|
return error_show(1003, "更新失败");
|
|
|
}
|
|
|
$stx = ["order_code"=>$orderCode,"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+
|
|
|
ActionLog::logAdd($this->post['token'],$stx,$der['order_type'] == 2?"ZXQRD":"XSQRD",$der['status'],$der);
|
|
|
$order=["order_type"=>$der['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$orderCode,"order_id"=>$der['id'],"order_status"=>$data['status']];
|
|
|
+
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$str = Db::name('good_stock')->where(['wsm_code' => $var['wsm_code'], 'good_type_code' => $der['good_code']])->find();
|
|
|
if ($str == false) {
|
|
@@ -954,6 +956,53 @@ class Sale extends BaseController
|
|
|
$order=["order_type"=>$codeinfo['order_type'] == 2?"ZXCKD":"CKD","order_code"=>$outCode,
|
|
|
"order_id"=>$codeinfo['id'],"order_status"=>$codeinfo['status']];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+ if ($status == 1) {
|
|
|
+
|
|
|
+ $var = Db::name('sale_info')->where(['orderCode' =>$codeinfo['orderCode'], 'wsm_code' =>$codeinfo['wsm_code']])->find();
|
|
|
+ //var_dump(Db::name('sale_info')->getLastSql());
|
|
|
+ if ($var == "") {
|
|
|
+ return error_show(1002, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ // $send = Db::name("order_out")->where(["wsm_code" => $wsm_code, 'orderCode' => $orderCode])->sum
|
|
|
+ //("send_num");
|
|
|
+ $item =$dr['status'];
|
|
|
+ $dr['send_num'] +=$codeinfo['send_num'];
|
|
|
+ $dr['wsend_num'] -= $codeinfo['send_num'];//($der['send_num'])?$der['wsend_num'] =="" ? $der['send']
|
|
|
+ $dr['send_status'] = $dr['send_num'] == 0 ? 1 : $dr['wsend_num'] == 0 ? 3 : 2;
|
|
|
+ $dr['status'] = $dr['send_num'] == 0 ? 3 : $dr['wsend_num'] == 0 ? 5 : 4;
|
|
|
+ $dr['updatetime'] = date("Y-m-d H:i:s");
|
|
|
+ $si = Db::name('sale')->save($dr);
|
|
|
+ if ($si == false) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1003, "更新失败");
|
|
|
+ }
|
|
|
+ $stx = ["order_code"=>$dr['orderCode'],"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,$dr['order_type'] == 2?"ZXQRD":"XSQRD",$dr['status'],
|
|
|
+ $dr);
|
|
|
+ $order=["order_type"=>$dr['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$dr['orderCode'],"order_id"=>$dr['id'],"order_status"=>$dr['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+ $str = Db::name('good_stock')->where(['wsm_code' => $var['wsm_code'], 'good_type_code' => $dr['good_code']])->find();
|
|
|
+ if ($str == false) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1002, "商品数据未找到");
|
|
|
+ }
|
|
|
+ if ($codeinfo['send_num'] > $str['wait_out_stock']) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1002, "超出库存数量");
|
|
|
+ }
|
|
|
+ $str['wait_out_stock'] -= $codeinfo['send_num'];
|
|
|
+ $str['intra_stock'] += $codeinfo['send_num'];
|
|
|
+ $str['updatetime'] = date("Y-m-d H:i:s");
|
|
|
+ $stre = Db::name('good_stock')->save($str);
|
|
|
+ if ($stre == false) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1002, "状态更新失败");
|
|
|
+ }
|
|
|
+ $good_data[]= ["stock_id"=>$str['id'],"type"=>2,'stock'=>$codeinfo['send_num'],"stock_name"=>"wait_out_stock"];
|
|
|
+ $good_data[]= ["stock_id"=>$str['id'],"type"=>1,'stock'=>$codeinfo['send_num'],"stock_name"=>"intra_stock"];
|
|
|
+ GoodLog::LogAdd($this->post['token'],$good_data,'CKD');
|
|
|
+ }
|
|
|
if ($status == 2) {
|
|
|
$ct = Db::name('sale_info')->where(['orderCode' => $dr['orderCode'], 'wsm_code' => $codeinfo['wsm_code']])->find();
|
|
|
if ($ct == false) {
|