|
@@ -231,7 +231,6 @@ class BoxService extends Service
|
|
//包装单
|
|
//包装单
|
|
$package_data = $msg->toArray();
|
|
$package_data = $msg->toArray();
|
|
|
|
|
|
-
|
|
|
|
$dispatch_list = $msg1 ?? [];
|
|
$dispatch_list = $msg1 ?? [];
|
|
if(! empty($dispatch_list)){
|
|
if(! empty($dispatch_list)){
|
|
foreach ($dispatch_list as $key => $value){
|
|
foreach ($dispatch_list as $key => $value){
|
|
@@ -249,6 +248,14 @@ class BoxService extends Service
|
|
->select('ext_1 as product_no', 'ext_3 as technology_name', 'ext_8 as product_title', 'ext_9 as product_size', 'num as quantity')
|
|
->select('ext_1 as product_no', 'ext_3 as technology_name', 'ext_8 as product_title', 'ext_9 as product_size', 'num as quantity')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
|
|
|
|
|
|
+ //生成半成品出库申请单
|
|
|
|
+ list($status, $msg1) = $this->createbcpllSQ($package_data,$boxDetail, $user);
|
|
|
|
+ if(! $status) {
|
|
|
|
+ $this->dellimitingSendRequestBackgNeed($limit_key);
|
|
|
|
+ DB::rollBack();
|
|
|
|
+ return [false, $msg1];
|
|
|
|
+ }
|
|
|
|
+
|
|
//生成包装领料申请单
|
|
//生成包装领料申请单
|
|
list($status, $msg1) = $this->createllSQ($package_data,$boxDetail, $user);
|
|
list($status, $msg1) = $this->createllSQ($package_data,$boxDetail, $user);
|
|
if(! $status) {
|
|
if(! $status) {
|
|
@@ -311,6 +318,54 @@ class BoxService extends Service
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function createbcpllSQ($package_data, $insert_id, $user){
|
|
|
|
+ //是否自动审核 半成品出库申请单
|
|
|
|
+ $em = new EmployeeService();
|
|
|
|
+ $auto = $em->is_auto($user,"bcpckllsq_auto");
|
|
|
|
+
|
|
|
|
+ //组织包装原材料写入数据
|
|
|
|
+ $insert = [];
|
|
|
|
+ $box_id = $package_data['id'] ?? 0;
|
|
|
|
+ foreach ($insert_id as $value){
|
|
|
|
+ $insert[] = [
|
|
|
|
+ 'id' => $box_id,
|
|
|
|
+ 'quantity' => $value['quantity'] ?? 0,
|
|
|
|
+ 'product_no' => $value['product_no'],
|
|
|
|
+ 'product_title' => $value['product_title'],
|
|
|
|
+ 'product_size' => "",
|
|
|
|
+ 'product_unit' => "",
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ DB::beginTransaction();
|
|
|
|
+
|
|
|
|
+ //生成申请单
|
|
|
|
+ $service = new ApplyOrderService();
|
|
|
|
+ list($status, $msg) = $service->createSQ($insert, $user, ApplyOrder::type_six, $auto);
|
|
|
|
+ if(! $status) {
|
|
|
|
+ DB::rollBack();
|
|
|
|
+ return [false, $msg];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($auto) {
|
|
|
|
+ //生成流水
|
|
|
|
+ list($status, $msg) = $service->createRecord($msg);
|
|
|
|
+ if(! $status) {
|
|
|
|
+ DB::rollBack();
|
|
|
|
+ return [false, $msg];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DB::commit();
|
|
|
|
+ }catch (\Throwable $exception){
|
|
|
|
+ DB::rollBack();
|
|
|
|
+ return [false, $exception->getFile() . $exception->getMessage() . $exception->getLine()];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return [true, ''];
|
|
|
|
+ }
|
|
|
|
+
|
|
public function createllSQ($package_data, $insert_id, $user){
|
|
public function createllSQ($package_data, $insert_id, $user){
|
|
//是否自动审核 包装领料申请单
|
|
//是否自动审核 包装领料申请单
|
|
$em = new EmployeeService();
|
|
$em = new EmployeeService();
|
|
@@ -968,8 +1023,8 @@ class BoxService extends Service
|
|
$service->writeFinishedQuantity($id);
|
|
$service->writeFinishedQuantity($id);
|
|
|
|
|
|
//生成完工入库申请单
|
|
//生成完工入库申请单
|
|
- list($status, $msg) = $this->createWGSQ($last_update, $user);
|
|
|
|
- if(! $status) return [false, $msg];
|
|
|
|
|
|
+// list($status, $msg) = $this->createWGSQ($last_update, $user);
|
|
|
|
+// if(! $status) return [false, $msg];
|
|
|
|
|
|
//生成报工单
|
|
//生成报工单
|
|
$service = new FinishedOrderService();
|
|
$service = new FinishedOrderService();
|