Commit 033ecfb0 by Joneq

增加拣货任务的卡板和箱子ID

parent 2955ee28
......@@ -66,13 +66,13 @@ class PickTaskLogic
}
}
//生成拣货记录
//生成拣货记录,增加拣货任务不变的卡板定位箱子数据。
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];
$data['pick_location_id'] = $data['location_id'] = $locatiion[0];
$data['pick_pallet_id'] = $data['pallet_id'] = $locatiion[1];
$data['pick_box_id'] = $data['box_id'] = $locatiion[2];
$returData[] = $data;
}
......@@ -206,7 +206,9 @@ class PickTaskLogic
}else{
$packCheckId = $packInfo->pack_check_id;
}
PickTaskDetailModel::getWhereObj([])->where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['pack_check_id'=>$packCheckId]);
//当时拆零的时候就重新设置卡板和箱子ID
PickTaskDetailModel::getWhereObj([])->where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['pack_check_id'=>$packCheckId,'pallet_id'=>0,'box_id'=>0]);
}
}
......@@ -268,137 +270,11 @@ class PickTaskLogic
throw new \Exception('拣货事物异常错误为: '.$exception->getMessage());
}
return [];
}
//拣货
public function confirmPick_back($data)
{
$outStoreDetailIdArr = $data['out_store_detail_id_arr'];
//获取可以拣货的数据
if (empty($pickTaskDetail = PickTaskDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->where('pick_status','!=',3)->get()->toArray())){
throw new \Exception('当前出库号没有可以拣货任务: ');
}
self::checkIsPackCheck($outStoreDetailIdArr,'该单据已经复核,不可再拣货');
DB::beginTransaction();
try{
foreach ($pickTaskDetail as $value){
//获取需要配合的拣货详情
if (empty($outStoreDetailInfo = OutStoreDetailModel::where('out_store_detail_id',$value['out_store_detail_id'])->first())){
throw new \Exception('当前出库详情没有数据: '.$value['out_store_detail_id']);
}
$outStoreDetailInfo = $outStoreDetailInfo->toArray();
//增加冻结库存,扣减可用库存,实际库存不变 如果为散件,则生成打包复核任务
if (empty($stockInfo = StockModel::where('goods_name',$outStoreDetailInfo['goods_name'])->orderBy('stock','asc')->select('stock','stock_id')->get()->toArray())){
throw new \Exception('当前库存详情没有数据: '.$outStoreDetailInfo['goods_id']);
}
//下架箱子和卡板
if (!empty($outStoreDetailInfo['box_id'])){
BoxModel::getWhereObj([])->where('box_id',$outStoreDetailInfo['box_id'])->update(['status'=>3]);
}
if (!empty($outStoreDetailInfo['pallet_id'])){
PalletModel::getWhereObj([])->where('pallet_id',$outStoreDetailInfo['pallet_id'])->update(['status'=>3]);
}
//如果该任务没有打包复核任务,而且还是散件,就生成一个打包复核任务
if(empty($outStoreDetailInfo['box_id']) && empty($outStoreDetailInfo['pallet_id'])){
$picktaskInfo = PickTaskModel::getWhereObj([])->where('pick_task_id',$value['pick_task_id'])->first();
if (!empty($picktaskInfo)){
//如果没有就添加
if (empty($packInfo = PackCheckModel::getWhereObj([])->where('pick_task_id',$value['pick_task_id'])->first())){
$packCheckId = PackCheckModel::insertGetId([
'pack_check_sn'=>PackCheckLogic::getPackCheckSn(),'pick_task_sn'=>$picktaskInfo->pick_task_sn,
'in_store_sn'=>OutStoreModel::where('out_store_id',$outStoreDetailInfo['out_store_id'])->value('warehousing_sn'),
'pick_task_id'=>$picktaskInfo->pick_task_id,'add_time'=>time(),'store_id'=>CommonLogic::getAdminInfo()['store_id']
]);
}else{
$packCheckId = $packInfo->pack_check_id;
}
PickTaskDetailModel::getWhereObj([])->where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['pack_check_id'=>$packCheckId,'pick_remark'=>'散件']);
}
}
//查询出所有商品ID
$goodsIdArr = GoodsModel::where('goods_name',$outStoreDetailInfo['goods_name'])->where('status',1)->pluck('goods_id')->toArray();
if (empty($goodsIdArr)){
throw new \Exception('该型号暂无商品');
}
//查看数量是否足够 ,所有库存减去冻结库存
$totalNumber = array_sum(array_column($stockInfo,'stock'));
$totalNumber = $totalNumber - StockFrozenModel::whereIn('goods_id',$goodsIdArr)->where('status',1)->sum('number');
if ( $totalNumber < $outStoreDetailInfo['number']){
throw new \Exception('该商品库存不足');
}
$needNumber = $outStoreDetailInfo['number'];
foreach ($stockInfo as $stockValue){
//所需要库存完整了,就停止
if ($needNumber <= 0){
break;
}
//查看当前可用的库存是否充足,没有了直接跳过
if ($currentStocFrozenkNum = StockFrozenModel::whereIn('stock_id',[$stockValue['stock_id']])->where('status',1)->value('number')){
if ( ($stockValue['stock'] -= $currentStocFrozenkNum) <= 0){
continue;
}
}
//增加相应的冻结库存
if ($stockValue['stock'] < $needNumber){
$needNumber = $needNumber - $stockValue['stock'];
$stockFrozenNum = $stockValue['stock'];
}else{
$stockFrozenNum = $needNumber;
$needNumber = 0;
}
//增加冻结库存
if ($frozenInfo = StockFrozenModel::where('stock_id',$stockValue['stock_id'])->where('pick_task_detail_id',$value['pick_task_detail_id'])->first()){
$frozenInfo = $frozenInfo->toArray();
StockFrozenModel::where('stock_id',$stockValue['stock_id'])->where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['number'=>bcadd($frozenInfo['number'],$stockFrozenNum)]);
}else{
StockFrozenModel::insertGetId([
'stock_id'=>$stockValue['stock_id'], 'store_id'=>$outStoreDetailInfo['store_id'],'location_id'=>$outStoreDetailInfo['location_id'],
'goods_id'=>$outStoreDetailInfo['goods_id'],
'status'=>1,'add_time'=>time(),'number'=>$stockFrozenNum,'pick_task_detail_id'=>$value['pick_task_detail_id']
]);
}
}
}
//确认拣货
PickTaskDetailModel::where('pick_task_detail_id',$outStoreDetailIdArr)->update(['pick_status'=>3,'pick_time'=>time(),'pick_user_name'=>CommonLogic::getAdminInfo()['admin_name']]);
DB::commit();
}catch (\Exception $exception){
DB::rollBack();
throw new \Exception($value['pick_task_detail_id'].'拣货事物异常错误为: '.$exception->getMessage());
}
return [];
}
/**
* 取消拣货
......@@ -433,8 +309,9 @@ class PickTaskLogic
}
StockFrozenModel::where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['number'=>0]);
//取消拣货
PickTaskDetailModel::where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['pick_status'=>4]);
//取消拣货,修改打包复核ID未0,返回原始的箱子和卡板ID
PickTaskDetailModel::where('pick_task_detail_id',$value['pick_task_detail_id'])->update(['pick_status'=>4,'pack_check_id'=>0,'pallet_id'=>$value['pick_pallet_id'],'box_id'=>$value['pick_box_id']]);
}
DB::commit();
......
{"server":{"listen_ip":"0.0.0.0","listen_port":"40003","socket_type":1,"enable_coroutine_runtime":false,"server":"LaravelS","handle_static":false,"laravel_base_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","inotify_reload":{"enable":false,"watch_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","file_types":[".php"],"excluded_dirs":[],"log":true},"event_handlers":[],"websocket":{"enable":false},"sockets":[],"processes":[],"timer":{"enable":false,"jobs":[],"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels-timer.pid","max_wait_time":5},"events":[],"swoole_tables":[],"register_providers":[],"cleaners":[],"swoole":{"daemonize":false,"dispatch_mode":2,"reactor_num":4,"worker_num":"3","task_worker_num":3,"task_ipc_mode":1,"task_max_request":8000,"task_tmpdir":"/tmp","max_request":8000,"open_tcp_nodelay":true,"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels.pid","log_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/logs/swoole-2020-05.log","log_level":4,"document_root":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","buffer_output_size":2097152,"socket_buffer_size":134217728,"package_max_length":4194304,"reload_async":true,"max_wait_time":60,"enable_reuse_port":true,"enable_coroutine":false,"http_compression":false},"enable_gzip":false,"process_prefix":"/usr/local/var/www/ichunt/scm_wms_outstore_service","ignore_check_pid":false},"laravel":{"root_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","static_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","cleaners":[],"register_providers":[],"is_lumen":true,"_SERVER":{"SHELL":"/bin/bash","TERM":"xterm-256color","HOMEBREW_BOTTLE_DOMAIN":"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles","TMPDIR":"/var/folders/vd/95yw3kdx65n1qw9ggmkkkp7c0000gn/T/","Apple_PubSub_Socket_Render":"/private/tmp/com.apple.launchd.Ybc04IIj0V/Render","USER":"gongyang","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.72OSyFTSH8/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x19:0x34","PATH":"/usr/local/opt/mysql@5.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","_":"/usr/bin/php","PWD":"/usr/local/var/www/ichunt/scm_wms_outstore_service","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"0","HOME":"/Users/gongyang","SHLVL":"2","LOGNAME":"gongyang","LC_CTYPE":"zh_CN.UTF-8","PHP_SELF":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_NAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_FILENAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","PATH_TRANSLATED":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","DOCUMENT_ROOT":"","REQUEST_TIME_FLOAT":1590394148.722395,"REQUEST_TIME":1590394148,"argv":["/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","laravels","config"],"argc":3,"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","DB_TIMEZONE":"+08:00","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","RABBIT_IP":"192.168.1.237","RABBIT_PORT":"5672","RABBIT_USER":"huntadmin","RABBIT_PASS":"jy2y2900","RABBITMQ_LOG_HOST":"192.168.1.237","RABBITMQ_LOG_PORT":"5672","RABBITMQ_LOG_VHOST":"/","RABBITMQ_LOG_LOGIN":"huntadmin","RABBITMQ_LOG_PASSWORD":"jy2y2900","RABBITMQ_LOG_QUEUE":"scm_wms_log","SHELL_VERBOSITY":0},"_ENV":{"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","DB_TIMEZONE":"+08:00","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","RABBIT_IP":"192.168.1.237","RABBIT_PORT":"5672","RABBIT_USER":"huntadmin","RABBIT_PASS":"jy2y2900","RABBITMQ_LOG_HOST":"192.168.1.237","RABBITMQ_LOG_PORT":"5672","RABBITMQ_LOG_VHOST":"/","RABBITMQ_LOG_LOGIN":"huntadmin","RABBITMQ_LOG_PASSWORD":"jy2y2900","RABBITMQ_LOG_QUEUE":"scm_wms_log","SHELL_VERBOSITY":0}}}
\ No newline at end of file
{"server":{"listen_ip":"0.0.0.0","listen_port":"40003","socket_type":1,"enable_coroutine_runtime":false,"server":"LaravelS","handle_static":false,"laravel_base_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","inotify_reload":{"enable":false,"watch_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","file_types":[".php"],"excluded_dirs":[],"log":true},"event_handlers":[],"websocket":{"enable":false},"sockets":[],"processes":[],"timer":{"enable":false,"jobs":[],"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels-timer.pid","max_wait_time":5},"events":[],"swoole_tables":[],"register_providers":[],"cleaners":[],"swoole":{"daemonize":false,"dispatch_mode":2,"reactor_num":4,"worker_num":"3","task_worker_num":3,"task_ipc_mode":1,"task_max_request":8000,"task_tmpdir":"/tmp","max_request":8000,"open_tcp_nodelay":true,"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels.pid","log_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/logs/swoole-2020-05.log","log_level":4,"document_root":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","buffer_output_size":2097152,"socket_buffer_size":134217728,"package_max_length":4194304,"reload_async":true,"max_wait_time":60,"enable_reuse_port":true,"enable_coroutine":false,"http_compression":false},"enable_gzip":false,"process_prefix":"/usr/local/var/www/ichunt/scm_wms_outstore_service","ignore_check_pid":false},"laravel":{"root_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","static_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","cleaners":[],"register_providers":[],"is_lumen":true,"_SERVER":{"SHELL":"/bin/bash","TERM":"xterm-256color","HOMEBREW_BOTTLE_DOMAIN":"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles","TMPDIR":"/var/folders/vd/95yw3kdx65n1qw9ggmkkkp7c0000gn/T/","Apple_PubSub_Socket_Render":"/private/tmp/com.apple.launchd.82jgcg5o1R/Render","USER":"gongyang","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.fyOvpp3bLO/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x19:0x34","PATH":"/usr/local/opt/mysql@5.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","_":"/usr/bin/php","PWD":"/usr/local/var/www/ichunt/scm_wms_outstore_service","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"0","HOME":"/Users/gongyang","SHLVL":"2","LOGNAME":"gongyang","LC_CTYPE":"zh_CN.UTF-8","PHP_SELF":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_NAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_FILENAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","PATH_TRANSLATED":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","DOCUMENT_ROOT":"","REQUEST_TIME_FLOAT":1590557999.182746,"REQUEST_TIME":1590557999,"argv":["/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","laravels","config"],"argc":3,"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","DB_TIMEZONE":"+08:00","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","RABBIT_IP":"192.168.1.237","RABBIT_PORT":"5672","RABBIT_USER":"huntadmin","RABBIT_PASS":"jy2y2900","RABBITMQ_LOG_HOST":"192.168.1.237","RABBITMQ_LOG_PORT":"5672","RABBITMQ_LOG_VHOST":"/","RABBITMQ_LOG_LOGIN":"huntadmin","RABBITMQ_LOG_PASSWORD":"jy2y2900","RABBITMQ_LOG_QUEUE":"scm_wms_log","SHELL_VERBOSITY":0},"_ENV":{"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","DB_TIMEZONE":"+08:00","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","RABBIT_IP":"192.168.1.237","RABBIT_PORT":"5672","RABBIT_USER":"huntadmin","RABBIT_PASS":"jy2y2900","RABBITMQ_LOG_HOST":"192.168.1.237","RABBITMQ_LOG_PORT":"5672","RABBITMQ_LOG_VHOST":"/","RABBITMQ_LOG_LOGIN":"huntadmin","RABBITMQ_LOG_PASSWORD":"jy2y2900","RABBITMQ_LOG_QUEUE":"scm_wms_log","SHELL_VERBOSITY":0}}}
\ No newline at end of file
78216
\ No newline at end of file
46472
\ No newline at end of file
......@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
......@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
......
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