|
@@ -31,7 +31,7 @@ class Sale extends Base
|
|
|
|
|
|
public function create()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$orderCode = makeNo("QR");
|
|
|
$customer_code = isset($this->post['customer_code']) && $this->post['customer_code'] !== "" ? trim($this->post['customer_code']) : "";
|
|
|
if ($customer_code == "") {
|
|
@@ -113,6 +113,7 @@ class Sale extends Base
|
|
|
// if ($stock == false || $stock['usable_stock'] < $good_num) {
|
|
|
// return error_show(1003, "库存数量不足");
|
|
|
// }
|
|
|
+
|
|
|
if($stock_num < $good_num){
|
|
|
return error_show(1003, "库存数量不足");
|
|
|
}
|
|
@@ -276,14 +277,14 @@ class Sale extends Base
|
|
|
if ($datainfo > 0) {
|
|
|
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $orderCode,//销售单code
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
|
], "XSQRD", 0, $this->post);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'XSQRD',
|
|
|
"order_code" => $orderCode,//销售单code
|
|
|
"order_id" => $datainfo,
|
|
@@ -576,7 +577,7 @@ class Sale extends Base
|
|
|
$up = Db::name("purchease_order")->insert($cg, true);
|
|
|
if ($up) {
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $cg['cgdNo'],//销售单code
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
@@ -584,7 +585,7 @@ class Sale extends Base
|
|
|
], "CGD", $cg['status'], $cg);
|
|
|
|
|
|
//当节点是0待与供应商确认,推给供应商负责人
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'CGD',
|
|
|
"order_code" => $cg['cgdNo'],//销售单code
|
|
|
"order_id" => $up,
|
|
@@ -645,7 +646,7 @@ class Sale extends Base
|
|
|
}
|
|
|
$good_data[] = ['good_log_code' => $cgdCode, "stock_id" => isset($stoc['id']) ? $stoc['id'] : Db::name("good_stock")->getLastInsID(), "type" => 1,
|
|
|
'stock' => $data['good_num'], "stock_name" => "wait_in_stock"];
|
|
|
- GoodLog::LogAdd($this->post['token'], $good_data, "CGD");
|
|
|
+ GoodLog::LogAdd(['id'=>$this->uid,'nickname'=>$this->uname], $good_data, "CGD");
|
|
|
return true;
|
|
|
}
|
|
|
} else {
|
|
@@ -667,13 +668,13 @@ class Sale extends Base
|
|
|
return error_show(1005,"存在未完成退货订单数据");
|
|
|
}
|
|
|
$arrtime = isset($this->post['arrtime']) && $this->post['arrtime'] != "" ? $this->post['arrtime'] : "";
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
- $apply_id = GetUserInfo($token);
|
|
|
- if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
- return error_show(1002, "申请人数据不存在");
|
|
|
- }
|
|
|
- $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
- $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $apply_id = GetUserInfo($token);
|
|
|
+// if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
+// return error_show(1002, "申请人数据不存在");
|
|
|
+// }
|
|
|
+ $rm = $this->uid;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
+ $ri = $this->uname;//isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
$addrlist = isset($this->post['addrlist']) && $this->post['addrlist'] !== "" ? $this->post['addrlist'] : "";
|
|
|
if ($addrlist == "" || empty($addrlist) || !is_array($addrlist)) {
|
|
|
return error_show(1004, "参数addrlist不能为空");
|
|
@@ -776,7 +777,7 @@ class Sale extends Base
|
|
|
}
|
|
|
$good_data[] = ['good_log_code' => $outCode, "stock_id" => $temp['id'], "type" => 1, 'stock' => $num, "stock_name" => "wait_out_stock"];
|
|
|
$good_data[] = ['good_log_code' => $outCode, "stock_id" => $temp['id'], "type" => 2, 'stock' => $num, "stock_name" => "usable_stock"];
|
|
|
- GoodLog::LogAdd($this->post['token'], $good_data, "CKD");
|
|
|
+ GoodLog::LogAdd(['id'=>$this->uid,'nickname'=>$this->uname], $good_data, "CKD");
|
|
|
$status = 1;
|
|
|
}
|
|
|
}else{
|
|
@@ -973,9 +974,9 @@ class Sale extends Base
|
|
|
}
|
|
|
|
|
|
$userCommon = new \app\admin\common\User();
|
|
|
- $tmp = $userCommon->handle('bInfo',['companyNo'=>$companyNo]);
|
|
|
- if(!isset($tmp['code']) || $tmp['code']!=0) return json_show($tmp['code'],$tmp['message'],$tmp['data']);
|
|
|
- if(empty($tmp['data'])) return json_show(1003, "业务公司数据未找到");
|
|
|
+// $tmp = $userCommon->handle('bInfo',['companyNo'=>$companyNo]);
|
|
|
+// if(!isset($tmp['code']) || $tmp['code']!=0) return json_show($tmp['code'],$tmp['message'],$tmp['data']);
|
|
|
+// if(empty($tmp['data'])) return json_show(1003, "业务公司数据未找到");
|
|
|
|
|
|
// $company = Db::name("business")->where(["companyNo" => $companyNo, "is_del" => 0])->find();
|
|
|
// if ($company == false) {
|
|
@@ -997,6 +998,7 @@ class Sale extends Base
|
|
|
$is_stock = 0;
|
|
|
$cgd = [
|
|
|
"supplierNo" => $zxinfo['supplierNo'],
|
|
|
+ "supplierName" => $supplier_temp_info['name'],
|
|
|
"companyNo" => $companyNo,
|
|
|
"spuCode" => $spuCode,
|
|
|
"skuCode" => $skuCode,
|
|
@@ -1025,16 +1027,16 @@ class Sale extends Base
|
|
|
'good_createrid' => $zxinfo['createrid'],
|
|
|
'good_creater' => $zxinfo['creater'],//商品创建人id
|
|
|
];
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] != "" ? trim($this->post['token']) : "";
|
|
|
- if ($token == "") {
|
|
|
- return error_show(102, "参数token不能为空");
|
|
|
- }
|
|
|
- $apply_id = GetUserInfo($token);
|
|
|
- if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
- return error_show(102, "申请人数据不存在");
|
|
|
- }
|
|
|
- $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
- $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] != "" ? trim($this->post['token']) : "";
|
|
|
+// if ($token == "") {
|
|
|
+// return error_show(102, "参数token不能为空");
|
|
|
+// }
|
|
|
+// $apply_id = GetUserInfo($token);
|
|
|
+// if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
+// return error_show(102, "申请人数据不存在");
|
|
|
+// }
|
|
|
+ $rm = $this->uid;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
+ $ri = $this->uname;//isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
|
|
|
$va = isset($this->post['order_addr']) && $this->post['order_addr'] !== "" ? $this->post['order_addr'] : "";
|
|
|
$send_num = 0;
|
|
@@ -1130,14 +1132,14 @@ class Sale extends Base
|
|
|
];
|
|
|
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $orderCode,//销售单code
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
|
], "XSQRD", $data['status'], $data);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'XSQRD',
|
|
|
"order_code" => $orderCode,//销售单code
|
|
|
"order_id" => $datainfo,
|
|
@@ -1152,7 +1154,7 @@ class Sale extends Base
|
|
|
return error_show(1002, "咨询单修改失败");
|
|
|
} else {
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $zx['infoNo'],//咨询单详情编号
|
|
|
"status" => $old_zx_status,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
@@ -1377,16 +1379,16 @@ class Sale extends Base
|
|
|
if ($planinfo == "") {
|
|
|
return error_show(1002, "参数planinfo不能为空");
|
|
|
}
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] != "" ? trim($this->post['token']) : "";
|
|
|
- if ($token == "") {
|
|
|
- return error_show(102, "参数token不能为空");
|
|
|
- }
|
|
|
- $apply_id = GetUserInfo($token);
|
|
|
- if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
- return error_show(102, "申请人数据不存在");
|
|
|
- }
|
|
|
- $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
- $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] != "" ? trim($this->post['token']) : "";
|
|
|
+// if ($token == "") {
|
|
|
+// return error_show(102, "参数token不能为空");
|
|
|
+// }
|
|
|
+// $apply_id = GetUserInfo($token);
|
|
|
+// if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
+// return error_show(102, "申请人数据不存在");
|
|
|
+// }
|
|
|
+ $rm = $this->uid;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
+ $ri = $this->uname;//isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$plan = Db::name("project_plan")->where(["planNo" => $planNo, "is_del" => 0])->lock(true)->find();
|
|
@@ -1501,7 +1503,7 @@ class Sale extends Base
|
|
|
return error_show(1002, "项目订单生成失败");
|
|
|
} else {
|
|
|
//修改状态,添加待办,只记录动作
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $planNo,//编码
|
|
|
"status" => $old_plan_status,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
@@ -1517,14 +1519,14 @@ class Sale extends Base
|
|
|
return error_show(1002, "项目订单生成失败");
|
|
|
} else {
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $project['projectNo'],//项目编码
|
|
|
"status" => $old_project_status,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
], "PRO", 6, $project);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'PRO',
|
|
|
"order_code" => $project['projectNo'],
|
|
|
"order_id" => $project['id'],
|
|
@@ -1534,14 +1536,14 @@ class Sale extends Base
|
|
|
]);
|
|
|
}
|
|
|
//修改状态,添加待办,只记录动作
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $project['projectNo'],//编码,这里是project的编码
|
|
|
"status" => 1,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
|
], "PRT", 2, $this->post);
|
|
|
$process = ["order_code" => $project['projectNo'], "order_id" => $project['id'], "order_status" => 2, "order_type" => "PRT", "before_status" => 1];
|
|
|
- ProcessOrder::AddProcess($this->post['token'], $process);
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], $process);
|
|
|
|
|
|
Db::commit();
|
|
|
return app_show(0, "咨询订单生成成功");
|
|
@@ -1659,14 +1661,14 @@ class Sale extends Base
|
|
|
$standing_book_data['customer_code'] = $datas['customer_code'];
|
|
|
$standing_book_data['infoNo'] = $goodinfo['infoNo'];
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $orderCode,//项目编码
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
], "XSQRD", 0, $datas);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'XSQRD',
|
|
|
"order_code" => $orderCode,
|
|
|
"order_id" => $datainfo,
|
|
@@ -1695,7 +1697,7 @@ class Sale extends Base
|
|
|
return false;
|
|
|
}
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $goodinfo['bidNo'],//项目编码
|
|
|
"status" => $bidstatus,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
@@ -1809,14 +1811,14 @@ class Sale extends Base
|
|
|
return false;
|
|
|
}
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $outCode,//项目编码
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
], "CKD", 0, $out);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'CKD',
|
|
|
"order_code" => $outCode,
|
|
|
"order_id" => $ou,
|
|
@@ -1962,14 +1964,14 @@ class Sale extends Base
|
|
|
|
|
|
$standing_book_data['sale_id'] = $datainfo;
|
|
|
//修改状态,添加待办
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $orderCode,//项目编码
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
], "XSQRD", 0, $datas);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'XSQRD',
|
|
|
"order_code" => $orderCode,
|
|
|
"order_id" => $datainfo,
|
|
@@ -2047,7 +2049,7 @@ class Sale extends Base
|
|
|
//商品变动日志表,good_log_code字段存储采购单号
|
|
|
// $good_data[] = ['good_log_code' => $orderCode, "stock_id" => $stock['id'], "type" => 2, 'stock' => $data['good_num'], "stock_name" => "usable_stock"];
|
|
|
// $good_data[] = ['good_log_code' => $orderCode, "stock_id" => $stock['id'], "type" => 1, 'stock' => $data['good_num'], "stock_name" => "wait_out_stock"];
|
|
|
-// GoodLog::LogAdd($this->post['token'], $good_data, "XSQRD");
|
|
|
+// GoodLog::LogAdd(['id'=>$this->uid,'nickname'=>$this->uname], $good_data, "XSQRD");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -2153,14 +2155,14 @@ class Sale extends Base
|
|
|
$handle_user_list=implode(',', $uids);
|
|
|
}
|
|
|
|
|
|
- ActionLog::logAdd($this->post['token'], [
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $outCode,//出库单号
|
|
|
"status" => 0,//这里的status是之前的值
|
|
|
"action_remark" => '',//备注
|
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
|
], "CKD", 0, $out);
|
|
|
|
|
|
- ProcessOrder::AddProcess($this->post['token'], [
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_type" => 'CKD',
|
|
|
"order_code" => $outCode,//出库单号
|
|
|
"order_id" => $ou,
|
|
@@ -2253,6 +2255,10 @@ class Sale extends Base
|
|
|
|
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
if ($company_name !== "") $where[] = ["s.apply_id", 'in', get_company_item_user_by_name($company_name)];
|
|
|
+
|
|
|
+ $order_source = isset($this->post['order_source']) && $this->post['order_source'] !== "" ? trim($this->post['order_source']) : "";
|
|
|
+ if ($order_source !== "") $where[] = ["s.order_source", '=', $order_source];
|
|
|
+
|
|
|
// if(!empty($role['platform']) ){
|
|
|
// $where[]=["s.platform_id","in",$role['platform']];
|
|
|
// }
|
|
@@ -2306,12 +2312,12 @@ class Sale extends Base
|
|
|
$value['supplierName'] = '';
|
|
|
if ($value['supplierNo'] != "") {
|
|
|
// $supplier = Db::name("business")->where(["companyNo" => $value['supplierNo']])->find();
|
|
|
- $value['supplierName'] = $names[$value['supplierNo']]??'';//isset($supplier['company']) ? $supplier['company'] : "";
|
|
|
+ $value['supplierName'] = $names['data'][$value['supplierNo']]??'';//isset($supplier['company']) ? $supplier['company'] : "";
|
|
|
}
|
|
|
$value['customerName'] = '';
|
|
|
if ($value['customer_code'] != "") {
|
|
|
// $supplier = Db::name("customer_info")->where(["companyNo" => $value['customer_code']])->find();
|
|
|
- $value['customerName'] = $names[$value['customer_code']]??'';//isset($supplier['companyName']) ? $supplier['companyName'] : "";
|
|
|
+ $value['customerName'] = $names['data'][$value['customer_code']]??'';//isset($supplier['companyName']) ? $supplier['companyName'] : "";
|
|
|
}
|
|
|
$value['useage'] = "";
|
|
|
if ($value['use_order'] != 0) {
|
|
@@ -2336,7 +2342,7 @@ class Sale extends Base
|
|
|
|
|
|
public function edit()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !== "" ? trim($this->post['id']) : "";
|
|
|
if ($id == "") {
|
|
|
return error_show(1002, "参数id不能为空");
|
|
@@ -2418,7 +2424,7 @@ class Sale extends Base
|
|
|
$stn = ["order_code" => $etid['orderCode'], "status" => $etid['status'], "action_remark" => '', "action_type" => "edit"];
|
|
|
ActionLog::logAdd(['id'=>$rm,'nickname'=>$ri], $stn, "XSQRD", $etid['status'], $datn);
|
|
|
// $order=["order_type"=>'XSQRD',"order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$etid['status'],"before_status"=> 0];
|
|
|
-// ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+// ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname],$order);
|
|
|
|
|
|
//更新台账
|
|
|
Db::name('standing_book')
|
|
@@ -2652,7 +2658,7 @@ class Sale extends Base
|
|
|
$str = Db::name('sale')->update(['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
|
|
|
if ($str) {
|
|
|
$stc = ["order_code" => $id, "status" => $ed['status'], "action_remark" => '', "action_type" => "delete"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stc, "XSQRD", $ed['status'], ['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stc, "XSQRD", $ed['status'], ['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
|
|
|
$order = ["order_type" => 'XSQRD', "order_code" => $ed['orderCode'], "order_id" => $id, "order_status" => $ed['status'],'holder_id' => $ed['apply_id']
|
|
|
];
|
|
|
ProcessOrder::workdel($order);
|
|
@@ -2665,7 +2671,7 @@ class Sale extends Base
|
|
|
//废弃接口
|
|
|
public function status()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !== "" ? intval($this->post['id']) : "";
|
|
|
if ($id == "") {
|
|
|
return error_show(1002, "参数id不能为空");
|
|
@@ -2716,9 +2722,9 @@ class Sale extends Base
|
|
|
$st = Db::name('sale')->save($dio);
|
|
|
if ($st) {
|
|
|
$stn = ["order_code" => $dio['orderCode'], "status" => $vmp, "action_remark" => '', "action_type" => "status"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stn, $dio['order_type'] == 2 ? "ZXQRD" : "XSQRD", $dio['status'], $dio);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stn, $dio['order_type'] == 2 ? "ZXQRD" : "XSQRD", $dio['status'], $dio);
|
|
|
$order = ["order_type" => "XSQRD", "order_code" => $dio['orderCode'], "order_id" => $id, "order_status" => $dio['status'], "before_status" => 1,'holder_id' => $dio['apply_id']];
|
|
|
- ProcessOrder::AddProcess($this->post['token'], $order);
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], $order);
|
|
|
if ($status == 3 && $dio['order_type'] == 1) {
|
|
|
$dn = Db::name('sale_info')->where(['orderCode' => $st['orderCode']])->select();
|
|
|
foreach ($dn as $value) {
|
|
@@ -2785,7 +2791,7 @@ class Sale extends Base
|
|
|
// var_dump(Db::name("purchease_order")->getLastSql(),$clll);
|
|
|
if ($cgin == false) {
|
|
|
$stb = ["order_code" => $cgd, "status" => $clll['status'], "action_remark" => '', "action_type" => "create"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stb, "xsd", $clll['status'], $stb);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stb, "xsd", $clll['status'], $stb);
|
|
|
Db::rollback();
|
|
|
return error_show(1002, "咨询采购单创建商品失败");
|
|
|
}
|
|
@@ -2820,7 +2826,7 @@ class Sale extends Base
|
|
|
$datainfo = Db::name('order_out')->insertGetId($data);
|
|
|
if (!$datainfo) {
|
|
|
$sti = ["order_code" => $dio['orderCode'], "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
|
- ActionLog::logAdd($this->post['token'], $sti, "xsd", 0, $sti);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $sti, "xsd", 0, $sti);
|
|
|
Db::rollback();
|
|
|
return error_show(1003, "创建失败");
|
|
|
} else {
|
|
@@ -2863,7 +2869,7 @@ class Sale extends Base
|
|
|
$win = Db::name("purchease_in")->insert($orin);
|
|
|
if (!$win) {
|
|
|
$stv = ["order_code" => $wsm_in_code, "status" => 4, "action_remark" => '', "action_type" => "create"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stv, "xsd", 4, $stv);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stv, "xsd", 4, $stv);
|
|
|
Db::rollback();
|
|
|
return error_show(1003, "创建失败");
|
|
|
}
|
|
@@ -2889,7 +2895,7 @@ class Sale extends Base
|
|
|
$upd = Db::name("good_stock")->save($good);
|
|
|
if (!$upd) {
|
|
|
$ste = ["order_code" => $zxinfo['cpNo'], "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
|
- ActionLog::logAdd($this->post['token'], $ste, "xsd", 0, $ste);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $ste, "xsd", 0, $ste);
|
|
|
Db::rollback();
|
|
|
return error_show(1003, "创建失败");
|
|
|
}
|
|
@@ -2929,9 +2935,9 @@ class Sale extends Base
|
|
|
$datainfo = Db::name('sale')->where(['id' => $id, 'is_del' => 0])->save($data);
|
|
|
if ($datainfo) {
|
|
|
$stx = ["order_code" => $etid['orderCode'], "status" => $etid['status'], "action_remark" => '', "action_type" => "edit"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stx, "XSQRD", 2, $data);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stx, "XSQRD", 2, $data);
|
|
|
$order = ["order_type" => "XSQRD", "order_code" => $etid['orderCode'], "order_id" => $id, "order_status" => $data['status'], "before_status" => 0,'holder_id'=>$etid['apply_id']];
|
|
|
- ProcessOrder::AddProcess($this->post['token'], $order);
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], $order);
|
|
|
foreach ($vr as $value) {
|
|
|
$tm = [];
|
|
|
$tm['id'] = $value['id'];
|
|
@@ -2958,7 +2964,7 @@ class Sale extends Base
|
|
|
// 废弃
|
|
|
public function out()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$outCode = makeNo("DF");
|
|
|
$orderCode = isset($this->post['orderCode']) && $this->post['orderCode'] !== "" ? trim($this->post['orderCode']) : "";
|
|
|
if ($orderCode == "") {
|
|
@@ -3260,16 +3266,24 @@ class Sale extends Base
|
|
|
}
|
|
|
$supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !== "" ? trim($this->post['supplierNo']) : "";
|
|
|
if ($supplierNo != "") {
|
|
|
- $where[] = ['c.supplierNo', "like", "%$supplierNo%"];
|
|
|
+ $where[] = ['a.companyNo', "like", "%$supplierNo%"];
|
|
|
}
|
|
|
$customer_code = isset($this->post['customer_code']) && $this->post['customer_code'] !== "" ? trim($this->post['customer_code']) : "";
|
|
|
if ($customer_code != "") {
|
|
|
- $where[] = ['c.customer_code', "like", "%$customer_code%"];
|
|
|
+ $where[] = ['a.customerNo', "like", "%$customer_code%"];
|
|
|
}
|
|
|
$relaComNo = trim($this->post['relaComNo'] ?? '');
|
|
|
if ($relaComNo !== "") {
|
|
|
$where[] = ['c.supplierNo', "=", $relaComNo];
|
|
|
}
|
|
|
+ $order_source = isset($this->post['order_source']) && $this->post['order_source'] != "" ? trim($this->post['order_source']) : "";
|
|
|
+ if ($order_source !== "") {
|
|
|
+ $where[] = ['c.order_source', "=", $order_source];
|
|
|
+ }
|
|
|
+ $is_stock = isset($this->post['is_stock']) && $this->post['is_stock'] != "" ? trim($this->post['is_stock']) : "";
|
|
|
+ if ($is_stock !== "") {
|
|
|
+ $where[] = ['c.is_stock', "=", $is_stock];
|
|
|
+ }
|
|
|
// $role=$this->checkRole();
|
|
|
// if(!empty($role['write'])){
|
|
|
// $where[]=["apply_id","in",$role['write']];
|
|
@@ -3277,10 +3291,10 @@ class Sale extends Base
|
|
|
// $role = $this->checkDataShare();
|
|
|
// if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['c.apply_id', 'in', $role[DataGroupModel::$type_全部]];
|
|
|
$role = $this->checkDataShare();
|
|
|
- $hand = resign_hand_user($this->uid,0);
|
|
|
+ $hand = resign_hand_user($this->uid, 0);
|
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- $arr= array_unique(array_merge($hand,$role[DataGroupModel::$type_全部]));
|
|
|
- $where[] = ['c.apply_id', 'in',$arr];
|
|
|
+ $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
|
|
|
+ $where[] = ['c.apply_id', 'in', $arr];
|
|
|
}
|
|
|
// if(!empty($role['platform']) ){
|
|
|
// $where[]=["c.platform_id","in",$role['platform']];
|
|
@@ -3295,7 +3309,7 @@ class Sale extends Base
|
|
|
$page = $page >= $total ? intval($total) : $page;
|
|
|
$list = Db::name('sale_diff')
|
|
|
->alias('a')
|
|
|
- ->field("a.*,c.customer_code,'' companyName,c.skuCode,c.order_type,c.supplierNo,c.apply_id")
|
|
|
+ ->field("a.*,c.skuCode,c.order_type,c.apply_id,c.order_source,c.is_stock")
|
|
|
->join("sale c", "c.orderCode=a.orderCode", "left")
|
|
|
// ->join("customer_info v", "v.companyNo=c.customer_code", "left")
|
|
|
->where($where)
|
|
@@ -3306,8 +3320,8 @@ class Sale extends Base
|
|
|
|
|
|
$data = [];
|
|
|
|
|
|
- $userCommon = new \app\admin\common\User();
|
|
|
- $names = $userCommon->handle('getCodeAndName',['code'=>array_merge(array_column($list,'supplierNo'),array_column($list,'customer_code'))]);
|
|
|
+// $userCommon = new \app\admin\common\User();
|
|
|
+// $names = $userCommon->handle('getCodeAndName',['code'=>array_merge(array_column($list,'supplierNo'),array_column($list,'customer_code'))]);
|
|
|
|
|
|
foreach ($list as $value) {
|
|
|
if ($value['order_type'] == 3) {
|
|
@@ -3318,9 +3332,9 @@ class Sale extends Base
|
|
|
}
|
|
|
$value['can'] = isset($goon['cat_id']) && $goon['cat_id'] != 0 ? made($goon['cat_id']) : [];
|
|
|
// $wsm = Db::name("business")->where(['companyNo' => $value['supplierNo']])->find();
|
|
|
- $value['supplierNo'] = $value['supplierNo'];//isset($wsm['companyNo']) ? $wsm['companyNo'] : "";
|
|
|
- $value['supplierName'] = $names['data'][$value['supplierNo']] ?? '';//isset($wsm['company']) ? $wsm['company'] : "";
|
|
|
- $value['companyName'] = $names['data'][$value['customer_code']] ?? '';//isset($wsm['company']) ? $wsm['company'] : "";
|
|
|
+// $value['supplierNo'] = $value['supplierNo'];//isset($wsm['companyNo']) ? $wsm['companyNo'] : "";
|
|
|
+// $value['supplierName'] = $names['data'][$value['supplierNo']] ?? '';//isset($wsm['company']) ? $wsm['company'] : "";
|
|
|
+// $value['customer_name'] = $names['data'][$value['customer_code']] ?? '';//isset($wsm['company']) ? $wsm['company'] : "";
|
|
|
|
|
|
//是否具有编辑权限
|
|
|
$value['is_allow_update'] = 0;
|
|
@@ -3340,7 +3354,7 @@ class Sale extends Base
|
|
|
//工差单审核
|
|
|
public function diffcheck()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !== "" ? intval($this->post['id']) : "";
|
|
|
if ($id === "") {
|
|
|
return error_show(1004, "参数id不能为空");
|
|
@@ -3439,7 +3453,7 @@ class Sale extends Base
|
|
|
*/
|
|
|
public function diffstatus()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !== "" ? intval($this->post['id']) : "";
|
|
|
if ($id === "") {
|
|
|
return error_show(1004, "参数id不能为空");
|
|
@@ -3469,9 +3483,9 @@ class Sale extends Base
|
|
|
$up = Db::name("sale_diff")->where($info)->save($upda);
|
|
|
if ($up) {
|
|
|
$stx = ["order_code" => $info["orderCode"], "status" => $ite, "action_remark" => '', "action_type" => "status"];
|
|
|
- ActionLog::logAdd($this->post['token'], $stx, "XSGCD", $status, $info);
|
|
|
+ ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stx, "XSGCD", $status, $info);
|
|
|
$order = ["order_type" => "XSGCD", "order_code" => $info["orderCode"], "order_id" => $info['id'],"order_status" => $status, "before_status" => $ite,'holder_id'=>$sale['apply_id']];
|
|
|
- ProcessOrder::AddProcess($this->post['token'], $order);
|
|
|
+ ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], $order);
|
|
|
$cgdup = Db::name("purchease_diff")->where(["id" => $info['cgd_diffid']])->save($upda);
|
|
|
if ($cgdup) {
|
|
|
if ($status == 2 && $info['customer_remark'] == 1) {
|
|
@@ -3659,6 +3673,9 @@ class Sale extends Base
|
|
|
$where[] = ["a.status", '>=', 2];//搜索发货时间时,要指定状态为已发货及之后的状态值(0待发货,1待库管发货,2已发货待收货,3已收货,4已全部退货',)
|
|
|
}
|
|
|
|
|
|
+ $order_source = isset($this->post['order_source']) && $this->post['order_source'] !== "" ? intval($this->post['order_source']) : "";
|
|
|
+ if ($order_source !== "") $where[] = ["b.order_source", '=', $order_source];
|
|
|
+
|
|
|
$count = Db::name('order_out')
|
|
|
->alias('a')
|
|
|
->join("sale b", "b.orderCode=a.orderCode", "left")
|
|
@@ -3827,7 +3844,7 @@ class Sale extends Base
|
|
|
|
|
|
public function outadd()
|
|
|
{
|
|
|
- $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
+// $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
|
|
|
$orderCode = isset($this->post['orderCode']) && $this->post['orderCode'] !== "" ? trim($this->post['orderCode']) : "";
|
|
|
if ($orderCode == "") {
|
|
|
return error_show(1002, "参数orderCoder不能为空");
|
|
@@ -4009,7 +4026,7 @@ class Sale extends Base
|
|
|
// ::todo
|
|
|
$good_data[] = ['good_log_code' => $outCode, "stock_id" => $temp['id'], "type" => 1, 'stock' => $send_num, "stock_name" => "wait_out_stock"];
|
|
|
$good_data[] = ['good_log_code' => $outCode, "stock_id" => $temp['id'], "type" => 2, 'stock' => $send_num, "stock_name" => "usable_stock"];
|
|
|
- GoodLog::LogAdd($this->post['token'], $good_data, "CKD");
|
|
|
+ GoodLog::LogAdd(['id'=>$this->uid,'nickname'=>$this->uname], $good_data, "CKD");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -4129,9 +4146,9 @@ class Sale extends Base
|
|
|
try {
|
|
|
$up = Db::name("order_out")->where(["outCode"=>$outCode,"status"=>1,"is_del"=>0])->update($outinfo);
|
|
|
|
|
|
- $user_info = GetUserInfo($this->post['token']);
|
|
|
- $uid = isset($user_info['data']['id']) ? $user_info['data']['id'] : 0;
|
|
|
- $uname = isset($user_info['data']['nickname']) ? $user_info['data']['nickname'] : '';
|
|
|
+// $user_info = GetUserInfo($this->post['token']);
|
|
|
+ $uid = $this->uid;//isset($user_info['data']['id']) ? $user_info['data']['id'] : 0;
|
|
|
+ $uname = $this->uname;//isset($user_info['data']['nickname']) ? $user_info['data']['nickname'] : '';
|
|
|
|
|
|
if ($einfo['is_stock'] == 1) {
|
|
|
//如果是库存品,只能由库管和库管-张凯旋操作
|
|
@@ -4670,8 +4687,8 @@ class Sale extends Base
|
|
|
$price = Db::name("gold_price1")->where(["type" => $order['metal_id'], "status" => 1, "is_del" => 0])->order("addtime desc")->find();
|
|
|
|
|
|
}
|
|
|
- $userCommon = new \app\admin\common\User();
|
|
|
- $supplier_temp = $userCommon->handle('getCodeAndName', ['code' => $order['supplierNo']]);
|
|
|
+ $userCommon = new \app\admin\common\User();
|
|
|
+ $supplier_temp = $userCommon->handle('getCodeAndName', ['code' => $order['supplierNo']]);
|
|
|
// $supplier =Db::name("supplier")->where(['code'=>$supplierNo])->find();
|
|
|
// if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"未找到供应商信息");
|
|
|
// $supplier = Db::name("supplier")->where(["code" => $order['supplierNo']])->find();
|
|
@@ -4889,9 +4906,9 @@ class Sale extends Base
|
|
|
|
|
|
|
|
|
|
|
|
- $user = GetUserInfo($param['token']);
|
|
|
- $createrid = $user['data']['id']??0;//$this->uid;
|
|
|
- $creater = $user['data']['nickname']??0;//$this->uname;
|
|
|
+// $user = GetUserInfo($param['token']);
|
|
|
+ $createrid = $this->uid;//$user['data']['id']??0;//$this->uid;
|
|
|
+ $creater = $this->uname;//$user['data']['nickname']??0;//$this->uname;
|
|
|
$own_roleid = Db::name('user_role')->where(['is_del'=>0,'uid'=>$createrid,'status'=>1])->value('roleid',0);
|
|
|
|
|
|
//所有发货单信息
|