Commit f64e9a4a by Joneq

完善添加

parent 3ce6bf13
...@@ -170,12 +170,11 @@ class AdminOutstoreController extends Controller ...@@ -170,12 +170,11 @@ class AdminOutstoreController extends Controller
public function palletActive($request) public function palletActive($request)
{ {
$data = $request->all(); $data = $request->all();
// try{ try{
// $returnData = (new PalletLogic())->palletActive($data); $returnData = (new PalletLogic())->palletActive($data);
// }catch (\Exception $exception){ }catch (\Exception $exception){
// return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data)); return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
// } }
$returnData = (new PalletLogic())->palletActive($data);
return $this->apiReturn($returnData); return $this->apiReturn($returnData);
} }
...@@ -207,6 +206,47 @@ class AdminOutstoreController extends Controller ...@@ -207,6 +206,47 @@ class AdminOutstoreController extends Controller
return $this->apiReturn($returnData); return $this->apiReturn($returnData);
} }
//获取卡板标签打印信息
public function print_pallet_label($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->print_pallet_label($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//获取卡板标签打印信息
public function print_box_label($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->print_box_label($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//获取卡板标签打印信息
public function print_pick_task_label($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->print_pick_task_label($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//获取拣货任务打印信息 //获取拣货任务打印信息
public function print_pick_task_info($request) public function print_pick_task_info($request)
{ {
......
...@@ -59,7 +59,6 @@ class CommonLogic ...@@ -59,7 +59,6 @@ class CommonLogic
case 'delivery_id'://发货人员 case 'delivery_id'://发货人员
case 'admin_id'://根据id获取人员姓名 case 'admin_id'://根据id获取人员姓名
case 'pick_user_id'://拣货人 case 'pick_user_id'://拣货人
case 'confirm_user_id'://确认人
$value = '暂未录入';break; $value = '暂未录入';break;
case 'store_id'://根据仓库IDid获取名称 case 'store_id'://根据仓库IDid获取名称
$value = StoreModel::where('store_id',$value)->value("store_name");break; $value = StoreModel::where('store_id',$value)->value("store_name");break;
...@@ -113,7 +112,7 @@ class CommonLogic ...@@ -113,7 +112,7 @@ class CommonLogic
{ {
$outStoreArr = OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->pluck('out_store_id')->toArray(); $outStoreArr = OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->pluck('out_store_id')->toArray();
foreach (array_filter($outStoreArr) as $key=>$value){ foreach (array_unique(array_filter($outStoreArr)) as $key=>$value){
$outStoreInfo = OutStoreModel::getWhereObj([])->where('out_store_id',$value)->first(); $outStoreInfo = OutStoreModel::getWhereObj([])->where('out_store_id',$value)->first();
...@@ -127,8 +126,8 @@ class CommonLogic ...@@ -127,8 +126,8 @@ class CommonLogic
'SyncName'=>'out_store', 'SyncName'=>'out_store',
'Data'=>[ 'Data'=>[
'erp_store_id'=>$outStoreInfo->erp_out_store_id, 'erp_store_id'=>$outStoreInfo->erp_out_store_id,
'box_number'=>count(array_filter(array_column($outStoreDetailData,'box_id'))), 'box_number'=>count(array_unique(array_filter(array_column($outStoreDetailData,'box_id')))),
'pallet_number'=>count(array_filter(array_column($outStoreDetailData,'pallet_id'))), 'pallet_number'=>count(array_unique(array_filter(array_column($outStoreDetailData,'pallet_id')))),
'detail'=>$outStoreDetailData, 'detail'=>$outStoreDetailData,
] ]
]; ];
......
...@@ -177,10 +177,10 @@ class OutStoreLogic ...@@ -177,10 +177,10 @@ class OutStoreLogic
$outStoreDetailId = OutStoreDetailModel::insertGetId(array_merge(self::handleOutStoreDetailInsertData($value,$insertData),['pick_task_id'=>$pickTaskId])); $outStoreDetailId = OutStoreDetailModel::insertGetId(array_merge(self::handleOutStoreDetailInsertData($value,$insertData),['pick_task_id'=>$pickTaskId]));
//is_apply_customs报关任务默认隐藏 //is_apply_customs报关任务默认隐藏
PickTaskDetailModel::insertGetId(PickTaskLogic::handleInsertData([ PickTaskDetailModel::insertGetId([
'out_store_id'=>$outStoreId,'out_store_detail_id'=>$outStoreDetailId,'store_id'=>$insertData['store_id'], 'out_store_id'=>$outStoreId,'out_store_detail_id'=>$outStoreDetailId,'store_id'=>$insertData['store_id'],
'pick_task_id'=>$pickTaskId,'is_show'=>empty($insertData['is_apply_customs'])?1:0 'pick_task_id'=>$pickTaskId,'is_show'=>empty($insertData['is_apply_customs'])?1:0
])); ]);
} }
DB::commit(); DB::commit();
......
...@@ -41,15 +41,41 @@ class PickTaskLogic ...@@ -41,15 +41,41 @@ class PickTaskLogic
} }
//拣货任务逻辑层 //拣货任务生成逻辑层
static public function handleInsertData($data) static public function handleInsertData($data,$outStoreDetail)
{ {
//判断该拣货任务是否存在
if (!empty(PickTaskDetailModel::where('out_store_detail_id',$data['out_store_detail_id'])->value('pick_task_detail_id'))){
throw new \Exception('该出库商品拣货任务已经存在');
}
$data['add_time'] = time(); $data['add_time'] = time();
return $data; $pickData = [];
//查询当前商品所绑定的库存
$stockInfo = StockModel::where('goods_id',$outStoreDetail['goods_id'])->where('warehousing_sn',$outStoreDetail['warehousing_sn'])->orderBy('stock','asc')->get();
if (empty($stockInfo)){
throw new \Exception('当前入库单的商品库存不存在');
}
$stockInfo = $stockInfo->toArray();
//根据货位,卡板
foreach ($stockInfo as $stockValue){
$locationkey = $stockValue['location_id'].'_'.$stockValue['pallet_id'].'_'.$stockValue['box_id'];
if (isset($pickData[$locationkey])){
$pickData[$locationkey] = bcadd($stockValue['stock'],$pickData[$locationkey]);
}else{
$pickData[$locationkey] = $stockValue['stock'];
}
}
//生成拣货记录
foreach ($pickData as $key=>$value){
$locatiion = explode('_',$key);
$data['number'] = $value;
$data['location_id'] = $locatiion[0];
$data['pallet_id'] = $locatiion[1];
$data['box_id'] = $locatiion[2];
$returData[] = array_merge($value,$data);
}
return $returData;
} }
//生成拣货任务 //生成拣货任务
...@@ -98,7 +124,17 @@ class PickTaskLogic ...@@ -98,7 +124,17 @@ class PickTaskLogic
$outStoreDetailIdArr = OutStoreDetailModel::where('pick_task_id',$pickTaskId)->where('location_id',$locationId)->pluck('out_store_detail_id'); $outStoreDetailIdArr = OutStoreDetailModel::where('pick_task_id',$pickTaskId)->where('location_id',$locationId)->pluck('out_store_detail_id');
} }
$returnData = PickTaskDetailModel::where('is_del',0)->where('is_show',1)->orderBy('pick_status','asc')->whereIn('out_store_detail_id',$outStoreDetailIdArr)->orderBy('add_time','desc')->get(); $returnData = PickTaskDetailModel::where('is_del',0)
->where('is_show',1)
->orderBy('pick_status','asc')
->orderBy('add_time','desc')
->where('pick_task_id',$pickTaskId);
if (!empty($outStoreDetailIdArr)){
$returnData = $returnData->whereIn('out_store_detail_id',$outStoreDetailIdArr);
}
$returnData = $returnData->get();
if (empty($returnData)){ if (empty($returnData)){
return []; return [];
...@@ -109,7 +145,7 @@ class PickTaskLogic ...@@ -109,7 +145,7 @@ class PickTaskLogic
foreach ($returnData as $key=>$value){ foreach ($returnData as $key=>$value){
$value = array_merge($value,OutStoreDetailModel::where('out_store_detail_id',$value['out_store_detail_id'])->first()->toArray()); $value = array_merge($value,OutStoreDetailModel::where('out_store_detail_id',$value['out_store_detail_id'])->first()->toArray());
$returnData[$key] = CommonLogic::getHaveKeyCn($value); $returnData[$key] = CommonLogic::getHaveKeyCn($value);
$returnData[$key]['piece_num'] = 0; $returnData[$key]['piece_num'] = 1;
} }
return $returnData; return $returnData;
} }
...@@ -129,6 +165,7 @@ class PickTaskLogic ...@@ -129,6 +165,7 @@ class PickTaskLogic
DB::beginTransaction(); DB::beginTransaction();
try{ try{
foreach ($pickTaskDetail as $value){ foreach ($pickTaskDetail as $value){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment