|
|
@@ -6,6 +6,8 @@ use App\Feature;
|
|
|
use App\Jobs\StoreCreateInstantBill;
|
|
|
use App\Order;
|
|
|
use App\OwnerFeeDetail;
|
|
|
+use App\OwnerFeeOperation;
|
|
|
+use App\OwnerFeeOperationDetail;
|
|
|
use App\Services\common\BatchUpdateService;
|
|
|
use App\Services\common\DataHandlerService;
|
|
|
use App\Services\common\QueryService;
|
|
|
@@ -325,9 +327,21 @@ class StoreService
|
|
|
/** @var OwnerPriceOperationService $service */
|
|
|
$service = app("OwnerPriceOperationService");
|
|
|
|
|
|
+ $GLOBALS["FEE_INFO"] = [];
|
|
|
list($id,$money,$taxFee) = $service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库");
|
|
|
+ if ($money>0)$this->constructFeeInfo([
|
|
|
+ "worked_at" => $store->updated_at,
|
|
|
+ "owner_id" => $store->owner_id,
|
|
|
+ "model_id" => $id,
|
|
|
+ "source_number"=> null,
|
|
|
+ "doc_number" => $store->asn_code,
|
|
|
+ "commodity_id" => 0,
|
|
|
+ "total_fee" =>0,
|
|
|
+ "tax_rate" =>0,
|
|
|
+ "fee_description"=>'',
|
|
|
+ ]);
|
|
|
|
|
|
- if (app("OwnerFeeDetailService")->create([
|
|
|
+ if (!app("OwnerFeeDetailService")->create([
|
|
|
"owner_id" => $store->owner_id,
|
|
|
"worked_at" => $store->updated_at,
|
|
|
"type" => "收货",
|
|
|
@@ -339,15 +353,48 @@ class StoreService
|
|
|
"outer_id" => $store->id,
|
|
|
"outer_table_name" => "stores",
|
|
|
"work_tax_fee" => $taxFee,
|
|
|
- ])){
|
|
|
- $amount = 0;
|
|
|
- if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount;
|
|
|
- $this->setStoreAmount($store->owner_id,$amount);
|
|
|
- Cache::put("owner_fee_details:stores_".$store->id,1,86400);
|
|
|
- return true;
|
|
|
+ ])) return false;
|
|
|
+ $amount = 0;
|
|
|
+ if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount;
|
|
|
+ $this->setStoreAmount($store->owner_id,$amount);
|
|
|
+ Cache::put("owner_fee_details:stores_".$store->id,1,86400);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构建费用信息
|
|
|
+ *
|
|
|
+ * @param array $defaultInfo
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function constructFeeInfo(array $defaultInfo)
|
|
|
+ {
|
|
|
+ foreach ($GLOBALS["FEE_INFO"] as $info){
|
|
|
+ $operation = $defaultInfo;
|
|
|
+ foreach ($operation as $key=>$val)if (isset($info[$key]))$operation[$key] = $info[$key];
|
|
|
+ $model = OwnerFeeOperation::query()->create($operation);
|
|
|
+ foreach ($info['details'] as &$detail)$detail["owner_fee_operation_id"] = $model->id;
|
|
|
+ OwnerFeeOperationDetail::query()->insert($info['details']);
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 清除费用信息
|
|
|
+ *
|
|
|
+ * @param string $docNumber
|
|
|
+ */
|
|
|
+ public function clearFeeInfo(string $docNumber)
|
|
|
+ {
|
|
|
+ $models = OwnerFeeOperation::query()->where("doc_number",$docNumber)->get();
|
|
|
+ if ($models->count()==0)return;
|
|
|
+ OwnerFeeOperationDetail::query()->whereIn("owner_fee_operation_id",array_column($models->toArray(),"id"))->delete();
|
|
|
+ OwnerFeeOperation::query()->where("doc_number",$docNumber)->delete();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param $asnHerders
|
|
|
+ * @return null
|
|
|
+ */
|
|
|
public function createStoreRejected($asnHerders){
|
|
|
if (!$asnHerders) return null;
|
|
|
$stores = $this->getByWms($asnHerders);
|
|
|
@@ -388,7 +435,7 @@ SELECT sum(amount) total FROM `store_items` LEFT JOIN stores ON store_items.stor
|
|
|
sql
|
|
|
);
|
|
|
$statistics = DB::selectOne($query,[$owner,date("Y-m")."%"]);
|
|
|
- Cache::put(date("Y-m")."|A|".$owner,$statistics->total ? $statistics->total : 0,2764800);
|
|
|
+ Cache::put(date("Y-m")."|A|".$owner,$statistics->total ?: 0,2764800);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -417,133 +464,4 @@ sql
|
|
|
if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);
|
|
|
return Cache::get($date."|A|".$owner);
|
|
|
}
|
|
|
-
|
|
|
- public function warehousing(array $params)
|
|
|
- {
|
|
|
- $conn = oci_connect(config('database.connections.oracle.username'),
|
|
|
- config('database.connections.oracle.password'),
|
|
|
- config('database.connections.oracle.host'). '/' . config('database.connections.oracle.service_name'),"utf8");
|
|
|
- $sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," .
|
|
|
- ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
|
|
|
- " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
|
|
|
- ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
|
|
|
- ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
|
|
|
- ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
|
|
|
- $inParams = array(
|
|
|
- "IN_Warehouse"=>"",
|
|
|
- "In_Process_Action"=>"",
|
|
|
- "In_ASNNo_C"=>"",
|
|
|
- "In_ASNLineNo_C"=>"",
|
|
|
- "In_FMTraceID_C"=>"",
|
|
|
- "In_New_TraceID_C"=>"",
|
|
|
- "In_ProductStatus"=>"00",
|
|
|
- "In_ProductStatus_Descr"=>"正常",
|
|
|
- "In_HoldRejectCode_C"=>"OK",
|
|
|
- "In_HoldRejectReason_C"=>"正常",
|
|
|
- "In_PONo_C"=>"",
|
|
|
- "In_CustomerID"=>"",
|
|
|
- "In_SKU"=>"",
|
|
|
- "In_ReceivedQty"=>"",
|
|
|
- "In_RejectedQty"=>"",
|
|
|
- "In_UOM"=>"EA",
|
|
|
- "In_PackID"=>"",
|
|
|
- "In_ContainerID"=>"",
|
|
|
- "In_LotAtt01_C"=>"",
|
|
|
- "In_LotAtt02_C"=>"",
|
|
|
- "In_LotAtt03_C"=>"",
|
|
|
- "In_LotAtt04_C"=>"",
|
|
|
- "In_LotAtt05_C"=>"",
|
|
|
- "In_LotAtt06_C"=>"",
|
|
|
- "In_LotAtt07_C"=>"",
|
|
|
- "In_LotAtt08_C"=>"",
|
|
|
- "In_LotAtt09_C"=>"",
|
|
|
- "In_LotAtt10_C"=>"",
|
|
|
- "In_LotAtt11_C"=>"",
|
|
|
- "In_LotAtt12_C"=>"",
|
|
|
- "In_TotalCubic"=>"0.00",
|
|
|
- "In_TotalGrossWeight"=>"0.00",
|
|
|
- "In_TotalNetWeight"=>"0.00",
|
|
|
- "In_TotalPrice"=>"0.00",
|
|
|
- "In_UserDefine1"=>"",
|
|
|
- "In_UserDefine2"=>"",
|
|
|
- "In_UserDefine3"=>"",
|
|
|
- "In_UserDefine4"=>"",
|
|
|
- "In_UserDefine5"=>"",
|
|
|
- "In_FMLocation"=>"",
|
|
|
- "In_TOLocation_C"=>"",
|
|
|
- "In_QC_Type_C"=>"OK",
|
|
|
- "In_PlanToLoc_C"=>"",
|
|
|
- "In_ReceivingTime"=>"",
|
|
|
- "In_LPN"=>"*",
|
|
|
- "In_Operator"=>"WCS",
|
|
|
- "IN_RCVModule"=>"",
|
|
|
- "IN_RCVStation"=>"",
|
|
|
- "In_Language"=>"cn",
|
|
|
- "In_UserID"=>"WCS",
|
|
|
- "result"=>""
|
|
|
- );
|
|
|
- foreach ($params as $key=>$val)$inParams[$key] = $val;
|
|
|
- list($IN_Warehouse,$In_Process_Action,$In_ASNNo_C,$In_ASNLineNo_C,$In_FMTraceID_C,$In_New_TraceID_C,$In_ProductStatus,
|
|
|
- $In_ProductStatus_Descr,$In_HoldRejectCode_C,$In_HoldRejectReason_C,$In_PONo_C,$In_CustomerID,$In_SKU,$In_ReceivedQty,
|
|
|
- $In_RejectedQty,$In_UOM,$In_PackID,$In_ContainerID,$In_LotAtt01_C,$In_LotAtt02_C,$In_LotAtt03_C,$In_LotAtt04_C,$In_LotAtt05_C,
|
|
|
- $In_LotAtt06_C,$In_LotAtt07_C,$In_LotAtt08_C,$In_LotAtt09_C,$In_LotAtt10_C,$In_LotAtt11_C,$In_LotAtt12_C,$In_TotalCubic,
|
|
|
- $In_TotalGrossWeight,$In_TotalNetWeight,$In_TotalPrice,$In_UserDefine1,$In_UserDefine2,$In_UserDefine3,$In_UserDefine4,
|
|
|
- $In_UserDefine5,$In_FMLocation,$In_TOLocation_C,$In_QC_Type_C,$In_PlanToLoc_C,$In_ReceivingTime,$In_LPN,$In_Operator,
|
|
|
- $IN_RCVModule,$IN_RCVStation,$In_Language,$In_UserID,$result) = array_values($inParams);
|
|
|
- $stmt = oci_parse($conn, $sp);
|
|
|
- oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
|
|
|
- oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
|
|
|
- oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
|
|
|
- oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
|
|
|
- oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
|
|
|
- oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
|
|
|
- oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
|
|
|
- oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
|
|
|
- oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
|
|
|
- oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
|
|
|
- oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
|
|
|
- oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
|
|
|
- oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
|
|
|
- oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
|
|
|
- oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
|
|
|
- oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
|
|
|
- oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
|
|
|
- oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
|
|
|
- oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
|
|
|
- oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
|
|
|
- oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
|
|
|
- oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
|
|
|
- oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
|
|
|
- oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
|
|
|
- oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
|
|
|
- oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
|
|
|
- oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
|
|
|
- oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
|
|
|
- oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
|
|
|
- oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
|
|
|
- oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
|
|
|
- oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
|
|
|
- oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
|
|
|
- oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
|
|
|
- oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
|
|
|
- oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
|
|
|
- oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
|
|
|
- oci_bind_by_name($stmt, ':In_Language', $In_Language);
|
|
|
- oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
|
|
|
- oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
|
|
|
- oci_execute($stmt);
|
|
|
- oci_close($conn);
|
|
|
- return $result;
|
|
|
- }
|
|
|
}
|