|
@@ -323,7 +323,6 @@ class Sale extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
- $outCodeS=[];
|
|
|
if($sendtype==1){
|
|
|
foreach ($addrlist as $value){
|
|
|
$temp=[];
|
|
@@ -424,8 +423,9 @@ class Sale extends Base
|
|
|
]);
|
|
|
|
|
|
|
|
|
- $outCodeS[]=$outCode;
|
|
|
// $standing_book_da['outCode'] = $outCode;
|
|
|
+ if (isset($standing_book_da['outCode'])) $standing_book_da['outCode'][] = $outCode;
|
|
|
+ else $standing_book_da['outCode'] = [$outCode];
|
|
|
}
|
|
|
// }
|
|
|
}else{
|
|
@@ -436,29 +436,13 @@ class Sale extends Base
|
|
|
}
|
|
|
|
|
|
//处理台账
|
|
|
+ if (isset($standing_book_da['outCode'])) $standing_book_da['outCode'] = implode(',', $standing_book_da['outCode']);//发货单号拼接
|
|
|
if (isset($standing_book_da['bk_code'])) {
|
|
|
$temp = Db::name('standing_book')->field('id')->where('bk_code', $standing_book_da['bk_code'])->find();
|
|
|
if (!empty($temp)) Db::name('standing_book')->where('id', $temp['id'])->update($standing_book_da);
|
|
|
else Db::name('standing_book')->insert(array_merge($standing_book_da, ['addtime' => date('Y-m-d H:i:s'), 'standBookNo' => makeNo('IO')]));
|
|
|
} else Db::name('standing_book')->insert(array_merge($standing_book_da, ['addtime' => date('Y-m-d H:i:s'), 'standBookNo' => makeNo('IO')]));
|
|
|
|
|
|
-
|
|
|
- foreach ($outCodeS as $outCodeTemp) {
|
|
|
- $rs = Db::name('standing_book')->where('orderCode', $orderCode)->order('outCode')->find();
|
|
|
-
|
|
|
- if (!empty($rs)) {
|
|
|
- if ($rs['outCode'] == '') Db::name('standing_book')->where('id', $rs['id'])->update(['outCode' => $outCodeTemp, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
- else {
|
|
|
- unset($rs['id']);
|
|
|
- $rs['standBookNo'] = makeNo('IO');
|
|
|
- $rs['outCode'] = $outCodeTemp;
|
|
|
- $rs['addtime'] = date('Y-m-d H:i:s');
|
|
|
- Db::name('standing_book')->insert($rs);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
Db::commit();
|
|
|
return error_show(0,"咨询订单创建成功",["order_code"=>$orderCode]);
|
|
|
}
|
|
@@ -800,7 +784,8 @@ class Sale extends Base
|
|
|
]);
|
|
|
|
|
|
//处理台账-既然是根据orderCode更新的数据,那么肯定是有数据的,只需要更新就行了
|
|
|
- Db::name('standing_book')->where('orderCode', $orderCode)->update(['outCode' => $outCode, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
+ Db::execute("UPDATE `wsm_standing_book` SET `outCode`=CONCAT(`outCode`,',{$outCode}'),`updatetime`='".date('Y-m-d H:i:s')."' WHERE `orderCode`='{$orderCode}'");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//维护商品所在仓库的库存 --- end
|
|
@@ -1136,7 +1121,7 @@ class Sale extends Base
|
|
|
]);
|
|
|
|
|
|
//将发货编号添加到台账中
|
|
|
- $standing_book_data['outCode']=$outCode;
|
|
|
+ $standing_book_data['outCode'][]=$outCode;
|
|
|
}
|
|
|
$order['send_num']+=$value['receipt_quantity'];
|
|
|
$order['wsend_num']-=$value['receipt_quantity'];
|
|
@@ -1169,6 +1154,11 @@ class Sale extends Base
|
|
|
}
|
|
|
|
|
|
//处理台账
|
|
|
+ if(isset($standing_book_data['outCode'])){
|
|
|
+ Db::execute("UPDATE `wsm_standing_book` SET `outCode`=CONCAT(`outCode`,',".implode(',',$standing_book_data['outCode'])."'),`updatetime`='".date('Y-m-d H:i:s')."' WHERE `infoNo`='{$standing_book_data['infoNo']}'");
|
|
|
+ unset($standing_book_data['outCode']);
|
|
|
+ }
|
|
|
+
|
|
|
Db::name('standing_book')->where('infoNo', $standing_book_data['infoNo'])->update($standing_book_data);
|
|
|
|
|
|
Db::commit();
|
|
@@ -1310,6 +1300,7 @@ class Sale extends Base
|
|
|
//项目创建时已有供应商和企业,不能修改
|
|
|
if (isset($standing_book_data['companyNo'])) unset($standing_book_data['companyNo']);
|
|
|
if (isset($standing_book_data['customer_code'])) unset($standing_book_data['customer_code']);
|
|
|
+ if (isset($standing_book_data['outCode'])) $standing_book_data['outCode'] = implode(',', $standing_book_data['outCode']);
|
|
|
|
|
|
//普通商品
|
|
|
if ($feedback['data_source'] == 1) {
|
|
@@ -1327,16 +1318,6 @@ class Sale extends Base
|
|
|
} else {
|
|
|
//项目类竞价单
|
|
|
Db::name('standing_book')->where(['projectNo' => $plan['projectNo'], 'infoNo' => $standing_book_data['infoNo']])->update($standing_book_data);
|
|
|
-// if ($key == 0) Db::name('standing_book')->where('projectNo', $plan['projectNo'])->where('infoNo', $standing_book_data['infoNo'])->update($standing_book_data);
|
|
|
-// else {
|
|
|
-// $temp = Db::name('standing_book')->where('projectNo', $plan['projectNo'])->where('infoNo', $standing_book_data['infoNo'])->find();
|
|
|
-// if (!empty($temp)) {
|
|
|
-// unset($temp['id']);
|
|
|
-// $temp = array_merge($temp, $standing_book_data);
|
|
|
-// $temp['standBookNo'] = makeNo('IO');
|
|
|
-// Db::name('standing_book')->insert($temp);
|
|
|
-// }
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1653,7 +1634,7 @@ class Sale extends Base
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- $standing_book_data['outCode'] = $outCode;
|
|
|
+ $standing_book_data['outCode'][] = $outCode;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -1911,7 +1892,7 @@ class Sale extends Base
|
|
|
if ($ou == false) {
|
|
|
return 0;
|
|
|
} else {
|
|
|
- $standing_book_data['outCode'] = $outCode;
|
|
|
+ $standing_book_data['outCode'][] = $outCode;
|
|
|
//修改状态,添加待办
|
|
|
ActionLog::logAdd($this->post['token'], [
|
|
|
"order_code" => $outCode,//出库单号
|
|
@@ -2579,17 +2560,7 @@ class Sale extends Base
|
|
|
}
|
|
|
|
|
|
//维护台账
|
|
|
- $rs = Db::name('standing_book')->where('cgdNo', $cgd)->order('wsm_in_code')->find();
|
|
|
- if (!empty($rs)) {
|
|
|
- if ($rs['wsm_in_code'] == '') Db::name('standing_book')->where('id', $rs['id'])->update(['wsm_in_code' => $wsm_in_code, 'update' => date('Y-m-d H:i:s')]);
|
|
|
- else {
|
|
|
- unset($rs['id']);
|
|
|
- $rs['standBookNo'] = makeNo('IO');
|
|
|
- $rs['updatetime'] = $rs['addtime'] = date('Y-m-d H:i:s');
|
|
|
- $rs['wsm_in_code'] = $wsm_in_code;
|
|
|
- Db::name('standing_book')->insert($rs);
|
|
|
- }
|
|
|
- }
|
|
|
+ Db::execute("UPDATE `wsm_standing_book` SET `wsm_in_code`=CONCAT(`wsm_in_code`,',{$wsm_in_code}'),`updatetime`='".date('Y-m-d H:i:s')."' WHERE `cgdNo`='{$cgd}'");
|
|
|
|
|
|
$good = Db::name("good_stock")->where(["wsm_code" => $wsm['wsm_code'], "good_type_code" => $zxinfo['cpNo'], "is_del" => 0])->find();
|
|
|
if (empty($good)) {
|
|
@@ -3518,11 +3489,12 @@ class Sale extends Base
|
|
|
'order_type' => $der['order_type'],
|
|
|
'order_source' => $der['order_source'],
|
|
|
'cgdNo' => $order['cgdNo'],
|
|
|
- 'outCode' => $outCode,
|
|
|
'customer_code' => $der['customer_code'],
|
|
|
'updatetime' => date('Y-m-d H:i:s'),
|
|
|
]);
|
|
|
|
|
|
+ Db::execute("UPDATE `wsm_standing_book` SET `outCode`=CONCAT(`outCode`,',{$outCode}') WHERE `cgdNo`='{$cgd}'");
|
|
|
+
|
|
|
Db::commit();
|
|
|
return app_show(0,"出库单新建成功");
|
|
|
}
|