|
@@ -289,13 +289,28 @@ class InterOrder extends \app\admin\BaseController{
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
+ $repostinsert=[
|
|
|
+ "qrdNo"=>$qrdcode ,
|
|
|
+ "seller_id"=>$param['sale_id'] ,
|
|
|
+ "seller"=>$param['sale_name'] ,
|
|
|
+ "cgder_id"=>$param['buyerid'] ,
|
|
|
+ "cgder"=>$param['buyer'] ,
|
|
|
+ "customerName"=>$customer['companyName']??"",
|
|
|
+ "customerNo"=>$param['khNo'],//客户编号,
|
|
|
+ "companyNo"=>$param['companyNo'],
|
|
|
+ "companyName"=> $companyName ,
|
|
|
+ "supplierNo"=>$param['supplierNo'],
|
|
|
+ "supplierName"=> $supplierName ,
|
|
|
+ "cgdNo"=>$cgddcode,
|
|
|
+ ];
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$a = Db::name("qrd_info")->insert($qrd);
|
|
|
$d = Db::name("inter_order")->insert($inter);
|
|
|
$b = Db::name('cgd_info')->insert($cgd);
|
|
|
$c = Db::name('good')->insert($good);
|
|
|
- if ($a && $b && $c&&$d) {
|
|
|
+ $e=Db::name("report_code")->insert($repostinsert);
|
|
|
+ if ($a && $b && $c && $d && $e) {
|
|
|
Db::commit();
|
|
|
return app_show(0,'新建成功');
|
|
|
} else {
|
|
@@ -354,6 +369,8 @@ class InterOrder extends \app\admin\BaseController{
|
|
|
$supplierName =Db::name("supplier_info")->where('code', "=", $param['supplierNo'])->value("name","");
|
|
|
$companyName =Db::name("supplier_info")->where('code', "=", $param['companyNo'])->value("name","");
|
|
|
$taxinfo = Db::name("order_rate")->where(["id"=>$param["tax"],"status"=>1])->value("rate",0);
|
|
|
+ $report = Db::name("report_code")->where(["qrdNo"=>$inter_order['orderCode'],"cgdNo"=>$inter_order['cgdNo']])
|
|
|
+ ->findOrEmpty();
|
|
|
$cat = [];
|
|
|
if($qrd_order['status']!=0) return error_show(1004,"销售单已对账,无法修改");
|
|
|
if($cgd_order['status']!=0) return error_show(1004,"采购单已对账,无法修改");
|
|
@@ -444,12 +461,32 @@ class InterOrder extends \app\admin\BaseController{
|
|
|
"cat_name"=>$cat[2]['cat_name'],
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
+ $repostinsert=[
|
|
|
+ "seller_id"=>$param['sale_id'] ,
|
|
|
+ "seller"=>$param['sale_name'] ,
|
|
|
+ "cgder_id"=>$param['buyerid'] ,
|
|
|
+ "cgder"=>$param['buyer'] ,
|
|
|
+ "customerName"=>$customer['companyName']??"",
|
|
|
+ "customerNo"=>$param['khNo'],//客户编号,
|
|
|
+ "companyNo"=>$param['companyNo'],
|
|
|
+ "companyName"=> $companyName ,
|
|
|
+ "supplierNo"=>$param['supplierNo'],
|
|
|
+ "supplierName"=> $supplierName ,
|
|
|
+ ];
|
|
|
+ if(empty($report)){
|
|
|
+ $repostinsert['qrdNo'] =$inter_order['orderCode'];
|
|
|
+ $repostinsert['cgdNo'] =$inter_order['cgdNo'];
|
|
|
+ }else{
|
|
|
+ $repostinsert['id'] = $report['id'];
|
|
|
+ }
|
|
|
+
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$a = Db::name("qrd_info")->save($qrd);
|
|
|
$d = Db::name("inter_order")->save($inter);
|
|
|
$b = Db::name('cgd_info')->save($cgd);
|
|
|
$c = Db::name('good')->save($good);
|
|
|
+ Db::name('report_code')->save($repostinsert);
|
|
|
if ($a && $b && $d &&$c) {
|
|
|
Db::commit();
|
|
|
return app_show(0,'更新成功');
|